Commit cf739945 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Module hierarchy: HsToCore (cf #13009)

parent af6a0c36
Pipeline #15779 passed with stages
in 463 minutes and 32 seconds
......@@ -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