...
 
Commits (7)
......@@ -574,7 +574,7 @@ let-binding. When abs_sig = True
and hence the abs_binds is non-recursive
(it binds the mono_id but refers to the poly_id
These properties are exploited in DsBinds.dsAbsBinds to
These properties are exploited in GHC.HsToCore.Binds.dsAbsBinds to
generate code without a let-binding.
Note [ABExport wrapper]
......
......@@ -210,10 +210,10 @@ information from an `HsGroup`.
One might wonder why we even bother separating top-level fixity signatures
into two places at all. That is, why not just take the fixity signatures
from `hs_tyclds` and put them into `hs_fixds` so that they are all in one
location? This ends up causing problems for `DsMeta.repTopDs`, which translates
each fixity signature in `hs_fixds` and `hs_tyclds` into a Template Haskell
`Dec`. If there are any duplicate signatures between the two fields, this will
result in an error (#17608).
location? This ends up causing problems for `GHC.HsToCore.Quote.repTopDs`,
which translates each fixity signature in `hs_fixds` and `hs_tyclds` into a
Template Haskell `Dec`. If there are any duplicate signatures between the two
fields, this will result in an error (#17608).
-}
-- | Haskell Group
......
......@@ -577,8 +577,8 @@ data RecordUpdTc = RecordUpdTc
-- | HsWrap appears only in typechecker output
-- Invariant: The contained Expr is *NOT* itself an HsWrap.
-- See Note [Detecting forced eta expansion] in DsExpr. This invariant
-- is maintained by GHC.Hs.Utils.mkHsWrap.
-- See Note [Detecting forced eta expansion] in GHC.HsToCore.Expr.
-- This invariant is maintained by GHC.Hs.Utils.mkHsWrap.
-- hs_syn is something like HsExpr or HsCmd
data HsWrap hs_syn = HsWrap HsWrapper -- the wrapper
(hs_syn GhcTc) -- the thing that is wrapped
......@@ -2693,7 +2693,7 @@ data HsMatchContext p
-- (Just b) | Just _ <- x = e
-- | otherwise = e'
| RecUpd -- ^Record update [used only in DsExpr to
| RecUpd -- ^Record update [used only in GHC.HsToCore.Expr to
-- tell matchWrapper what sort of
-- runtime error message to generate]
......
......@@ -199,7 +199,7 @@ found to have.
-}
-- Comparison operations are needed when grouping literals
-- for compiling pattern-matching (module MatchLit)
-- for compiling pattern-matching (module GHC.HsToCore.Match.Literal)
instance (Eq (XXOverLit p)) => Eq (HsOverLit p) where
(OverLit _ val1 _) == (OverLit _ val2 _) = val1 == val2
(XOverLit val1) == (XOverLit val2) = val1 == val2
......
......@@ -425,7 +425,7 @@ data HsRecField' id arg = HsRecField {
--
-- The renamer produces an Unambiguous result if it can, rather than
-- just doing the lookup in the typechecker, so that completely
-- unambiguous updates can be represented by 'DsMeta.repUpdFields'.
-- unambiguous updates can be represented by 'GHC.HsToCore.Quote.repUpdFields'.
--
-- For example, suppose we have:
--
......
......@@ -759,7 +759,7 @@ mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap co_fn (L loc e) = L loc (mkHsWrap co_fn e)
-- | Avoid @'HsWrap' co1 ('HsWrap' co2 _)@ and @'HsWrap' co1 ('HsPar' _ _)@
-- See Note [Detecting forced eta expansion] in "DsExpr"
-- See Note [Detecting forced eta expansion] in "GHC.HsToCore.Expr"
mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap co_fn e | isIdHsWrapper co_fn = e
mkHsWrap co_fn (XExpr (HsWrap co_fn' e)) = mkHsWrap (co_fn <.> co_fn') e
......@@ -935,7 +935,7 @@ BUT we have a special case when abs_sig is true;
-- | Should we treat this as an unlifted bind? This will be true for any
-- bind that binds an unlifted variable, but we must be careful around
-- AbsBinds. See Note [Unlifted id check in isUnliftedHsBind]. For usage
-- information, see Note [Strict binds check] is DsBinds.
-- information, see Note [Strict binds check] is GHC.HsToCore.Binds.
isUnliftedHsBind :: HsBind GhcTc -> Bool -- works only over typechecked binds
isUnliftedHsBind bind
| AbsBinds { abs_exports = exports, abs_sig = has_sig } <- bind
......@@ -1103,17 +1103,17 @@ collect_lpat p bndrs
go (XPat {}) = bndrs
{-
Note [Dictionary binders in ConPatOut] See also same Note in DsArrows
Note [Dictionary binders in ConPatOut] See also same Note in GHC.HsToCore.Arrows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do *not* gather (a) dictionary and (b) dictionary bindings as binders
of a ConPatOut pattern. For most calls it doesn't matter, because
it's pre-typechecker and there are no ConPatOuts. But it does matter
more in the desugarer; for example, DsUtils.mkSelectorBinds uses
more in the desugarer; for example, GHC.HsToCore.Utils.mkSelectorBinds uses
collectPatBinders. In a lazy pattern, for example f ~(C x y) = ...,
we want to generate bindings for x,y but not for dictionaries bound by
C. (The type checker ensures they would not be used.)
Desugaring of arrow case expressions needs these bindings (see DsArrows
Desugaring of arrow case expressions needs these bindings (see GHC.HsToCore.Arrows
and arrowcase1), but SPJ (Jan 2007) says it's safer for it to use its
own pat-binder-collector:
......@@ -1127,7 +1127,7 @@ f ~(C (n+1) m) = (n,m)
Here, the pattern (C (n+1)) binds a hidden dictionary (d::Num a),
and *also* uses that dictionary to match the (n+1) pattern. Yet, the
variables bound by the lazy pattern are n,m, *not* the dictionary d.
So in mkSelectorBinds in DsUtils, we want just m,n as the variables bound.
So in mkSelectorBinds in GHC.HsToCore.Utils, we want just m,n as the variables bound.
-}
hsGroupBinders :: HsGroup GhcRn -> [Name]
......
......@@ -10,7 +10,7 @@ The Desugarer: turning HsSyn into Core.
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
module Desugar (
module GHC.HsToCore (
-- * Desugaring operations
deSugar, deSugarExpr
) where
......@@ -19,7 +19,7 @@ module Desugar (
import GhcPrelude
import DsUsage
import GHC.HsToCore.Usage
import DynFlags
import HscTypes
import GHC.Hs
......@@ -34,10 +34,10 @@ import CoreSyn
import CoreFVs ( exprsSomeFreeVarsList )
import CoreOpt ( simpleOptPgm, simpleOptExpr )
import PprCore
import DsMonad
import DsExpr
import DsBinds
import DsForeign
import GHC.HsToCore.Monad
import GHC.HsToCore.Expr
import GHC.HsToCore.Binds
import GHC.HsToCore.Foreign.Decl
import PrelNames ( coercibleTyConKey )
import TysPrim ( eqReprPrimTyCon )
import Unique ( hasKey )
......@@ -57,11 +57,11 @@ import FastString
import ErrUtils
import Outputable
import SrcLoc
import Coverage
import GHC.HsToCore.Coverage
import Util
import MonadUtils
import OrdList
import ExtractDocs
import GHC.HsToCore.Docs
import Data.List
import Data.IORef
......@@ -485,7 +485,7 @@ For the LHS of a RULE we do *not* want to desugar
[x] to build (\cn. x `c` n)
We want to leave explicit lists simply as chains
of cons's. We can achieve that slightly indirectly by
switching off EnableRewriteRules. See DsExpr.dsExplicitList.
switching off EnableRewriteRules. See GHC.HsToCore.Expr.dsExplicitList.
That keeps the desugaring of list comprehensions simple too.
......
......@@ -12,15 +12,15 @@ Desugaring arrow commands
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module DsArrows ( dsProcExpr ) where
module GHC.HsToCore.Arrows ( dsProcExpr ) where
#include "HsVersions.h"
import GhcPrelude
import Match
import DsUtils
import DsMonad
import GHC.HsToCore.Match
import GHC.HsToCore.Utils
import GHC.HsToCore.Monad
import GHC.Hs hiding (collectPatBinders, collectPatsBinders,
collectLStmtsBinders, collectLStmtBinders,
......@@ -33,8 +33,8 @@ import qualified GHC.Hs.Utils as HsUtils
-- So WATCH OUT; check each use of split*Ty functions.
-- Sigh. This is a pain.
import {-# SOURCE #-} DsExpr ( dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds,
dsSyntaxExpr )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds,
dsSyntaxExpr )
import TcType
import Type ( splitPiTy )
......@@ -43,7 +43,7 @@ import CoreSyn
import CoreFVs
import CoreUtils
import MkCore
import DsBinds (dsHsWrapper)
import GHC.HsToCore.Binds (dsHsWrapper)
import Id
import ConLike
......
......@@ -17,20 +17,22 @@ lower levels it is preserved with @let@/@letrec@s).
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module DsBinds ( dsTopLHsBinds, dsLHsBinds, decomposeRuleLhs, dsSpec,
dsHsWrapper, dsTcEvBinds, dsTcEvBinds_s, dsEvBinds, dsMkUserRule
) where
module GHC.HsToCore.Binds
( dsTopLHsBinds, dsLHsBinds, decomposeRuleLhs, dsSpec
, dsHsWrapper, dsTcEvBinds, dsTcEvBinds_s, dsEvBinds, dsMkUserRule
)
where
#include "HsVersions.h"
import GhcPrelude
import {-# SOURCE #-} DsExpr( dsLExpr )
import {-# SOURCE #-} Match( matchWrapper )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsLExpr )
import {-# SOURCE #-} GHC.HsToCore.Match ( matchWrapper )
import DsMonad
import DsGRHSs
import DsUtils
import GHC.HsToCore.Monad
import GHC.HsToCore.GuardedRHSs
import GHC.HsToCore.Utils
import GHC.HsToCore.PmCheck ( needToRunPmCheck, addTyCsDs, checkGuardMatches )
import GHC.Hs -- lots of things
......@@ -565,7 +567,7 @@ if there is no variable in the pattern desugaring looks like
in x `seq` body
In order to force the Ids in the binding group they are passed around
in the dsHsBind family of functions, and later seq'ed in DsExpr.ds_val_bind.
in the dsHsBind family of functions, and later seq'ed in GHC.HsToCore.Expr.ds_val_bind.
Consider a recursive group like this
......@@ -632,11 +634,11 @@ The restrictions are:
2. Unlifted binds must also be banged. (There is no trouble to compile an unbanged
unlifted bind, but an unbanged bind looks lazy, and we don't want users to be
surprised by the strictness of an unlifted bind.) Checked in first clause
of DsExpr.ds_val_bind.
of GHC.HsToCore.Expr.ds_val_bind.
3. Unlifted binds may not have polymorphism (#6078). (That is, no quantified type
variables or constraints.) Checked in first clause
of DsExpr.ds_val_bind.
of GHC.HsToCore.Expr.ds_val_bind.
4. Unlifted binds may not be recursive. Checked in second clause of ds_val_bind.
......
module DsBinds where
import DsMonad ( DsM )
import CoreSyn ( CoreExpr )
module GHC.HsToCore.Binds where
import GHC.HsToCore.Monad ( DsM )
import CoreSyn ( CoreExpr )
import TcEvidence (HsWrapper)
dsHsWrapper :: HsWrapper -> DsM (CoreExpr -> CoreExpr)
......@@ -10,7 +10,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module Coverage (addTicksToBinds, hpcInitCode) where
module GHC.HsToCore.Coverage (addTicksToBinds, hpcInitCode) where
import GhcPrelude as Prelude
......
......@@ -6,7 +6,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module ExtractDocs (extractDocs) where
module GHC.HsToCore.Docs (extractDocs) where
import GhcPrelude
import Bag
......
......@@ -13,27 +13,30 @@ Desugaring expressions.
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module DsExpr ( dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds
, dsValBinds, dsLit, dsSyntaxExpr
, dsHandleMonadicFailure ) where
module GHC.HsToCore.Expr
( dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds
, dsValBinds, dsLit, dsSyntaxExpr
, dsHandleMonadicFailure
)
where
#include "HsVersions.h"
import GhcPrelude
import Match
import MatchLit
import DsBinds
import DsGRHSs
import DsListComp
import DsUtils
import DsArrows
import DsMonad
import GHC.HsToCore.Match
import GHC.HsToCore.Match.Literal
import GHC.HsToCore.Binds
import GHC.HsToCore.GuardedRHSs
import GHC.HsToCore.ListComp
import GHC.HsToCore.Utils
import GHC.HsToCore.Arrows
import GHC.HsToCore.Monad
import GHC.HsToCore.PmCheck ( checkGuardMatches )
import Name
import NameEnv
import FamInstEnv( topNormaliseType )
import DsMeta
import GHC.HsToCore.Quote
import GHC.Hs
-- NB: The desugarer, which straddles the source and Core worlds, sometimes
......@@ -119,7 +122,7 @@ ds_val_bind (NonRecursive, hsbinds) body
-- below. Then pattern-match would fail. Urk.)
, isUnliftedHsBind bind
= putSrcSpanDs loc $
-- see Note [Strict binds checks] in DsBinds
-- see Note [Strict binds checks] in GHC.HsToCore.Binds
if is_polymorphic bind
then errDsCoreExpr (poly_bind_err bind)
-- data Ptr a = Ptr Addr#
......@@ -155,7 +158,7 @@ ds_val_bind (NonRecursive, hsbinds) body
text "Probable fix: add a type signature"
ds_val_bind (is_rec, binds) _body
| anyBag (isUnliftedHsBind . unLoc) binds -- see Note [Strict binds checks] in DsBinds
| anyBag (isUnliftedHsBind . unLoc) binds -- see Note [Strict binds checks] in GHC.HsToCore.Binds
= ASSERT( isRec is_rec )
errDsCoreExpr $
hang (text "Recursive bindings for unlifted types aren't allowed:")
......@@ -228,7 +231,7 @@ dsUnliftedBind bind body = pprPanic "dsLet: unlifted" (ppr bind $$ ppr body)
{-
************************************************************************
* *
\subsection[DsExpr-vars-and-cons]{Variables, constructors, literals}
* Variables, constructors, literals *
* *
************************************************************************
-}
......@@ -247,7 +250,7 @@ dsLExpr (L loc e)
-- | Variant of 'dsLExpr' that ensures that the result is not levity
-- polymorphic. This should be used when the resulting expression will
-- be an argument to some other function.
-- See Note [Levity polymorphism checking] in DsMonad
-- See Note [Levity polymorphism checking] in GHC.HsToCore.Monad
-- See Note [Levity polymorphism invariants] in CoreSyn
dsLExprNoLP :: LHsExpr GhcTc -> DsM CoreExpr
dsLExprNoLP (L loc e)
......@@ -875,7 +878,7 @@ dsExplicitList elt_ty Nothing xs
-- Don't generate builds when the [] constructor will do
|| not (gopt Opt_EnableRewriteRules dflags) -- Rewrite rules off
-- Don't generate a build if there are no rules to eliminate it!
-- See Note [Desugaring RULE left hand sides] in Desugar
-- See Note [Desugaring RULE left hand sides] in GHC.HsToCore
then return $ mkListExpr elt_ty xs'
else mkBuildExpr elt_ty (mk_build_list xs') }
where
......@@ -910,7 +913,7 @@ dsArithSeq expr (FromThenTo from thn to)
{-
Desugar 'do' and 'mdo' expressions (NOT list comprehensions, they're
handled in DsListComp). Basically does the translation given in the
handled in GHC.HsToCore.ListComp). Basically does the translation given in the
Haskell 98 report:
-}
......
module DsExpr where
import GHC.Hs ( HsExpr, LHsExpr, LHsLocalBinds, LPat, SyntaxExpr )
import DsMonad ( DsM, MatchResult )
import CoreSyn ( CoreExpr )
import GHC.Hs.Extension ( GhcTc)
module GHC.HsToCore.Expr where
import GHC.Hs ( HsExpr, LHsExpr, LHsLocalBinds, LPat, SyntaxExpr )
import GHC.HsToCore.Monad ( DsM, MatchResult )
import CoreSyn ( CoreExpr )
import GHC.Hs.Extension ( GhcTc)
dsExpr :: HsExpr GhcTc -> DsM CoreExpr
dsLExpr, dsLExprNoLP :: LHsExpr GhcTc -> DsM CoreExpr
......
......@@ -9,13 +9,15 @@ Desugaring foreign calls
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module DsCCall
( dsCCall
, mkFCall
, unboxArg
, boxResult
, resultWrapper
) where
module GHC.HsToCore.Foreign.Call
( dsCCall
, mkFCall
, unboxArg
, boxResult
, resultWrapper
)
where
#include "HsVersions.h"
......@@ -24,13 +26,13 @@ import GhcPrelude
import CoreSyn
import DsMonad
import GHC.HsToCore.Monad
import CoreUtils
import MkCore
import MkId
import ForeignCall
import DataCon
import DsUtils
import GHC.HsToCore.Utils
import TcType
import Type
......
......@@ -3,7 +3,7 @@
(c) The AQUA Project, Glasgow University, 1998
Desugaring foreign declarations (see also DsCCall).
Desugaring foreign declarations (see also GHC.HsToCore.Foreign.Call).
-}
{-# LANGUAGE CPP #-}
......@@ -13,7 +13,7 @@ Desugaring foreign declarations (see also DsCCall).
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module DsForeign ( dsForeigns ) where
module GHC.HsToCore.Foreign.Decl ( dsForeigns ) where
#include "HsVersions.h"
import GhcPrelude
......@@ -22,8 +22,8 @@ import TcRnMonad -- temp
import CoreSyn
import DsCCall
import DsMonad
import GHC.HsToCore.Foreign.Call
import GHC.HsToCore.Monad
import GHC.Hs
import DataCon
......@@ -72,7 +72,7 @@ is the same as
f :: prim_args -> IO prim_res
f a1 ... an = _ccall_ nm cc a1 ... an
\end{verbatim}
so we reuse the desugaring code in @DsCCall@ to deal with these.
so we reuse the desugaring code in @GHC.HsToCore.Foreign.Call@ to deal with these.
-}
type Binding = (Id, CoreExpr) -- No rec/nonrec structure;
......@@ -739,7 +739,7 @@ typeTyCon ty
| Just (tc, _) <- tcSplitTyConApp_maybe (unwrapType ty)
= tc
| otherwise
= pprPanic "DsForeign.typeTyCon" (ppr ty)
= pprPanic "GHC.HsToCore.Foreign.Decl.typeTyCon" (ppr ty)
insertRetAddr :: DynFlags -> CCallConv
-> [(SDoc, SDoc, Type, CmmType)]
......@@ -793,7 +793,7 @@ getPrimTyOf ty
ASSERT(dataConSourceArity data_con == 1)
ASSERT2(isUnliftedType prim_ty, ppr prim_ty)
prim_ty
_other -> pprPanic "DsForeign.getPrimTyOf" (ppr ty)
_other -> pprPanic "GHC.HsToCore.Foreign.Decl.getPrimTyOf" (ppr ty)
where
rep_ty = unwrapType ty
......
......@@ -9,14 +9,14 @@ Matching guarded right-hand-sides (GRHSs)
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
module DsGRHSs ( dsGuarded, dsGRHSs, dsGRHS, isTrueLHsExpr ) where
module GHC.HsToCore.GuardedRHSs ( dsGuarded, dsGRHSs, dsGRHS, isTrueLHsExpr ) where
#include "HsVersions.h"
import GhcPrelude
import {-# SOURCE #-} DsExpr ( dsLExpr, dsLocalBinds )
import {-# SOURCE #-} Match ( matchSinglePatVar )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsLExpr, dsLocalBinds )
import {-# SOURCE #-} GHC.HsToCore.Match ( matchSinglePatVar )
import GHC.Hs
import MkCore
......@@ -26,8 +26,8 @@ import CoreUtils (bindNonRec)
import BasicTypes (Origin(FromSource))
import DynFlags
import GHC.HsToCore.PmCheck (needToRunPmCheck, addTyCsDs, addPatTmCs, addScrutTmCs)
import DsMonad
import DsUtils
import GHC.HsToCore.Monad
import GHC.HsToCore.Utils
import Type ( Type )
import Util
import SrcLoc
......
......@@ -10,28 +10,28 @@ Desugaring list comprehensions, monad comprehensions and array comprehensions
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
module DsListComp ( dsListComp, dsMonadComp ) where
module GHC.HsToCore.ListComp ( dsListComp, dsMonadComp ) where
#include "HsVersions.h"
import GhcPrelude
import {-# SOURCE #-} DsExpr ( dsHandleMonadicFailure, dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds, dsSyntaxExpr )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsHandleMonadicFailure, dsExpr, dsLExpr, dsLExprNoLP, dsLocalBinds, dsSyntaxExpr )
import GHC.Hs
import TcHsSyn
import CoreSyn
import MkCore
import DsMonad -- the monadery used in the desugarer
import DsUtils
import GHC.HsToCore.Monad -- the monadery used in the desugarer
import GHC.HsToCore.Utils
import DynFlags
import CoreUtils
import Id
import Type
import TysWiredIn
import Match
import GHC.HsToCore.Match
import PrelNames
import SrcLoc
import Outputable
......@@ -154,7 +154,7 @@ dsTransStmt _ = panic "dsTransStmt: Not given a TransStmt"
{-
************************************************************************
* *
\subsection[DsListComp-ordinary]{Ordinary desugaring of list comprehensions}
* Ordinary desugaring of list comprehensions *
* *
************************************************************************
......@@ -308,7 +308,7 @@ deBindComp pat core_list1 quals core_list2 = do
{-
************************************************************************
* *
\subsection[DsListComp-foldr-build]{Foldr/Build desugaring of list comprehensions}
* Foldr/Build desugaring of list comprehensions *
* *
************************************************************************
......
......@@ -15,14 +15,17 @@ The @match@ function
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module Match ( match, matchEquations, matchWrapper, matchSimply
, matchSinglePat, matchSinglePatVar ) where
module GHC.HsToCore.Match
( match, matchEquations, matchWrapper, matchSimply
, matchSinglePat, matchSinglePatVar
)
where
#include "HsVersions.h"
import GhcPrelude
import {-#SOURCE#-} DsExpr (dsLExpr, dsSyntaxExpr)
import {-#SOURCE#-} GHC.HsToCore.Expr (dsLExpr, dsSyntaxExpr)
import BasicTypes ( Origin(..) )
import DynFlags
......@@ -35,16 +38,16 @@ import CoreSyn
import Literal
import CoreUtils
import MkCore
import DsMonad
import DsBinds
import DsGRHSs
import DsUtils
import GHC.HsToCore.Monad
import GHC.HsToCore.Binds
import GHC.HsToCore.GuardedRHSs
import GHC.HsToCore.Utils
import Id
import ConLike
import DataCon
import PatSyn
import MatchCon
import MatchLit
import GHC.HsToCore.Match.Constructor
import GHC.HsToCore.Match.Literal
import Type
import Coercion ( eqCoercion )
import TyCon( isNewTyCon )
......@@ -105,7 +108,7 @@ is an embryonic @CoreExpr@ with a ``hole'' at the end for the
final ``else expression''.
\end{itemize}
There is a data type, @EquationInfo@, defined in module @DsMonad@.
There is a data type, @EquationInfo@, defined in module @GHC.HsToCore.Monad@.
An experiment with re-ordering this information about equations (in
particular, having the patterns available in column-major order)
......@@ -162,7 +165,7 @@ sometimes use that Id in a local binding or as a case binder. So it
should not have an External name; Lint rejects non-top-level binders
with External names (#13043).
See also Note [Localise pattern binders] in DsUtils
See also Note [Localise pattern binders] in GHC.HsToCore.Utils
-}
type MatchId = Id -- See Note [Match Ids]
......@@ -717,7 +720,7 @@ matchWrapper
\begin{itemize}
\item @do@ patterns, but if the @do@ can fail
it creates another equation if the match can fail
(see @DsExpr.doDo@ function)
(see @GHC.HsToCore.Expr.doDo@ function)
\item @let@ patterns, are treated by @matchSimply@
List Comprension Patterns, are treated by @matchSimply@ also
\end{itemize}
......
module Match where
module GHC.HsToCore.Match where
import GhcPrelude
import Var ( Id )
import TcType ( Type )
import DsMonad ( DsM, EquationInfo, MatchResult )
import GHC.HsToCore.Monad ( DsM, EquationInfo, MatchResult )
import CoreSyn ( CoreExpr )
import GHC.Hs ( LPat, HsMatchContext, MatchGroup, LHsExpr )
import GHC.Hs.Extension ( GhcRn, GhcTc )
......
......@@ -12,21 +12,21 @@ Pattern-matching constructors
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module MatchCon ( matchConFamily, matchPatSyn ) where
module GHC.HsToCore.Match.Constructor ( matchConFamily, matchPatSyn ) where
#include "HsVersions.h"
import GhcPrelude
import {-# SOURCE #-} Match ( match )
import {-# SOURCE #-} GHC.HsToCore.Match ( match )
import GHC.Hs
import DsBinds
import GHC.HsToCore.Binds
import ConLike
import BasicTypes ( Origin(..) )
import TcType
import DsMonad
import DsUtils
import GHC.HsToCore.Monad
import GHC.HsToCore.Utils
import MkCore ( mkCoreLets )
import Util
import Id
......
......@@ -11,23 +11,25 @@ Pattern-matching literal patterns
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module MatchLit ( dsLit, dsOverLit, hsLitKey
, tidyLitPat, tidyNPat
, matchLiterals, matchNPlusKPats, matchNPats
, warnAboutIdentities
, warnAboutOverflowedOverLit, warnAboutOverflowedLit
, warnAboutEmptyEnumerations
) where
module GHC.HsToCore.Match.Literal
( dsLit, dsOverLit, hsLitKey
, tidyLitPat, tidyNPat
, matchLiterals, matchNPlusKPats, matchNPats
, warnAboutIdentities
, warnAboutOverflowedOverLit, warnAboutOverflowedLit
, warnAboutEmptyEnumerations
)
where
#include "HsVersions.h"
import GhcPrelude
import {-# SOURCE #-} Match ( match )
import {-# SOURCE #-} DsExpr ( dsExpr, dsSyntaxExpr )
import {-# SOURCE #-} GHC.HsToCore.Match ( match )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsExpr, dsSyntaxExpr )
import DsMonad
import DsUtils
import GHC.HsToCore.Monad
import GHC.HsToCore.Utils
import GHC.Hs
......@@ -64,8 +66,8 @@ import Data.Proxy
************************************************************************
* *
Desugaring literals
[used to be in DsExpr, but DsMeta needs it,
and it's nice to avoid a loop]
[used to be in GHC.HsToCore.Expr, but GHC.HsToCore.Quote needs it,
and it's nice to avoid a loop]
* *
************************************************************************
......
......@@ -3,14 +3,14 @@
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
@DsMonad@: monadery used in desugaring
Monadery used in desugaring
-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance MonadThings is necessarily an orphan
{-# LANGUAGE ViewPatterns #-}
module DsMonad (
module GHC.HsToCore.Monad (
DsM, mapM, mapAndUnzipM,
initDs, initDsTc, initTcDsForSolver, initDsWithModGuts, fixDs,
foldlM, foldrM, whenGOptM, unsetGOptM, unsetWOptM, xoptM,
......@@ -108,7 +108,7 @@ data EquationInfo
-- ^ The patterns for an equation
--
-- NB: We have /already/ applied 'decideBangHood' to
-- these patterns. See Note [decideBangHood] in "DsUtils"
-- these patterns. See Note [decideBangHood] in GHC.HsToCore.Utils
, eqn_orig :: Origin
-- ^ Was this equation present in the user source?
......@@ -314,7 +314,7 @@ At one point, I (Richard) thought we could check in the zonker, but it's hard
to know where precisely are the abstracted variables and the arguments. So
we check in the desugarer, the only place where we can see the Core code and
still report respectable syntax to the user. This covers the vast majority
of cases; see calls to DsMonad.dsNoLevPoly and friends.
of cases; see calls to GHC.HsToCore.Monad.dsNoLevPoly and friends.
Levity polymorphism is also prohibited in the types of binders, and the
desugarer checks for this in GHC-generated Ids. (The zonker handles
......@@ -322,7 +322,7 @@ the user-writted ids in zonkIdBndr.) This is done in newSysLocalDsNoLP.
The newSysLocalDs variant is used in the vast majority of cases where
the binder is obviously not levity polymorphic, omitting the check.
It would be nice to ASSERT that there is no levity polymorphism here,
but we can't, because of the fixM in DsArrows. It's all OK, though:
but we can't, because of the fixM in GHC.HsToCore.Arrows. It's all OK, though:
Core Lint will catch an error here.
However, the desugarer is the wrong place for certain checks. In particular,
......@@ -357,7 +357,7 @@ newSysLocalDsNoLP = mk_local (fsLit "ds")
-- this variant should be used when the caller can be sure that the variable type
-- is not levity-polymorphic. It is necessary when the type is knot-tied because
-- of the fixM used in DsArrows. See Note [Levity polymorphism checking]
-- of the fixM used in GHC.HsToCore.Arrows. See Note [Levity polymorphism checking]
newSysLocalDs = mkSysLocalM (fsLit "ds")
newFailLocalDs = mkSysLocalM (fsLit "fail")
-- the fail variable is used only in a situation where we can tell that
......
......@@ -47,16 +47,16 @@ import Var (EvVar)
import Coercion
import TcEvidence
import TcType (evVarPred)
import {-# SOURCE #-} DsExpr (dsExpr, dsLExpr, dsSyntaxExpr)
import {-# SOURCE #-} DsBinds (dsHsWrapper)
import DsUtils (selectMatchVar)
import MatchLit (dsLit, dsOverLit)
import DsMonad
import {-# SOURCE #-} GHC.HsToCore.Expr (dsExpr, dsLExpr, dsSyntaxExpr)
import {-# SOURCE #-} GHC.HsToCore.Binds (dsHsWrapper)
import GHC.HsToCore.Utils (selectMatchVar)
import GHC.HsToCore.Match.Literal (dsLit, dsOverLit)
import GHC.HsToCore.Monad
import Bag
import OrdList
import TyCoRep
import Type
import DsUtils (isTrueLHsExpr)
import GHC.HsToCore.Utils (isTrueLHsExpr)
import Maybes
import qualified GHC.LanguageExtensions as LangExt
......@@ -482,7 +482,7 @@ translatePat fam_insts x pat = case pat of
translateConPatOut fam_insts x con arg_tys ex_tvs dicts ps
NPat ty (L _ olit) mb_neg _ -> do
-- See Note [Literal short cut] in MatchLit.hs
-- See Note [Literal short cut] in GHC.HsToCore.Match.Literal.hs
-- We inline the Literal short cut for @ty@ here, because @ty@ is more
-- precise than the field of OverLitTc, which is all that dsOverLit (which
-- normally does the literal short cut) can look at. Also @ty@ matches the
......@@ -982,8 +982,8 @@ checkGrdTree guards deltas = do
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When checking a match it would be great to have all type and term information
available so we can get more precise results. For this reason we have functions
`addDictsDs' and `addTmVarCsDs' in DsMonad that store in the environment type and
term constraints (respectively) as we go deeper.
`addDictsDs' and `addTmVarCsDs' in GHC.HsToCore.Monad that store in the
environment type and term constraints (respectively) as we go deeper.
The type constraints we propagate inwards are collected by `collectEvVarsPats'
in GHC.Hs.Pat. This handles bug #4139 ( see example
......
......@@ -66,7 +66,7 @@ import Unify (tcMatchTy)
import TcRnTypes (completeMatchConLikes)
import Coercion
import MonadUtils hiding (foldlM)
import DsMonad hiding (foldlM)
import GHC.HsToCore.Monad hiding (foldlM)
import FamInst
import FamInstEnv
......
......@@ -22,25 +22,25 @@
-- a Royal Pain (triggers other recompilation).
-----------------------------------------------------------------------------
module DsMeta( dsBracket ) where
module GHC.HsToCore.Quote( dsBracket ) where
#include "HsVersions.h"
import GhcPrelude
import {-# SOURCE #-} DsExpr ( dsExpr )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsExpr )
import MatchLit
import DsMonad
import GHC.HsToCore.Match.Literal
import GHC.HsToCore.Monad
import qualified Language.Haskell.TH as TH
import GHC.Hs
import PrelNames
-- To avoid clashes with DsMeta.varName we must make a local alias for
-- OccName.varName we do this by removing varName from the import of
-- OccName above, making a qualified instance of OccName and using
-- OccNameAlias.varName where varName ws previously used in this file.
-- To avoid clashes with GHC.HsToCore.Quote.varName we must make a local alias
-- for OccName.varName. We do this by removing varName from the import of OccName
-- above, making a qualified instance of OccName and using OccNameAlias.varName
-- where varName ws previously used in this file.
import qualified OccName( isDataOcc, isVarOcc, isTcOcc )
import Module
......@@ -72,7 +72,7 @@ import Class
import HscTypes ( MonadThings )
import DataCon
import Var
import DsBinds
import GHC.HsToCore.Binds
import GHC.TypeLits
import Data.Kind (Constraint)
......@@ -2105,7 +2105,7 @@ globalVar name
mk_varg | OccName.isDataOcc name_occ = mkNameG_dName
| OccName.isVarOcc name_occ = mkNameG_vName
| OccName.isTcOcc name_occ = mkNameG_tcName
| otherwise = pprPanic "DsMeta.globalVar" (ppr name)
| otherwise = pprPanic "GHC.HsToCore.Quote.globalVar" (ppr name)
lookupType :: Name -- Name of type constructor (e.g. (M TH.Exp))
-> MetaM Type -- The type
......
......@@ -4,7 +4,7 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module DsUsage (
module GHC.HsToCore.Usage (
-- * Dependency/fingerprinting code (used by GHC.Iface.Utils)
mkUsageInfo, mkUsedNames, mkDependencies
) where
......
......@@ -14,7 +14,7 @@ This module exports some utility functions of no great interest.
{-# LANGUAGE ViewPatterns #-}
-- | Utility functions for constructing Core syntax, principally for desugaring
module DsUtils (
module GHC.HsToCore.Utils (
EquationInfo(..),
firstPat, shiftEqns,
......@@ -46,14 +46,14 @@ module DsUtils (
import GhcPrelude
import {-# SOURCE #-} Match ( matchSimply )
import {-# SOURCE #-} DsExpr ( dsLExpr )
import {-# SOURCE #-} GHC.HsToCore.Match ( matchSimply )
import {-# SOURCE #-} GHC.HsToCore.Expr ( dsLExpr )
import GHC.Hs
import TcHsSyn
import TcType( tcSplitTyConApp )
import CoreSyn
import DsMonad
import GHC.HsToCore.Monad
import CoreUtils
import MkCore
......@@ -172,7 +172,7 @@ In fact, even CoreSubst.simplOptExpr will do this, and simpleOptExpr
runs on the output of the desugarer, so all is well by the end of
the desugaring pass.
See also Note [MatchIds] in Match.hs
See also Note [MatchIds] in GHC.HsToCore.Match
************************************************************************
* *
......@@ -668,7 +668,7 @@ mkSelectorBinds :: [[Tickish Id]] -- ^ ticks to add, possibly
-> CoreExpr -- ^ Expression to which the pattern is bound
-> DsM (Id,[(Id,CoreExpr)])
-- ^ Id the rhs is bound to, for desugaring strict
-- binds (see Note [Desugar Strict binds] in DsBinds)
-- binds (see Note [Desugar Strict binds] in GHC.HsToCore.Binds)
-- and all the desugared binds
mkSelectorBinds ticks pat val_expr
......@@ -923,10 +923,10 @@ and
This adjustment is done by decideBangHood,
* Just before constructing an EqnInfo, in Match
* Just before constructing an EqnInfo, in GHC.HsToCore.Match
(matchWrapper and matchSinglePat)
* When desugaring a pattern-binding in DsBinds.dsHsBind
* When desugaring a pattern-binding in GHC.HsToCore.Binds.dsHsBind
Note that it is /not/ done recursively. See the -XStrict
spec in the user manual.
......
......@@ -25,7 +25,7 @@ import BooleanFormula
import Class ( FunDep )
import CoreUtils ( exprType )
import ConLike ( conLikeName )
import Desugar ( deSugarExpr )
import GHC.HsToCore ( deSugarExpr )
import FieldLabel
import GHC.Hs
import HscTypes
......
......@@ -68,7 +68,7 @@ import GHC.Iface.Load
import GHC.CoreToIface
import FlagChecker
import DsUsage ( mkUsageInfo, mkUsedNames, mkDependencies )
import GHC.HsToCore.Usage ( mkUsageInfo, mkUsedNames, mkDependencies )
import Id
import Annotations
import CoreSyn
......@@ -109,7 +109,7 @@ import Fingerprint
import Exception
import UniqSet
import Packages
import ExtractDocs
import GHC.HsToCore.Docs
import Control.Monad
import Data.Function
......
......@@ -704,7 +704,7 @@ postProcessStmtsForApplicativeDo ctxt stmts
; let is_do_expr | DoExpr <- ctxt = True
| otherwise = False
-- don't apply the transformation inside TH brackets, because
-- DsMeta does not handle ApplicativeDo.
-- GHC.HsToCore.Quote does not handle ApplicativeDo.
; in_th_bracket <- isBrackStage <$> getStage
; if ado_is_on && is_do_expr && not in_th_bracket
then do { traceRn "ppsfa" (ppr stmts)
......@@ -984,7 +984,7 @@ lookupStmtNamePoly ctxt name
-- | Is this a context where we respect RebindableSyntax?
-- but ListComp are never rebindable
-- Neither is ArrowExpr, which has its own desugarer in DsArrows
-- Neither is ArrowExpr, which has its own desugarer in GHC.HsToCore.Arrows
rebindableContext :: HsStmtContext GhcRn -> Bool
rebindableContext ctxt = case ctxt of
ListComp -> False
......@@ -1511,7 +1511,7 @@ ApplicativeDo touches a few phases in the compiler:
* Desugarer: Any do-block which contains applicative statements is desugared
as outlined above, to use the Applicative combinators.
Relevant module: DsExpr
Relevant module: GHC.HsToCore.Expr
-}
......
......@@ -1594,8 +1594,9 @@ The hsSyn representation of parsed source explicitly contains all the original
parens, as written in the source.
When a Template Haskell (TH) splice is evaluated, the original splice is first
renamed and type checked and then finally converted to core in DsMeta. This core
is then run in the TH engine, and the result comes back as a TH AST.
renamed and type checked and then finally converted to core in
GHC.HsToCore.Quote. This core is then run in the TH engine, and the result
comes back as a TH AST.
In the process, all parens are stripped out, as they are not needed.
......@@ -1996,11 +1997,11 @@ with the following parts:
Due to the two forall quantifiers and constraint contexts (either of
which might be empty), pattern synonym type signatures are treated
specially in `deSugar/DsMeta.hs`, `hsSyn/Convert.hs`, and
specially in `GHC.HsToCore.Quote`, `GHC.ThToHs`, and
`typecheck/TcSplice.hs`:
(a) When desugaring a pattern synonym from HsSyn to TH.Dec in
`deSugar/DsMeta.hs`, we represent its *full* type signature in TH, i.e.:
`GHC.HsToCore.Quote`, we represent its *full* type signature in TH, i.e.:
ForallT univs reqs (ForallT exis provs ty)
(where ty is the AST representation of t1 -> t2 -> ... -> tn -> t)
......
......@@ -1327,7 +1327,7 @@ if an Id has defaultInlinePragma it means the user didn't specify anything.
If inl_inline = Inline or Inlineable, then the Id should have an InlineRule unfolding.
If you want to know where InlinePragmas take effect: Look in DsBinds.makeCorePair
If you want to know where InlinePragmas take effect: Look in GHC.HsToCore.Binds.makeCorePair
Note [inl_inline and inl_act]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -1526,7 +1526,7 @@ competesWith (ActiveAfter _ a) (ActiveAfter _ b) = a >= b
{- Note [Competing activations]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes a RULE and an inlining may compete, or two RULES.
See Note [Rules and inlining/other rules] in Desugar.
See Note [Rules and inlining/other rules] in GHC.HsToCore.
We say that act1 "competes with" act2 iff
act1 is active in the phase when act2 *becomes* active
......@@ -1615,7 +1615,7 @@ integralFractionalLit neg i = FL { fl_text = SourceText (show i),
fl_value = fromInteger i }
-- Comparison operations are needed when grouping literals
-- for compiling pattern-matching (module MatchLit)
-- for compiling pattern-matching (module GHC.HsToCore.Match.Literal)
instance Eq IntegralLit where
(==) = (==) `on` il_value
......
......@@ -1310,7 +1310,8 @@ dataConInstOrigArgTys
-- equality constraints or dicts
-> [Type]
-- For vanilla datacons, it's all quite straightforward
-- But for the call in MatchCon, we really do want just the value args
-- But for the call in GHC.HsToCore.Match.Constructor, we really do want just
-- the value args
dataConInstOrigArgTys dc@(MkData {dcOrigArgTys = arg_tys,
dcUnivTyVars = univ_tvs,
dcExTyCoVars = ex_tvs}) inst_tys
......
......@@ -565,7 +565,7 @@ lambdas if it is not applied to enough arguments; e.g. (#14561)
bad :: forall (a :: TYPE r). a -> a
bad = unsafeCoerce#
The desugar has special magic to detect such cases: DsExpr.badUseOfLevPolyPrimop.
The desugar has special magic to detect such cases: GHC.HsToCore.Expr.badUseOfLevPolyPrimop.
And we want that magic to apply to levity-polymorphic compulsory-inline things.
The easiest way to do this is for hasNoBinding to return True of all things
that have compulsory unfolding. Some Ids with a compulsory unfolding also
......
......@@ -354,7 +354,7 @@ argument is not levity-polymorphic (which it can't be, according to
Note [Levity polymorphism invariants] in CoreSyn), and it's saturated,
no levity-polymorphic code ends up in the code generator. The saturation
condition is effectively checked by Note [Detecting forced eta expansion]
in DsExpr.
in GHC.HsToCore.Expr.
However, if we make a *wrapper* for a newtype, we get into trouble.
The saturation condition is no longer checked (because hasNoBinding
......@@ -1510,7 +1510,7 @@ Note [seqId magic]
a) Its fixity is set in GHC.Iface.Load.ghcPrimIface
b) It has quite a bit of desugaring magic.
See DsUtils.hs Note [Desugaring seq (1)] and (2) and (3)
See GHC.HsToCore.Utils.hs Note [Desugaring seq (1)] and (2) and (3)
c) There is some special rule handing: Note [User-defined RULES for seq]
......
......@@ -66,8 +66,8 @@ are two reasons why we might look up an Orig RdrName for built-in syntax,
turned into an Orig RdrName.
* Template Haskell turns a BuiltInSyntax Name into a TH.NameG
(DsMeta.globalVar), and parses a NameG into an Orig RdrName
(Convert.thRdrName). So, e.g. $(do { reify '(,); ... }) will
(GHC.HsToCore.Quote.globalVar), and parses a NameG into an Orig RdrName
(GHC.ThToHs.thRdrName). So, e.g. $(do { reify '(,); ... }) will
go this route (#8954).
-}
......
......@@ -669,7 +669,7 @@ When the user writes `RULES map coerce = coerce` as a rule, the rule
will only ever match if simpleOptExpr replaces coerce by its unfolding
on the LHS, because that is the core that the rule matching engine
will find. So do that for everything that has a compulsory
unfolding. Also see Note [Desugaring coerce as cast] in Desugar.
unfolding. Also see Note [Desugaring coerce as cast] in GHC.HsToCore.
However, we don't want to inline 'seq', which happens to also have a
compulsory unfolding, so we only do this unfolding only for things
......
......@@ -739,7 +739,7 @@ and abstractions to get back to an Id, with getIdFromTrivialExpr.
Second, we have to ensure that we never try to substitute a literal
for an Id in a breakpoint. We ensure this by never storing an Id with
an unlifted type in a Breakpoint - see Coverage.mkTickish.
an unlifted type in a Breakpoint - see GHC.HsToCore.Coverage.mkTickish.
Breakpoints can't handle free variables with unlifted types anyway.
-}
......
......@@ -560,7 +560,7 @@ For example
\(r::RuntimeRep). \(a::TYPE r). \(x::a). e
is illegal because x's type has kind (TYPE r), which has 'r' free.
See Note [Levity polymorphism checking] in DsMonad to see where these
See Note [Levity polymorphism checking] in GHC.HsToCore.Monad to see where these
invariants are established for user-written code.
Note [CoreSyn let goal]
......
......@@ -164,7 +164,6 @@ Library
basicTypes
cmm
coreSyn
deSugar
iface
llvmGen
main
......@@ -324,22 +323,22 @@ Library
GHC.HsToCore.PmCheck.Ppr
GHC.HsToCore.PmCheck.Types
GHC.HsToCore.PmCheck
Coverage
Desugar
DsArrows
DsBinds
DsCCall
DsExpr
DsForeign
DsGRHSs
DsListComp
DsMonad
DsUsage
DsUtils
ExtractDocs
Match
MatchCon
MatchLit
GHC.HsToCore.Coverage
GHC.HsToCore
GHC.HsToCore.Arrows
GHC.HsToCore.Binds
GHC.HsToCore.Foreign.Call
GHC.HsToCore.Expr
GHC.HsToCore.Foreign.Decl
GHC.HsToCore.GuardedRHSs
GHC.HsToCore.ListComp
GHC.HsToCore.Monad
GHC.HsToCore.Usage
GHC.HsToCore.Utils
GHC.HsToCore.Docs
GHC.HsToCore.Match
GHC.HsToCore.Match.Constructor
GHC.HsToCore.Match.Literal
GHC.Hs
GHC.Hs.Binds
GHC.Hs.Decls
......@@ -526,7 +525,7 @@ Library
TcSplice
Class
Coercion
DsMeta
GHC.HsToCore.Quote
THNames
FamInstEnv
FunDeps
......
......@@ -965,7 +965,7 @@ runPhase (RealPhase (Unlit sf)) input_fn dflags
-- escape the characters \, ", and ', but don't try to escape
-- Unicode or anything else (so we don't use Util.charToC
-- here). If we get this wrong, then in
-- Coverage.isGoodTickSrcSpan where we check that the filename in
-- GHC.HsToCore.Coverage.isGoodTickSrcSpan where we check that the filename in
-- a SrcLoc is the same as the source filenaame, the two will
-- look bogusly different. See test:
-- libraries/hpc/tests/function/subdir/tough2.hs
......@@ -2308,7 +2308,7 @@ Introduction
4) -fhpc
At some point during compilation with -fhpc, in the function
`deSugar.Coverage.isGoodTickSrcSpan`, we compare the filename that a
`GHC.HsToCore.Coverage.isGoodTickSrcSpan`, we compare the filename that a
`SrcSpan` refers to with the name of the file we are currently compiling.
For some reason I don't yet understand, they can sometimes legitimally be
different, and then hpc ignores that SrcSpan.
......
......@@ -120,7 +120,7 @@ import NameCache ( initNameCache )
import GHC.Iface.Load ( ifaceStats, initExternalPackageState )
import PrelInfo
import GHC.Iface.Utils
import Desugar
import GHC.HsToCore
import SimplCore
import GHC.Iface.Tidy
import GHC.CoreToStg.Prep
......
......@@ -2326,7 +2326,7 @@ class Monad m => MonadThings m where
lookupTyCon :: Name -> m TyCon
lookupTyCon = liftM tyThingTyCon . lookupThing
-- Instance used in DsMeta
-- Instance used in GHC.HsToCore.Quote
instance MonadThings m => MonadThings (ReaderT s m) where
lookupThing = lift . lookupThing
......@@ -3237,7 +3237,7 @@ for the same TyCon:
And looking up the values in the CompleteMatchMap associated with Boolean
would give you [CompleteMatch [F, T1] Boolean, CompleteMatch [F, T2] Boolean].
dsGetCompleteMatches in DsMeta accomplishes this lookup.
dsGetCompleteMatches in GHC.HsToCore.Quote accomplishes this lookup.
Also see Note [Typechecking Complete Matches] in TcBinds for a more detailed
explanation for how GHC ensures that all the conlikes in a COMPLETE set are
......
......@@ -24,7 +24,7 @@ import FastString
templateHaskellNames :: [Name]
-- The names that are implicitly mentioned by ``bracket''
-- Should stay in sync with the import list of DsMeta
-- Should stay in sync with the import list of GHC.HsToCore.Quote
templateHaskellNames = [
returnQName, bindQName, sequenceQName, newNameName, liftName, liftTypedName,
......@@ -562,7 +562,7 @@ decsQTyConName = libTc (fsLit "DecsQ") decsQTyConKey -- Q [De
typeQTyConName = libTc (fsLit "TypeQ") typeQTyConKey
patQTyConName = libTc (fsLit "PatQ") patQTyConKey
-- These are used in DsMeta but always wrapped in a type variable
-- These are used in GHC.HsToCore.Quote but always wrapped in a type variable
stmtTyConName = thTc (fsLit "Stmt") stmtTyConKey
conTyConName = thTc (fsLit "Con") conTyConKey
bangTypeTyConName = thTc (fsLit "BangType") bangTypeTyConKey
......
......@@ -702,7 +702,7 @@ Note [One-tuples]
GHC supports both boxed and unboxed one-tuples:
- Unboxed one-tuples are sometimes useful when returning a
single value after CPR analysis
- A boxed one-tuple is used by DsUtils.mkSelectorBinds, when
- A boxed one-tuple is used by GHC.HsToCore.Utils.mkSelectorBinds, when
there is just one binder
Basically it keeps everything uniform.
......
......@@ -75,7 +75,7 @@ Note [Overall plumbing for rules]
locally-declared rules for imported Ids.
- Locally-declared rules for locally-declared Ids are attached to
the IdInfo for that Id. See Note [Attach rules to local ids] in
DsBinds
GHC.HsToCore.Binds
* GHC.Iface.Tidy strips off all the rules from local Ids and adds them to
mg_rules, so that the ModGuts has *all* the locally-declared rules.
......
......@@ -2152,36 +2152,8 @@ canEqReflexive ev eq_rel ty
mkTcReflCo (eqRelRole eq_rel) ty)
; stopWith ev "Solved by reflexivity" }
{-
Note [Canonical orientation for tyvar/tyvar equality constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we have a ~ b where both 'a' and 'b' are TcTyVars, which way
round should be oriented in the CTyEqCan? The rules, implemented by
canEqTyVarTyVar, are these
* If either is a flatten-meta-variables, it goes on the left.
* Put a meta-tyvar on the left if possible
alpha[3] ~ r
* If both are meta-tyvars, put the more touchable one (deepest level
number) on the left, so there is the best chance of unifying it
alpha[3] ~ beta[2]
* If both are meta-tyvars and both at the same level, put a TyVarTv
on the right if possible
alpha[2] ~ beta[2](sig-tv)
That way, when we unify alpha := beta, we don't lose the TyVarTv flag.
* Put a meta-tv with a System Name on the left if possible so it
gets eliminated (improves error messages)
* If one is a flatten-skolem, put it on the left so that it is
substituted out Note [Eliminate flat-skols] in TcUinfy
fsk ~ a
Note [Equalities with incompatible kinds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{- Note [Equalities with incompatible kinds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What do we do when we have an equality
(tv :: k1) ~ (rhs :: k2)
......
......@@ -212,7 +212,7 @@ data HsWrapper
-- The TcType is the "from" type of the first wrapper
-- The SDoc explains the circumstances under which we have created this
-- WpFun, in case we run afoul of levity polymorphism restrictions in
-- the desugarer. See Note [Levity polymorphism checking] in DsMonad
-- the desugarer. See Note [Levity polymorphism checking] in GHC.HsToCore.Monad
| WpCast TcCoercionR -- A cast: [] `cast` co
-- Guaranteed not the identity coercion
......@@ -782,7 +782,7 @@ Important Details:
- An EvCallStack term desugars to a CoreExpr of type `IP "some str" CallStack`.
The desugarer will need to unwrap the IP newtype before pushing a new
call-site onto a given stack (See DsBinds.dsEvCallStack)
call-site onto a given stack (See GHC.HsToCore.Binds.dsEvCallStack)
- When we emit a new wanted CallStack from rule (2) we set its origin to
`IPOccOrigin ip_name` instead of the original `OccurrenceOf func`
......
......@@ -51,7 +51,7 @@ import Data.Graph ( graphFromEdges, topSort )
import TcSimplify ( simpl_top, runTcSDeriveds )
import TcUnify ( tcSubType_NC )
import ExtractDocs ( extractDocs )
import GHC.HsToCore.Docs ( extractDocs )
import qualified Data.Map as Map
import GHC.Hs.Doc ( unpackHDS, DeclDocMap(..) )
import HscTypes ( ModIface_(..) )
......
......@@ -1895,7 +1895,7 @@ zonkTcMethInfoToMethInfoX ze (name, ty, gdm_spec)
---------------------------------------
{- Note [Zonking the LHS of a RULE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See also DsBinds Note [Free tyvars on rule LHS]
See also GHC.HsToCore.Binds Note [Free tyvars on rule LHS]
We need to gather the type variables mentioned on the LHS so we can
quantify over them. Example:
......@@ -1918,7 +1918,7 @@ We do this in two stages.
ZonkEnv. (This is in fact the whole reason that the ZonkEnv has a
UnboundTyVarZonker.)
* In DsBinds, we quantify over it. See DsBinds
* In GHC.HsToCore.Binds, we quantify over it. See GHC.HsToCore.Binds
Note [Free tyvars on rule LHS]
Quantifying here is awkward because (a) the data type is big and (b)
......
......@@ -1163,7 +1163,7 @@ addDFunPrags dfun_id sc_meth_ids
con_app = mkLams dfun_bndrs $
mkApps (Var (dataConWrapId dict_con)) dict_args
-- mkApps is OK because of the checkForLevPoly call in checkValidClass
-- See Note [Levity polymorphism checking] in DsMonad
-- See Note [Levity polymorphism checking] in GHC.HsToCore.Monad
dict_args = map Type inst_tys ++
[mkVarApps (Var id) dfun_bndrs | id <- sc_meth_ids]
......
......@@ -2333,7 +2333,7 @@ tidySigSkol env cx ty tv_prs
* *
*************************************************************************
See Note [Levity polymorphism checking] in DsMonad
See Note [Levity polymorphism checking] in GHC.HsToCore.Monad
-}
......@@ -2354,7 +2354,7 @@ ensureNotLevPoly ty doc
-- forall a. a. See, for example, test ghci/scripts/T9140
checkForLevPoly doc ty
-- See Note [Levity polymorphism checking] in DsMonad
-- See Note [Levity polymorphism checking] in GHC.HsToCore.Monad
checkForLevPoly :: SDoc -> Type -> TcM ()
checkForLevPoly = checkForLevPolyX addErr
......
......@@ -1093,7 +1093,7 @@ Note [Record PatSyn Desugaring]
It is important that prov_theta comes before req_theta as this ordering is used
when desugaring record pattern synonym updates.
Any change to this ordering should make sure to change deSugar/DsExpr.hs if you
Any change to this ordering should make sure to change GHC.HsToCore.Expr if you
want to avoid difficult to decipher core lint errors!
-}
......
......@@ -242,7 +242,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this
-- We want to serialize the documentation in the .hi-files,
-- and need to extract it from the renamed syntax first.
-- See 'ExtractDocs.extractDocs'.
-- See 'GHC.HsToCore.Docs.extractDocs'.
| gopt Opt_Haddock dflags = Just empty_val
| keep_rn_syntax = Just empty_val
......
......@@ -668,7 +668,7 @@ Note that
From the TcSpecPrag, in DsBinds we generate a binding for f_spec and a RULE:
From the TcSpecPrag, in GHC.HsToCore.Binds we generate a binding for f_spec and a RULE:
f_spec :: Int -> b -> Int
f_spec = wrap<f rhs>
......
......@@ -99,8 +99,8 @@ import DataCon
import TcEvidence
import Id
import IdInfo
import DsExpr
import DsMonad
import GHC.HsToCore.Expr
import GHC.HsToCore.Monad
import GHC.Serialized
import ErrUtils
import Util
......@@ -179,7 +179,7 @@ tcTypedBracket rn_expr brack@(TExpBr _ expr) res_ty
; m_var <- mkTyVarTy <$> mkMetaTyVar
-- Make sure the type variable satisfies Quote
; ev_var <- emitQuoteWanted m_var
-- Bundle them together so they can be used in DsMeta for desugaring
-- Bundle them together so they can be used in GHC.HsToCore.Quote for desugaring
-- brackets.
; let wrapper = QuoteWrapper ev_var m_var
-- Typecheck expr to make sure it is valid,
......@@ -380,7 +380,7 @@ The life cycle of a un-typed bracket:
In both cases, desugaring happens like this:
* HsTcBracketOut is desugared by DsMeta.dsBracket. It
* HsTcBracketOut is desugared by GHC.HsToCore.Quote.dsBracket. It
a) Extends the ds_meta environment with the PendingSplices
attached to the bracket
......@@ -395,10 +395,10 @@ In both cases, desugaring happens like this:
${n}(e). The name is initialised to an (Unqual "splice") when the
splice is created; the renamer gives it a unique.
* When DsMeta (used to desugar the body of the bracket) comes across
* When GHC.HsToCore.Quote (used to desugar the body of the bracket) comes across
a splice, it looks up the splice's Name, n, in the ds_meta envt,
to find an (HsExpr Id) that should be substituted for the splice;
it just desugars it to get a CoreExpr (DsMeta.repSplice).
it just desugars it to get a CoreExpr (GHC.HsToCore.Quote.repSplice).
</