Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
cf739945
Commit
cf739945
authored
Jan 26, 2020
by
Sylvain Henry
Committed by
Marge Bot
Feb 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Module hierarchy: HsToCore (cf #13009)
parent
af6a0c36
Changes
59
Hide whitespace changes
Inline
Side-by-side
Showing
59 changed files
with
254 additions
and
234 deletions
+254
-234
compiler/GHC/Hs/Binds.hs
compiler/GHC/Hs/Binds.hs
+1
-1
compiler/GHC/Hs/Decls.hs
compiler/GHC/Hs/Decls.hs
+4
-4
compiler/GHC/Hs/Expr.hs
compiler/GHC/Hs/Expr.hs
+3
-3
compiler/GHC/Hs/Lit.hs
compiler/GHC/Hs/Lit.hs
+1
-1
compiler/GHC/Hs/Pat.hs
compiler/GHC/Hs/Pat.hs
+1
-1
compiler/GHC/Hs/Utils.hs
compiler/GHC/Hs/Utils.hs
+6
-6
compiler/GHC/HsToCore.hs
compiler/GHC/HsToCore.hs
+9
-9
compiler/GHC/HsToCore/Arrows.hs
compiler/GHC/HsToCore/Arrows.hs
+7
-7
compiler/GHC/HsToCore/Binds.hs
compiler/GHC/HsToCore/Binds.hs
+13
-11
compiler/GHC/HsToCore/Binds.hs-boot
compiler/GHC/HsToCore/Binds.hs-boot
+6
-0
compiler/GHC/HsToCore/Coverage.hs
compiler/GHC/HsToCore/Coverage.hs
+1
-1
compiler/GHC/HsToCore/Docs.hs
compiler/GHC/HsToCore/Docs.hs
+1
-1
compiler/GHC/HsToCore/Expr.hs
compiler/GHC/HsToCore/Expr.hs
+21
-18
compiler/GHC/HsToCore/Expr.hs-boot
compiler/GHC/HsToCore/Expr.hs-boot
+5
-5
compiler/GHC/HsToCore/Foreign/Call.hs
compiler/GHC/HsToCore/Foreign/Call.hs
+11
-9
compiler/GHC/HsToCore/Foreign/Decl.hs
compiler/GHC/HsToCore/Foreign/Decl.hs
+7
-7
compiler/GHC/HsToCore/GuardedRHSs.hs
compiler/GHC/HsToCore/GuardedRHSs.hs
+5
-5
compiler/GHC/HsToCore/ListComp.hs
compiler/GHC/HsToCore/ListComp.hs
+7
-7
compiler/GHC/HsToCore/Match.hs
compiler/GHC/HsToCore/Match.hs
+15
-12
compiler/GHC/HsToCore/Match.hs-boot
compiler/GHC/HsToCore/Match.hs-boot
+2
-2
compiler/GHC/HsToCore/Match/Constructor.hs
compiler/GHC/HsToCore/Match/Constructor.hs
+5
-5
compiler/GHC/HsToCore/Match/Literal.hs
compiler/GHC/HsToCore/Match/Literal.hs
+15
-13
compiler/GHC/HsToCore/Monad.hs
compiler/GHC/HsToCore/Monad.hs
+6
-6
compiler/GHC/HsToCore/PmCheck.hs
compiler/GHC/HsToCore/PmCheck.hs
+9
-9
compiler/GHC/HsToCore/PmCheck/Oracle.hs
compiler/GHC/HsToCore/PmCheck/Oracle.hs
+1
-1
compiler/GHC/HsToCore/Quote.hs
compiler/GHC/HsToCore/Quote.hs
+10
-10
compiler/GHC/HsToCore/Usage.hs
compiler/GHC/HsToCore/Usage.hs
+1
-1
compiler/GHC/HsToCore/Utils.hs
compiler/GHC/HsToCore/Utils.hs
+8
-8
compiler/GHC/Iface/Ext/Ast.hs
compiler/GHC/Iface/Ext/Ast.hs
+1
-1
compiler/GHC/Iface/Utils.hs
compiler/GHC/Iface/Utils.hs
+2
-2
compiler/GHC/Rename/Expr.hs
compiler/GHC/Rename/Expr.hs
+3
-3
compiler/GHC/ThToHs.hs
compiler/GHC/ThToHs.hs
+5
-4
compiler/basicTypes/BasicTypes.hs
compiler/basicTypes/BasicTypes.hs
+3
-3
compiler/basicTypes/DataCon.hs
compiler/basicTypes/DataCon.hs
+2
-1
compiler/basicTypes/Id.hs
compiler/basicTypes/Id.hs
+1
-1
compiler/basicTypes/MkId.hs
compiler/basicTypes/MkId.hs
+2
-2
compiler/basicTypes/NameCache.hs
compiler/basicTypes/NameCache.hs
+2
-2
compiler/coreSyn/CoreOpt.hs
compiler/coreSyn/CoreOpt.hs
+1
-1
compiler/coreSyn/CoreSubst.hs
compiler/coreSyn/CoreSubst.hs
+1
-1
compiler/coreSyn/CoreSyn.hs
compiler/coreSyn/CoreSyn.hs
+1
-1
compiler/ghc.cabal.in
compiler/ghc.cabal.in
+17
-18
compiler/main/DriverPipeline.hs
compiler/main/DriverPipeline.hs
+2
-2
compiler/main/HscMain.hs
compiler/main/HscMain.hs
+1
-1
compiler/main/HscTypes.hs
compiler/main/HscTypes.hs
+2
-2
compiler/prelude/THNames.hs
compiler/prelude/THNames.hs
+2
-2
compiler/prelude/TysWiredIn.hs
compiler/prelude/TysWiredIn.hs
+1
-1
compiler/specialise/Rules.hs
compiler/specialise/Rules.hs
+1
-1
compiler/typecheck/TcEvidence.hs
compiler/typecheck/TcEvidence.hs
+2
-2
compiler/typecheck/TcHoleErrors.hs
compiler/typecheck/TcHoleErrors.hs
+1
-1
compiler/typecheck/TcHsSyn.hs
compiler/typecheck/TcHsSyn.hs
+2
-2
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcInstDcls.hs
+1
-1
compiler/typecheck/TcMType.hs
compiler/typecheck/TcMType.hs
+2
-2
compiler/typecheck/TcPatSyn.hs
compiler/typecheck/TcPatSyn.hs
+1
-1
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcRnMonad.hs
+1
-1
compiler/typecheck/TcSigs.hs
compiler/typecheck/TcSigs.hs
+1
-1
compiler/typecheck/TcSplice.hs
compiler/typecheck/TcSplice.hs
+7
-7
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcTyClsDecls.hs
+1
-1
ghc/GHCi/UI/Info.hs
ghc/GHCi/UI/Info.hs
+1
-1
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+3
-2
No files found.
compiler/GHC/Hs/Binds.hs
View file @
cf739945
...
...
@@ -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
Ds
Binds.dsAbsBinds to
These properties are exploited in
GHC.HsToCore.
Binds.dsAbsBinds to
generate code without a let-binding.
Note [ABExport wrapper]
...
...
compiler/GHC/Hs/Decls.hs
View file @
cf739945
...
...
@@ -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
...
...
compiler/GHC/Hs/Expr.hs
View file @
cf739945
...
...
@@ -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
Ds
Expr to
|
RecUpd
-- ^Record update [used only in
GHC.HsToCore.
Expr to
-- tell matchWrapper what sort of
-- runtime error message to generate]
...
...
compiler/GHC/Hs/Lit.hs
View file @
cf739945
...
...
@@ -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
.
Lit
eral
)
instance
(
Eq
(
XXOverLit
p
))
=>
Eq
(
HsOverLit
p
)
where
(
OverLit
_
val1
_
)
==
(
OverLit
_
val2
_
)
=
val1
==
val2
(
XOverLit
val1
)
==
(
XOverLit
val2
)
=
val1
==
val2
...
...
compiler/GHC/Hs/Pat.hs
View file @
cf739945
...
...
@@ -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:
--
...
...
compiler/GHC/Hs/Utils.hs
View file @
cf739945
...
...
@@ -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 "
Ds
Expr"
-- 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
Ds
Binds.
-- 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
Ds
Arrows
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,
Ds
Utils.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
Ds
Arrows
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
Ds
Utils, 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
]
...
...
compiler/
deSugar/Desugar
.hs
→
compiler/
GHC/HsToCore
.hs
View file @
cf739945
...
...
@@ -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
Ds
Usage
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
Ds
Monad
import
Ds
Expr
import
Ds
Binds
import
Ds
Foreign
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
Extract
Docs
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
Ds
Expr.dsExplicitList.
switching off EnableRewriteRules. See
GHC.HsToCore.
Expr.dsExplicitList.
That keeps the desugaring of list comprehensions simple too.
...
...
compiler/
deSugar/Ds
Arrows.hs
→
compiler/
GHC/HsToCore/
Arrows.hs
View file @
cf739945
...
...
@@ -12,15 +12,15 @@ Desugaring arrow commands
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module
Ds
Arrows
(
dsProcExpr
)
where
module
GHC.HsToCore.
Arrows
(
dsProcExpr
)
where
#
include
"HsVersions.h"
import
GhcPrelude
import
Match
import
Ds
Utils
import
Ds
Monad
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
#-
}
Ds
Expr
(
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
Ds
Binds
(
dsHsWrapper
)
import
GHC.HsToCore.
Binds
(
dsHsWrapper
)
import
Id
import
ConLike
...
...
compiler/
deSugar/Ds
Binds.hs
→
compiler/
GHC/HsToCore/
Binds.hs
View file @
cf739945
...
...
@@ -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
#-
}
Ds
Expr
(
dsLExpr
)
import
{-#
SOURCE
#-
}
Match
(
matchWrapper
)
import
{-#
SOURCE
#-
}
GHC
.
HsToCore
.
Expr
(
dsLExpr
)
import
{-#
SOURCE
#-
}
GHC
.
HsToCore
.
Match
(
matchWrapper
)
import
Ds
Monad
import
DsG
RHSs
import
Ds
Utils
import
GHC.HsToCore.
Monad
import
GHC.HsToCore.Guarded
RHSs
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
Ds
Expr.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
Ds
Expr.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
Ds
Expr.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.
...
...
compiler/
deSugar/Ds
Binds.hs-boot
→
compiler/
GHC/HsToCore/
Binds.hs-boot
View file @
cf739945
module
Ds
Binds
where
import
Ds
Monad
(
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
)
compiler/
deSugar
/Coverage.hs
→
compiler/
GHC/HsToCore
/Coverage.hs
View file @
cf739945
...
...
@@ -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
...
...
compiler/
deSugar/Extract
Docs.hs
→
compiler/
GHC/HsToCore/
Docs.hs
View file @
cf739945
...
...
@@ -6,7 +6,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module
Extract
Docs
(
extractDocs
)
where
module
GHC.HsToCore.
Docs
(
extractDocs
)
where
import
GhcPrelude
import
Bag
...
...
compiler/
deSugar/Ds
Expr.hs
→
compiler/
GHC/HsToCore/
Expr.hs
View file @
cf739945
...
...
@@ -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
Ds
Binds
import
DsG
RHSs
import
Ds
ListComp
import
Ds
Utils
import
Ds
Arrows
import
Ds
Monad
import
GHC.HsToCore.
Match
import
GHC.HsToCore.
Match
.
Lit
eral
import
GHC.HsToCore.
Binds
import
GHC.HsToCore.Guarded
RHSs
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
Ds
Binds
-- 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
Ds
Binds
|
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
Ds
Monad
-- 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
Ds
ListComp). Basically does the translation given in the
handled in
GHC.HsToCore.
ListComp). Basically does the translation given in the
Haskell 98 report:
-}
...
...
compiler/
deSugar/Ds
Expr.hs-boot
→
compiler/
GHC/HsToCore/
Expr.hs-boot
View file @
cf739945
module
Ds
Expr
where
import
GHC.Hs
(
HsExpr
,
LHsExpr
,
LHsLocalBinds
,
LPat
,
SyntaxExpr
)
import
Ds
Monad
(
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
...
...
compiler/
deSugar/DsC
Call.hs
→
compiler/
GHC/HsToCore/Foreign/
Call.hs
View file @
cf739945
...
...
@@ -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
Ds
Monad
import
GHC.HsToCore.
Monad
import
CoreUtils
import
MkCore
import
MkId
import
ForeignCall
import
DataCon
import
Ds
Utils
import
GHC.HsToCore.
Utils
import
TcType
import
Type
...
...
compiler/
deSugar/Ds
Foreign.hs
→
compiler/
GHC/HsToCore/
Foreign
/Decl
.hs
View file @
cf739945
...
...
@@ -3,7 +3,7 @@
(c) The AQUA Project, Glasgow University, 1998
Desugaring foreign declarations (see also
DsC
Call).
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
Ds
Foreign
(
dsForeigns
)
where
module
GHC.HsToCore.
Foreign
.Decl
(
dsForeigns
)
where
#
include
"HsVersions.h"
import
GhcPrelude
...
...
@@ -22,8 +22,8 @@ import TcRnMonad -- temp
import
CoreSyn
import
DsC
Call
import
Ds
Monad
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 @
DsC
Call@ 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
"
Ds
Foreign.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
"
Ds
Foreign.getPrimTyOf"
(
ppr
ty
)
_other
->
pprPanic
"
GHC.HsToCore.
Foreign.
Decl.
getPrimTyOf"
(
ppr
ty
)
where
rep_ty
=
unwrapType
ty
...
...
compiler/
deSugar/DsG
RHSs.hs
→
compiler/
GHC/HsToCore/Guarded
RHSs.hs
View file @
cf739945
...
...
@@ -9,14 +9,14 @@ Matching guarded right-hand-sides (GRHSs)
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
module
DsG
RHSs
(
dsGuarded
,
dsGRHSs
,
dsGRHS
,
isTrueLHsExpr
)
where
module
GHC.HsToCore.Guarded
RHSs
(
dsGuarded
,
dsGRHSs
,
dsGRHS
,
isTrueLHsExpr
)
where
#
include
"HsVersions.h"
import
GhcPrelude
import
{-#
SOURCE
#-
}
Ds
Expr
(
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
Ds
Monad
import
Ds
Utils
import
GHC.HsToCore.
Monad
import
GHC.HsToCore.
Utils
import
Type
(
Type
)
import
Util
import
SrcLoc
...
...
compiler/
deSugar/Ds
ListComp.hs
→
compiler/
GHC/HsToCore/
ListComp.hs
View file @
cf739945
...
...
@@ -10,28 +10,28 @@ Desugaring list comprehensions, monad comprehensions and array comprehensions
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
module
Ds
ListComp
(
dsListComp
,
dsMonadComp
)
where
module
GHC.HsToCore.
ListComp
(
dsListComp
,
dsMonadComp
)
where
#
include
"HsVersions.h"
import
GhcPrelude
import
{-#
SOURCE
#-
}
Ds
Expr
(
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
Ds
Monad
-- the monadery used in the desugarer
import
Ds
Utils
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
*
* *
************************************************************************
...
...
compiler/
deSugar
/Match.hs
→
compiler/
GHC/HsToCore
/Match.hs
View file @
cf739945
...
...
@@ -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
#-
}
Ds
Expr
(
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
Ds
Monad
import
Ds
Binds
import
DsG
RHSs
import
Ds
Utils
import
GHC.HsToCore.
Monad
import
GHC.HsToCore.
Binds
import
GHC.HsToCore.Guarded
RHSs
import
GHC.HsToCore.
Utils