[Git][ghc/ghc][wip/strict-ttg] Strict TTG extension fields (#18764)
Vladislav Zavialov
gitlab at gitlab.haskell.org
Wed Sep 30 08:55:41 UTC 2020
Vladislav Zavialov pushed to branch wip/strict-ttg at Glasgow Haskell Compiler / GHC
Commits:
4b91e136 by Vladislav Zavialov at 2020-09-30T11:54:28+03:00
Strict TTG extension fields (#18764)
Before this patch, some of the TTG extension fields were non-strict:
data HsType pass
= ...
| HsTyVar (XTyVar pass) PromotionFlag (LIdP pass)
| HsAppTy (XAppTy pass) (LHsType pass) (LHsType pass)
| ...
Now they are strict:
data HsType pass
= ...
| HsTyVar !(XTyVar pass) PromotionFlag (LIdP pass)
| HsAppTy !(XAppTy pass) (LHsType pass) (LHsType pass)
| ...
This allows us to selectively exclude certain constructors from a
particular pass. For example, if we wanted to statically guarantee that
HsTyVar is never used in the GhcTc pass, we could encode it as follows:
type instance XTyVar GhcTc = Void
Then the pattern-match exhaustiveness checker could see that HsTyVar is
an impossible case, even without an explicit call to `absurd`.
04b6cf947ea065a210a216cc91f918cc1660d430 applied this trick to TTG
extension constructors, to avoid excessive use of `noExtCon`.
This patch takes it a bit further and makes all extension fields
throughout the compiler strict.
- - - - -
8 changed files:
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Lit.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
Changes:
=====================================
compiler/GHC/Hs/Binds.hs
=====================================
@@ -79,7 +79,7 @@ type LHsLocalBinds id = XRec id (HsLocalBinds id)
-- or a 'where' clause
data HsLocalBindsLR idL idR
= HsValBinds
- (XHsValBinds idL idR)
+ !(XHsValBinds idL idR)
(HsValBindsLR idL idR)
-- ^ Haskell Value Bindings
@@ -89,11 +89,11 @@ data HsLocalBindsLR idL idR
-- renamer to report them
| HsIPBinds
- (XHsIPBinds idL idR)
+ !(XHsIPBinds idL idR)
(HsIPBinds idR)
-- ^ Haskell Implicit Parameter Bindings
- | EmptyLocalBinds (XEmptyLocalBinds idL idR)
+ | EmptyLocalBinds !(XEmptyLocalBinds idL idR)
-- ^ Empty Local Bindings
| XHsLocalBindsLR
@@ -121,7 +121,7 @@ data HsValBindsLR idL idR
-- Not dependency analysed
-- Recursive by default
ValBinds
- (XValBinds idL idR)
+ !(XValBinds idL idR)
(LHsBindsLR idL idR) [LSig idR]
-- | Value Bindings Out
@@ -224,7 +224,7 @@ data HsBindLR idL idR
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
FunBind {
- fun_ext :: XFunBind idL idR,
+ fun_ext :: !(XFunBind idL idR),
-- ^ After the renamer (but before the type-checker), this contains the
-- locally-bound free variables of this defn. See Note [Bind free vars]
@@ -264,7 +264,7 @@ data HsBindLR idL idR
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| PatBind {
- pat_ext :: XPatBind idL idR, -- ^ See Note [Bind free vars]
+ pat_ext :: !(XPatBind idL idR), -- ^ See Note [Bind free vars]
pat_lhs :: LPat idL,
pat_rhs :: GRHSs idR (LHsExpr idR),
pat_ticks :: ([Tickish Id], [[Tickish Id]])
@@ -277,14 +277,14 @@ data HsBindLR idL idR
-- Dictionary binding and suchlike.
-- All VarBinds are introduced by the type checker
| VarBind {
- var_ext :: XVarBind idL idR,
+ var_ext :: !(XVarBind idL idR),
var_id :: IdP idL,
var_rhs :: LHsExpr idR -- ^ Located only for consistency
}
-- | Abstraction Bindings
| AbsBinds { -- Binds abstraction; TRANSLATION
- abs_ext :: XAbsBinds idL idR,
+ abs_ext :: !(XAbsBinds idL idR),
abs_tvs :: [TyVar],
abs_ev_vars :: [EvVar], -- ^ Includes equality constraints
@@ -306,7 +306,7 @@ data HsBindLR idL idR
-- | Patterns Synonym Binding
| PatSynBind
- (XPatSynBind idL idR)
+ !(XPatSynBind idL idR)
(PatSynBind idL idR)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnPattern',
-- 'GHC.Parser.Annotation.AnnLarrow','GHC.Parser.Annotation.AnnEqual',
@@ -345,7 +345,7 @@ type instance XXHsBindsLR (GhcPass pL) (GhcPass pR) = NoExtCon
-- | Abstraction Bindings Export
data ABExport p
- = ABE { abe_ext :: XABE p
+ = ABE { abe_ext :: !(XABE p)
, abe_poly :: IdP p -- ^ Any INLINE pragma is attached to this Id
, abe_mono :: IdP p
, abe_wrap :: HsWrapper -- ^ See Note [ABExport wrapper]
@@ -367,7 +367,7 @@ type instance XXABExport (GhcPass p) = NoExtCon
-- | Pattern Synonym binding
data PatSynBind idL idR
- = PSB { psb_ext :: XPSB idL idR, -- ^ Post renaming, FVs.
+ = PSB { psb_ext :: !(XPSB idL idR), -- ^ Post renaming, FVs.
-- See Note [Bind free vars]
psb_id :: LIdP idL, -- ^ Name of the pattern synonym
psb_args :: HsPatSynDetails idR, -- ^ Formal parameter names
@@ -798,7 +798,7 @@ pprTicks pp_no_debug pp_when_debug
-- | Haskell Implicit Parameter Bindings
data HsIPBinds id
= IPBinds
- (XIPBinds id)
+ !(XIPBinds id)
[LIPBind id]
-- TcEvBinds -- Only in typechecker output; binds
-- -- uses of the implicit parameters
@@ -837,7 +837,7 @@ type LIPBind id = XRec id (IPBind id)
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
data IPBind id
= IPBind
- (XCIPBind id)
+ !(XCIPBind id)
(Either (XRec id HsIPName) (IdP id))
(LHsExpr id)
| XIPBind !(XXIPBind id)
@@ -891,7 +891,7 @@ data Sig pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
TypeSig
- (XTypeSig pass)
+ !(XTypeSig pass)
[LIdP pass] -- LHS of the signature; e.g. f,g,h :: blah
(LHsSigWcType pass) -- RHS of the signature; can have wildcards
@@ -904,7 +904,7 @@ data Sig pass
-- 'GHC.Parser.Annotation.AnnDot','GHC.Parser.Annotation.AnnDarrow'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | PatSynSig (XPatSynSig pass) [LIdP pass] (LHsSigType pass)
+ | PatSynSig !(XPatSynSig pass) [LIdP pass] (LHsSigType pass)
-- P :: forall a b. Req => Prov => ty
-- | A signature for a class method
@@ -917,14 +917,14 @@ data Sig pass
--
-- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDefault',
-- 'GHC.Parser.Annotation.AnnDcolon'
- | ClassOpSig (XClassOpSig pass) Bool [LIdP pass] (LHsSigType pass)
+ | ClassOpSig !(XClassOpSig pass) Bool [LIdP pass] (LHsSigType pass)
-- | A type signature in generated code, notably the code
-- generated for record selectors. We simply record
-- the desired Id itself, replete with its name, type
-- and IdDetails. Otherwise it's just like a type
-- signature: there should be an accompanying binding
- | IdSig (XIdSig pass) Id
+ | IdSig !(XIdSig pass) Id
-- | An ordinary fixity declaration
--
@@ -935,7 +935,7 @@ data Sig pass
-- 'GHC.Parser.Annotation.AnnVal'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | FixSig (XFixSig pass) (FixitySig pass)
+ | FixSig !(XFixSig pass) (FixitySig pass)
-- | An inline pragma
--
@@ -948,7 +948,7 @@ data Sig pass
-- 'GHC.Parser.Annotation.AnnClose'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | InlineSig (XInlineSig pass)
+ | InlineSig !(XInlineSig pass)
(LIdP pass) -- Function name
InlinePragma -- Never defaultInlinePragma
@@ -964,7 +964,7 @@ data Sig pass
-- 'GHC.Parser.Annotation.AnnDcolon'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | SpecSig (XSpecSig pass)
+ | SpecSig !(XSpecSig pass)
(LIdP pass) -- Specialise a function or datatype ...
[LHsSigType pass] -- ... to these types
InlinePragma -- The pragma on SPECIALISE_INLINE form.
@@ -982,7 +982,7 @@ data Sig pass
-- 'GHC.Parser.Annotation.AnnInstance','GHC.Parser.Annotation.AnnClose'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | SpecInstSig (XSpecInstSig pass) SourceText (LHsSigType pass)
+ | SpecInstSig !(XSpecInstSig pass) SourceText (LHsSigType pass)
-- Note [Pragma source text] in GHC.Types.Basic
-- | A minimal complete definition pragma
@@ -994,7 +994,7 @@ data Sig pass
-- 'GHC.Parser.Annotation.AnnClose'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | MinimalSig (XMinimalSig pass)
+ | MinimalSig !(XMinimalSig pass)
SourceText (LBooleanFormula (LIdP pass))
-- Note [Pragma source text] in GHC.Types.Basic
@@ -1006,7 +1006,7 @@ data Sig pass
--
-- > {-# SCC funName "cost_centre_name" #-}
- | SCCFunSig (XSCCFunSig pass)
+ | SCCFunSig !(XSCCFunSig pass)
SourceText -- Note [Pragma source text] in GHC.Types.Basic
(LIdP pass) -- Function name
(Maybe (XRec pass StringLiteral))
@@ -1017,7 +1017,7 @@ data Sig pass
-- Used to inform the pattern match checker about additional
-- complete matchings which, for example, arise from pattern
-- synonym definitions.
- | CompleteMatchSig (XCompleteMatchSig pass)
+ | CompleteMatchSig !(XCompleteMatchSig pass)
SourceText
(XRec pass [LIdP pass])
(Maybe (LIdP pass))
@@ -1040,7 +1040,7 @@ type instance XXSig (GhcPass p) = NoExtCon
type LFixitySig pass = XRec pass (FixitySig pass)
-- | Fixity Signature
-data FixitySig pass = FixitySig (XFixitySig pass) [LIdP pass] Fixity
+data FixitySig pass = FixitySig !(XFixitySig pass) [LIdP pass] Fixity
| XFixitySig !(XXFixitySig pass)
type instance XFixitySig (GhcPass p) = NoExtField
=====================================
compiler/GHC/Hs/Decls.hs
=====================================
@@ -144,21 +144,21 @@ type LHsDecl p = XRec p (HsDecl p)
-- | A Haskell Declaration
data HsDecl p
- = TyClD (XTyClD p) (TyClDecl p) -- ^ Type or Class Declaration
- | InstD (XInstD p) (InstDecl p) -- ^ Instance declaration
- | DerivD (XDerivD p) (DerivDecl p) -- ^ Deriving declaration
- | ValD (XValD p) (HsBind p) -- ^ Value declaration
- | SigD (XSigD p) (Sig p) -- ^ Signature declaration
- | KindSigD (XKindSigD p) (StandaloneKindSig p) -- ^ Standalone kind signature
- | DefD (XDefD p) (DefaultDecl p) -- ^ 'default' declaration
- | ForD (XForD p) (ForeignDecl p) -- ^ Foreign declaration
- | WarningD (XWarningD p) (WarnDecls p) -- ^ Warning declaration
- | AnnD (XAnnD p) (AnnDecl p) -- ^ Annotation declaration
- | RuleD (XRuleD p) (RuleDecls p) -- ^ Rule declaration
- | SpliceD (XSpliceD p) (SpliceDecl p) -- ^ Splice declaration
- -- (Includes quasi-quotes)
- | DocD (XDocD p) (DocDecl) -- ^ Documentation comment declaration
- | RoleAnnotD (XRoleAnnotD p) (RoleAnnotDecl p) -- ^Role annotation declaration
+ = TyClD !(XTyClD p) (TyClDecl p) -- ^ Type or Class Declaration
+ | InstD !(XInstD p) (InstDecl p) -- ^ Instance declaration
+ | DerivD !(XDerivD p) (DerivDecl p) -- ^ Deriving declaration
+ | ValD !(XValD p) (HsBind p) -- ^ Value declaration
+ | SigD !(XSigD p) (Sig p) -- ^ Signature declaration
+ | KindSigD !(XKindSigD p) (StandaloneKindSig p) -- ^ Standalone kind signature
+ | DefD !(XDefD p) (DefaultDecl p) -- ^ 'default' declaration
+ | ForD !(XForD p) (ForeignDecl p) -- ^ Foreign declaration
+ | WarningD !(XWarningD p) (WarnDecls p) -- ^ Warning declaration
+ | AnnD !(XAnnD p) (AnnDecl p) -- ^ Annotation declaration
+ | RuleD !(XRuleD p) (RuleDecls p) -- ^ Rule declaration
+ | SpliceD !(XSpliceD p) (SpliceDecl p) -- ^ Splice declaration
+ -- !(Includes quasi-quotes)
+ | DocD !(XDocD p) (DocDecl) -- ^ Documentation comment declaration
+ | RoleAnnotD !(XRoleAnnotD p) (RoleAnnotDecl p) -- ^Role annotation declaration
| XHsDecl !(XXHsDecl p)
type instance XTyClD (GhcPass _) = NoExtField
@@ -259,7 +259,7 @@ partitionBindsAndSigs = go
-- fed to the renamer.
data HsGroup p
= HsGroup {
- hs_ext :: XCHsGroup p,
+ hs_ext :: !(XCHsGroup p),
hs_valds :: HsValBinds p,
hs_splcds :: [LSpliceDecl p],
@@ -417,7 +417,7 @@ type LSpliceDecl pass = XRec pass (SpliceDecl pass)
-- | Splice Declaration
data SpliceDecl p
= SpliceDecl -- Top level splice
- (XSpliceDecl p)
+ !(XSpliceDecl p)
(XRec p (HsSplice p))
SpliceExplicitFlag
| XSpliceDecl !(XXSpliceDecl p)
@@ -584,7 +584,7 @@ data TyClDecl pass
-- 'GHC.Parser.Annotation.AnnVbar'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- FamDecl { tcdFExt :: XFamDecl pass, tcdFam :: FamilyDecl pass }
+ FamDecl { tcdFExt :: !(XFamDecl pass), tcdFam :: FamilyDecl pass }
| -- | @type@ declaration
--
@@ -592,7 +592,7 @@ data TyClDecl pass
-- 'GHC.Parser.Annotation.AnnEqual',
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- SynDecl { tcdSExt :: XSynDecl pass -- ^ Post renameer, FVs
+ SynDecl { tcdSExt :: !(XSynDecl pass) -- ^ Post renameer, FVs
, tcdLName :: LIdP pass -- ^ Type constructor
, tcdTyVars :: LHsQTyVars pass -- ^ Type variables; for an
-- associated type these
@@ -609,14 +609,14 @@ data TyClDecl pass
-- 'GHC.Parser.Annotation.AnnWhere',
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- DataDecl { tcdDExt :: XDataDecl pass -- ^ Post renamer, CUSK flag, FVs
- , tcdLName :: LIdP pass -- ^ Type constructor
+ DataDecl { tcdDExt :: !(XDataDecl pass) -- ^ Post renamer, CUSK flag, FVs
+ , tcdLName :: LIdP pass -- ^ Type constructor
, tcdTyVars :: LHsQTyVars pass -- ^ Type variables
-- See Note [TyVar binders for associated declarations]
, tcdFixity :: LexicalFixity -- ^ Fixity used in the declaration
, tcdDataDefn :: HsDataDefn pass }
- | ClassDecl { tcdCExt :: XClassDecl pass, -- ^ Post renamer, FVs
+ | ClassDecl { tcdCExt :: !(XClassDecl pass), -- ^ Post renamer, FVs
tcdCtxt :: LHsContext pass, -- ^ Context...
tcdLName :: LIdP pass, -- ^ Name of the class
tcdTyVars :: LHsQTyVars pass, -- ^ Class type variables
@@ -1004,7 +1004,7 @@ in GHC.Rename.Module for more info.
-- | Type or Class Group
data TyClGroup pass -- See Note [TyClGroups and dependency analysis]
- = TyClGroup { group_ext :: XCTyClGroup pass
+ = TyClGroup { group_ext :: !(XCTyClGroup pass)
, group_tyclds :: [LTyClDecl pass]
, group_roles :: [LRoleAnnotDecl pass]
, group_kisigs :: [LStandaloneKindSig pass]
@@ -1102,19 +1102,19 @@ type LFamilyResultSig pass = XRec pass (FamilyResultSig pass)
-- | type Family Result Signature
data FamilyResultSig pass = -- see Note [FamilyResultSig]
- NoSig (XNoSig pass)
+ NoSig !(XNoSig pass)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' :
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | KindSig (XCKindSig pass) (LHsKind pass)
+ | KindSig !(XCKindSig pass) (LHsKind pass)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' :
-- 'GHC.Parser.Annotation.AnnOpenP','GHC.Parser.Annotation.AnnDcolon',
-- 'GHC.Parser.Annotation.AnnCloseP'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | TyVarSig (XTyVarSig pass) (LHsTyVarBndr () pass)
+ | TyVarSig !(XTyVarSig pass) (LHsTyVarBndr () pass)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' :
-- 'GHC.Parser.Annotation.AnnOpenP','GHC.Parser.Annotation.AnnDcolon',
-- 'GHC.Parser.Annotation.AnnCloseP', 'GHC.Parser.Annotation.AnnEqual'
@@ -1134,7 +1134,7 @@ type LFamilyDecl pass = XRec pass (FamilyDecl pass)
-- | type Family Declaration
data FamilyDecl pass = FamilyDecl
- { fdExt :: XCFamilyDecl pass
+ { fdExt :: !(XCFamilyDecl pass)
, fdInfo :: FamilyInfo pass -- type/data, closed/open
, fdLName :: LIdP pass -- type constructor
, fdTyVars :: LHsQTyVars pass -- type variables
@@ -1267,7 +1267,7 @@ data HsDataDefn pass -- The payload of a data type defn
-- data/newtype T a = <constrs>
-- data/newtype instance T [a] = <constrs>
-- @
- HsDataDefn { dd_ext :: XCHsDataDefn pass,
+ HsDataDefn { dd_ext :: !(XCHsDataDefn pass),
dd_ND :: NewOrData,
dd_ctxt :: LHsContext pass, -- ^ Context
dd_cType :: Maybe (XRec pass CType),
@@ -1318,7 +1318,7 @@ type LHsDerivingClause pass = XRec pass (HsDerivingClause pass)
data HsDerivingClause pass
-- See Note [Deriving strategies] in GHC.Tc.Deriv
= HsDerivingClause
- { deriv_clause_ext :: XCHsDerivingClause pass
+ { deriv_clause_ext :: !(XCHsDerivingClause pass)
, deriv_clause_strategy :: Maybe (LDerivStrategy pass)
-- ^ The user-specified strategy (if any) to use when deriving
-- 'deriv_clause_tys'.
@@ -1365,13 +1365,13 @@ data DerivClauseTys pass
-- be a type constructor without any arguments.
--
-- Example: @deriving Eq@
- DctSingle (XDctSingle pass) (LHsSigType pass)
+ DctSingle !(XDctSingle pass) (LHsSigType pass)
-- | A @deriving@ clause with a comma-separated list of types, surrounded
-- by enclosing parentheses.
--
-- Example: @deriving (Eq, C a)@
- | DctMulti (XDctMulti pass) [LHsSigType pass]
+ | DctMulti !(XDctMulti pass) [LHsSigType pass]
| XDerivClauseTys !(XXDerivClauseTys pass)
@@ -1387,7 +1387,7 @@ instance OutputableBndrId p => Outputable (DerivClauseTys (GhcPass p)) where
type LStandaloneKindSig pass = XRec pass (StandaloneKindSig pass)
data StandaloneKindSig pass
- = StandaloneKindSig (XStandaloneKindSig pass)
+ = StandaloneKindSig !(XStandaloneKindSig pass)
(LIdP pass) -- Why a single binder? See #16754
(LHsSigType pass) -- Why not LHsSigWcType? See Note [Wildcards in standalone kind signatures]
| XStandaloneKindSig !(XXStandaloneKindSig pass)
@@ -1458,7 +1458,7 @@ type LConDecl pass = XRec pass (ConDecl pass)
-- | data Constructor Declaration
data ConDecl pass
= ConDeclGADT
- { con_g_ext :: XConDeclGADT pass
+ { con_g_ext :: !(XConDeclGADT pass)
, con_names :: [LIdP pass]
-- The following fields describe the type after the '::'
@@ -1481,7 +1481,7 @@ data ConDecl pass
}
| ConDeclH98
- { con_ext :: XConDeclH98 pass
+ { con_ext :: !(XConDeclH98 pass)
, con_name :: LIdP pass
, con_forall :: XRec pass Bool
@@ -1872,7 +1872,7 @@ type FamInstEqn pass rhs = HsImplicitBndrs pass (FamEqn pass rhs)
-- See Note [Family instance declaration binders]
data FamEqn pass rhs
= FamEqn
- { feqn_ext :: XCFamEqn pass rhs
+ { feqn_ext :: !(XCFamEqn pass rhs)
, feqn_tycon :: LIdP pass
, feqn_bndrs :: Maybe [LHsTyVarBndr () pass] -- ^ Optional quantified type vars
, feqn_pats :: HsTyPats pass
@@ -1896,7 +1896,7 @@ type LClsInstDecl pass = XRec pass (ClsInstDecl pass)
-- | Class Instance Declaration
data ClsInstDecl pass
= ClsInstDecl
- { cid_ext :: XCClsInstDecl pass
+ { cid_ext :: !(XCClsInstDecl pass)
, cid_poly_ty :: LHsSigType pass -- Context => Class Instance-type
-- Using a polytype means that the renamer conveniently
-- figures out the quantified type variables for us.
@@ -1929,13 +1929,13 @@ type LInstDecl pass = XRec pass (InstDecl pass)
-- | Instance Declaration
data InstDecl pass -- Both class and family instances
= ClsInstD
- { cid_d_ext :: XClsInstD pass
+ { cid_d_ext :: !(XClsInstD pass)
, cid_inst :: ClsInstDecl pass }
| DataFamInstD -- data family instance
- { dfid_ext :: XDataFamInstD pass
+ { dfid_ext :: !(XDataFamInstD pass)
, dfid_inst :: DataFamInstDecl pass }
| TyFamInstD -- type family instance
- { tfid_ext :: XTyFamInstD pass
+ { tfid_ext :: !(XTyFamInstD pass)
, tfid_inst :: TyFamInstDecl pass }
| XInstDecl !(XXInstDecl pass)
@@ -2085,7 +2085,7 @@ type LDerivDecl pass = XRec pass (DerivDecl pass)
-- | Stand-alone 'deriving instance' declaration
data DerivDecl pass = DerivDecl
- { deriv_ext :: XCDerivDecl pass
+ { deriv_ext :: !(XCDerivDecl pass)
, deriv_type :: LHsSigWcType pass
-- ^ The instance type to derive.
--
@@ -2144,7 +2144,7 @@ data DerivStrategy pass
-- etc.)
| AnyclassStrategy -- ^ @-XDeriveAnyClass@
| NewtypeStrategy -- ^ @-XGeneralizedNewtypeDeriving@
- | ViaStrategy (XViaStrategy pass)
+ | ViaStrategy !(XViaStrategy pass)
-- ^ @-XDerivingVia@
type instance XViaStrategy GhcPs = LHsSigType GhcPs
@@ -2202,7 +2202,7 @@ type LDefaultDecl pass = XRec pass (DefaultDecl pass)
-- | Default Declaration
data DefaultDecl pass
- = DefaultDecl (XCDefaultDecl pass) [LHsType pass]
+ = DefaultDecl !(XCDefaultDecl pass) [LHsType pass]
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnDefault',
-- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose'
@@ -2237,13 +2237,13 @@ type LForeignDecl pass = XRec pass (ForeignDecl pass)
-- | Foreign Declaration
data ForeignDecl pass
= ForeignImport
- { fd_i_ext :: XForeignImport pass -- Post typechecker, rep_ty ~ sig_ty
+ { fd_i_ext :: !(XForeignImport pass) -- Post typechecker, rep_ty ~ sig_ty
, fd_name :: LIdP pass -- defines this name
, fd_sig_ty :: LHsSigType pass -- sig_ty
, fd_fi :: ForeignImport }
| ForeignExport
- { fd_e_ext :: XForeignExport pass -- Post typechecker, rep_ty ~ sig_ty
+ { fd_e_ext :: !(XForeignExport pass) -- Post typechecker, rep_ty ~ sig_ty
, fd_name :: LIdP pass -- uses this name
, fd_sig_ty :: LHsSigType pass -- sig_ty
, fd_fe :: ForeignExport }
@@ -2373,7 +2373,7 @@ type LRuleDecls pass = XRec pass (RuleDecls pass)
-- Note [Pragma source text] in GHC.Types.Basic
-- | Rule Declarations
-data RuleDecls pass = HsRules { rds_ext :: XCRuleDecls pass
+data RuleDecls pass = HsRules { rds_ext :: !(XCRuleDecls pass)
, rds_src :: SourceText
, rds_rules :: [LRuleDecl pass] }
| XRuleDecls !(XXRuleDecls pass)
@@ -2387,7 +2387,7 @@ type LRuleDecl pass = XRec pass (RuleDecl pass)
-- | Rule Declaration
data RuleDecl pass
= HsRule -- Source rule
- { rd_ext :: XHsRule pass
+ { rd_ext :: !(XHsRule pass)
-- ^ After renamer, free-vars from the LHS and RHS
, rd_name :: XRec pass (SourceText,RuleName)
-- ^ Note [Pragma source text] in "GHC.Types.Basic"
@@ -2426,8 +2426,8 @@ type LRuleBndr pass = XRec pass (RuleBndr pass)
-- | Rule Binder
data RuleBndr pass
- = RuleBndr (XCRuleBndr pass) (LIdP pass)
- | RuleBndrSig (XRuleBndrSig pass) (LIdP pass) (HsPatSigType pass)
+ = RuleBndr !(XCRuleBndr pass) (LIdP pass)
+ | RuleBndrSig !(XRuleBndrSig pass) (LIdP pass) (HsPatSigType pass)
| XRuleBndr !(XXRuleBndr pass)
-- ^
-- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen',
@@ -2516,7 +2516,7 @@ type LWarnDecls pass = XRec pass (WarnDecls pass)
-- Note [Pragma source text] in GHC.Types.Basic
-- | Warning pragma Declarations
-data WarnDecls pass = Warnings { wd_ext :: XWarnings pass
+data WarnDecls pass = Warnings { wd_ext :: !(XWarnings pass)
, wd_src :: SourceText
, wd_warnings :: [LWarnDecl pass]
}
@@ -2529,7 +2529,7 @@ type instance XXWarnDecls (GhcPass _) = NoExtCon
type LWarnDecl pass = XRec pass (WarnDecl pass)
-- | Warning pragma Declaration
-data WarnDecl pass = Warning (XWarning pass) [LIdP pass] WarningTxt
+data WarnDecl pass = Warning !(XWarning pass) [LIdP pass] WarningTxt
| XWarnDecl !(XXWarnDecl pass)
type instance XWarning (GhcPass _) = NoExtField
@@ -2561,7 +2561,7 @@ type LAnnDecl pass = XRec pass (AnnDecl pass)
-- | Annotation Declaration
data AnnDecl pass = HsAnnotation
- (XHsAnnotation pass)
+ !(XHsAnnotation pass)
SourceText -- Note [Pragma source text] in GHC.Types.Basic
(AnnProvenance (IdP pass)) (XRec pass (HsExpr pass))
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen',
@@ -2615,7 +2615,7 @@ type LRoleAnnotDecl pass = XRec pass (RoleAnnotDecl pass)
-- top-level declarations
-- | Role Annotation Declaration
data RoleAnnotDecl pass
- = RoleAnnotDecl (XCRoleAnnotDecl pass)
+ = RoleAnnotDecl !(XCRoleAnnotDecl pass)
(LIdP pass) -- type constructor
[XRec pass (Maybe Role)] -- optional annotations
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnType',
=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -242,11 +242,11 @@ is Less Cool because
-- | A Haskell expression.
data HsExpr p
- = HsVar (XVar p)
+ = HsVar !(XVar p)
(LIdP p) -- ^ Variable
-- See Note [Located RdrNames]
- | HsUnboundVar (XUnboundVar p)
+ | HsUnboundVar !(XUnboundVar p)
OccName -- ^ Unbound variable; also used for "holes"
-- (_ or _x).
-- Turned from HsVar to HsUnboundVar by the
@@ -255,32 +255,32 @@ data HsExpr p
-- The (XUnboundVar p) field becomes Id
-- after typechecking
- | HsConLikeOut (XConLikeOut p)
+ | HsConLikeOut !(XConLikeOut p)
ConLike -- ^ After typechecker only; must be different
-- HsVar for pretty printing
- | HsRecFld (XRecFld p)
+ | HsRecFld !(XRecFld p)
(AmbiguousFieldOcc p) -- ^ Variable pointing to record selector
-- The parser produces HsVars
-- The renamer renames record-field selectors to HsRecFld
-- The typechecker preserves HsRecFld
- | HsOverLabel (XOverLabel p)
+ | HsOverLabel !(XOverLabel p)
(Maybe (IdP p)) FastString
-- ^ Overloaded label (Note [Overloaded labels] in GHC.OverloadedLabels)
-- @Just id@ means @RebindableSyntax@ is in use, and gives the id of the
-- in-scope 'fromLabel'.
-- NB: Not in use after typechecking
- | HsIPVar (XIPVar p)
+ | HsIPVar !(XIPVar p)
HsIPName -- ^ Implicit parameter (not in use after typechecking)
- | HsOverLit (XOverLitE p)
+ | HsOverLit !(XOverLitE p)
(HsOverLit p) -- ^ Overloaded literals
- | HsLit (XLitE p)
+ | HsLit !(XLitE p)
(HsLit p) -- ^ Simple (non-overloaded) literals
- | HsLam (XLam p)
+ | HsLam !(XLam p)
(MatchGroup p (LHsExpr p))
-- ^ Lambda abstraction. Currently always a single match
--
@@ -289,7 +289,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsLamCase (XLamCase p) (MatchGroup p (LHsExpr p)) -- ^ Lambda-case
+ | HsLamCase !(XLamCase p) (MatchGroup p (LHsExpr p)) -- ^ Lambda-case
--
-- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLam',
-- 'GHC.Parser.Annotation.AnnCase','GHC.Parser.Annotation.AnnOpen',
@@ -297,9 +297,9 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsApp (XApp p) (LHsExpr p) (LHsExpr p) -- ^ Application
+ | HsApp !(XApp p) (LHsExpr p) (LHsExpr p) -- ^ Application
- | HsAppType (XAppTypeE p) -- After typechecking: the type argument
+ | HsAppType !(XAppTypeE p) -- After typechecking: the type argument
(LHsExpr p)
(LHsWcType (NoGhcTc p)) -- ^ Visible type application
--
@@ -314,7 +314,7 @@ data HsExpr p
-- NB We need an expr for the operator in an OpApp/Section since
-- the typechecker may need to apply the operator to a few types.
- | OpApp (XOpApp p)
+ | OpApp !(XOpApp p)
(LHsExpr p) -- left operand
(LHsExpr p) -- operator
(LHsExpr p) -- right operand
@@ -325,7 +325,7 @@ data HsExpr p
-- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnMinus'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | NegApp (XNegApp p)
+ | NegApp !(XNegApp p)
(LHsExpr p)
(SyntaxExpr p)
@@ -333,13 +333,13 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose' @')'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsPar (XPar p)
+ | HsPar !(XPar p)
(LHsExpr p) -- ^ Parenthesised expr; see Note [Parens in HsSyn]
- | SectionL (XSectionL p)
+ | SectionL !(XSectionL p)
(LHsExpr p) -- operand; see Note [Sections in HsSyn]
(LHsExpr p) -- operator
- | SectionR (XSectionR p)
+ | SectionR !(XSectionR p)
(LHsExpr p) -- operator; see Note [Sections in HsSyn]
(LHsExpr p) -- operand
@@ -351,7 +351,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
-- Note [ExplicitTuple]
| ExplicitTuple
- (XExplicitTuple p)
+ !(XExplicitTuple p)
[LHsTupArg p]
Boxity
@@ -363,7 +363,7 @@ data HsExpr p
-- There will be multiple 'GHC.Parser.Annotation.AnnVbar', (1 - alternative) before
-- the expression, (arity - alternative) after it
| ExplicitSum
- (XExplicitSum p)
+ !(XExplicitSum p)
ConTag -- Alternative (one-based)
Arity -- Sum arity
(LHsExpr p)
@@ -373,7 +373,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose' @'}'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCase (XCase p)
+ | HsCase !(XCase p)
(LHsExpr p)
(MatchGroup p (LHsExpr p))
@@ -383,7 +383,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnElse',
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsIf (XIf p) -- GhcPs: this is a Bool; False <=> do not use
+ | HsIf !(XIf p) -- GhcPs: this is a Bool; False <=> do not use
-- rebindable syntax
(LHsExpr p) -- predicate
(LHsExpr p) -- then part
@@ -395,7 +395,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose',
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsMultiIf (XMultiIf p) [LGRHS p (LHsExpr p)]
+ | HsMultiIf !(XMultiIf p) [LGRHS p (LHsExpr p)]
-- | let(rec)
--
@@ -404,7 +404,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose' @'}'@,'GHC.Parser.Annotation.AnnIn'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsLet (XLet p)
+ | HsLet !(XLet p)
(LHsLocalBinds p)
(LHsExpr p)
@@ -414,7 +414,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsDo (XDo p) -- Type of the whole expression
+ | HsDo !(XDo p) -- Type of the whole expression
(HsStmtContext GhcRn) -- The parameterisation is unimportant
-- because in this context we never use
-- the PatGuard or ParStmt variant
@@ -428,7 +428,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
-- See Note [Empty lists]
| ExplicitList
- (XExplicitList p) -- Gives type of components of list
+ !(XExplicitList p) -- Gives type of components of list
(Maybe (SyntaxExpr p))
-- For OverloadedLists, the fromListN witness
[LHsExpr p]
@@ -440,7 +440,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| RecordCon
- { rcon_ext :: XRecordCon p
+ { rcon_ext :: !(XRecordCon p)
, rcon_con_name :: LIdP p -- The constructor name;
-- not used after type checking
, rcon_flds :: HsRecordBinds p } -- The fields
@@ -452,7 +452,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| RecordUpd
- { rupd_ext :: XRecordUpd p
+ { rupd_ext :: !(XRecordUpd p)
, rupd_expr :: LHsExpr p
, rupd_flds :: [LHsRecUpdField p]
}
@@ -465,7 +465,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| ExprWithTySig
- (XExprWithTySig p)
+ !(XExprWithTySig p)
(LHsExpr p)
(LHsSigWcType (NoGhcTc p))
@@ -478,7 +478,7 @@ data HsExpr p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| ArithSeq
- (XArithSeq p)
+ !(XArithSeq p)
(Maybe (SyntaxExpr p))
-- For OverloadedLists, the fromList witness
(ArithSeqInfo p)
@@ -493,17 +493,17 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose','GHC.Parser.Annotation.AnnCloseQ'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsBracket (XBracket p) (HsBracket p)
+ | HsBracket !(XBracket p) (HsBracket p)
-- See Note [Pending Splices]
| HsRnBracketOut
- (XRnBracketOut p)
+ !(XRnBracketOut p)
(HsBracket GhcRn) -- Output of the renamer is the *original* renamed
-- expression, plus
[PendingRnSplice] -- _renamed_ splices to be type checked
| HsTcBracketOut
- (XTcBracketOut p)
+ !(XTcBracketOut p)
(Maybe QuoteWrapper) -- The wrapper to apply type and dictionary argument
-- to the quote.
(HsBracket GhcRn) -- Output of the type checker is the *original*
@@ -515,7 +515,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsSpliceE (XSpliceE p) (HsSplice p)
+ | HsSpliceE !(XSpliceE p) (HsSplice p)
-----------------------------------------------------------
-- Arrow notation extension
@@ -526,7 +526,7 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnRarrow'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsProc (XProc p)
+ | HsProc !(XProc p)
(LPat p) -- arrow abstraction, proc
(LHsCmdTop p) -- body of the abstraction
-- always has an empty stack
@@ -536,26 +536,26 @@ data HsExpr p
-- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnStatic',
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsStatic (XStatic p) -- Free variables of the body
+ | HsStatic !(XStatic p) -- Free variables of the body
(LHsExpr p) -- Body
---------------------------------------
-- Haskell program coverage (Hpc) Support
| HsTick
- (XTick p)
+ !(XTick p)
(Tickish (IdP p))
(LHsExpr p) -- sub-expression
| HsBinTick
- (XBinTick p)
+ !(XBinTick p)
Int -- module-local tick number for True
Int -- module-local tick number for False
(LHsExpr p) -- sub-expression
---------------------------------------
-- Expressions annotated with pragmas, written as {-# ... #-}
- | HsPragE (XPragE p) (HsPragE p) (LHsExpr p)
+ | HsPragE !(XPragE p) (HsPragE p) (LHsExpr p)
| XExpr !(XXExpr p)
-- Note [Trees that Grow] extension constructor for the
@@ -831,7 +831,7 @@ instance (Outputable a, Outputable b) => Outputable (HsExpansion a b) where
-- | A pragma, written as {-# ... #-}, that may appear within an expression.
data HsPragE p
- = HsPragSCC (XSCC p)
+ = HsPragSCC !(XSCC p)
SourceText -- Note [Pragma source text] in GHC.Types.Basic
StringLiteral -- "set cost centre" SCC pragma
@@ -847,7 +847,6 @@ data HsPragE p
| XHsPragE !(XXPragE p)
type instance XSCC (GhcPass _) = NoExtField
-type instance XCoreAnn (GhcPass _) = NoExtField
type instance XXPragE (GhcPass _) = NoExtCon
-- | Located Haskell Tuple Argument
@@ -863,8 +862,8 @@ type LHsTupArg id = XRec id (HsTupArg id)
-- | Haskell Tuple Argument
data HsTupArg id
- = Present (XPresent id) (LHsExpr id) -- ^ The argument
- | Missing (XMissing id) -- ^ The argument is missing, but this is its type
+ = Present !(XPresent id) (LHsExpr id) -- ^ The argument
+ | Missing !(XMissing id) -- ^ The argument is missing, but this is its type
| XTupArg !(XXTupArg id) -- ^ Note [Trees that Grow] extension point
type instance XPresent (GhcPass _) = NoExtField
@@ -1419,9 +1418,9 @@ data HsCmd id
-- 'GHC.Parser.Annotation.AnnRarrowtail'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- = HsCmdArrApp -- Arrow tail, or arrow application (f -< arg)
- (XCmdArrApp id) -- type of the arrow expressions f,
- -- of the form a t t', where arg :: t
+ = HsCmdArrApp -- Arrow tail, or arrow application (f -< arg)
+ !(XCmdArrApp id) -- type of the arrow expressions f,
+ -- of the form a t t', where arg :: t
(LHsExpr id) -- arrow expression, f
(LHsExpr id) -- input expression, arg
HsArrAppType -- higher-order (-<<) or first-order (-<)
@@ -1433,7 +1432,7 @@ data HsCmd id
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| HsCmdArrForm -- Command formation, (| e cmd1 .. cmdn |)
- (XCmdArrForm id)
+ !(XCmdArrForm id)
(LHsExpr id) -- The operator.
-- After type-checking, a type abstraction to be
-- applied to the type of the local environment tuple
@@ -1443,25 +1442,25 @@ data HsCmd id
-- were converted from OpApp's by the renamer
[LHsCmdTop id] -- argument commands
- | HsCmdApp (XCmdApp id)
+ | HsCmdApp !(XCmdApp id)
(LHsCmd id)
(LHsExpr id)
- | HsCmdLam (XCmdLam id)
+ | HsCmdLam !(XCmdLam id)
(MatchGroup id (LHsCmd id)) -- kappa
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLam',
-- 'GHC.Parser.Annotation.AnnRarrow',
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCmdPar (XCmdPar id)
+ | HsCmdPar !(XCmdPar id)
(LHsCmd id) -- parenthesised command
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@,
-- 'GHC.Parser.Annotation.AnnClose' @')'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCmdCase (XCmdCase id)
+ | HsCmdCase !(XCmdCase id)
(LHsExpr id)
(MatchGroup id (LHsCmd id)) -- bodies are HsCmd's
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnCase',
@@ -1470,7 +1469,7 @@ data HsCmd id
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCmdLamCase (XCmdLamCase id)
+ | HsCmdLamCase !(XCmdLamCase id)
(MatchGroup id (LHsCmd id)) -- bodies are HsCmd's
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLam',
-- 'GHC.Parser.Annotation.AnnCase','GHC.Parser.Annotation.AnnOpen' @'{'@,
@@ -1478,7 +1477,7 @@ data HsCmd id
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCmdIf (XCmdIf id)
+ | HsCmdIf !(XCmdIf id)
(SyntaxExpr id) -- cond function
(LHsExpr id) -- predicate
(LHsCmd id) -- then part
@@ -1490,7 +1489,7 @@ data HsCmd id
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCmdLet (XCmdLet id)
+ | HsCmdLet !(XCmdLet id)
(LHsLocalBinds id) -- let(rec)
(LHsCmd id)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLet',
@@ -1499,7 +1498,7 @@ data HsCmd id
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsCmdDo (XCmdDo id) -- Type of the whole expression
+ | HsCmdDo !(XCmdDo id) -- Type of the whole expression
(XRec id [CmdLStmt id])
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDo',
-- 'GHC.Parser.Annotation.AnnOpen', 'GHC.Parser.Annotation.AnnSemi',
@@ -1551,7 +1550,7 @@ type LHsCmdTop p = XRec p (HsCmdTop p)
-- | Haskell Top-level Command
data HsCmdTop p
- = HsCmdTop (XCmdTop p)
+ = HsCmdTop !(XCmdTop p)
(LHsCmd p)
| XCmdTop !(XXCmdTop p) -- Note [Trees that Grow] extension point
@@ -1702,7 +1701,7 @@ patterns in each equation.
-}
data MatchGroup p body
- = MG { mg_ext :: XMG p body -- Post-typechecker, types of args and result
+ = MG { mg_ext :: !(XMG p body) -- Post-typechecker, types of args and result
, mg_alts :: XRec p [LMatch p body] -- The alternatives
, mg_origin :: Origin }
-- The type is the type of the entire group
@@ -1730,7 +1729,7 @@ type LMatch id body = XRec id (Match id body)
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
data Match p body
= Match {
- m_ext :: XCMatch p body,
+ m_ext :: !(XCMatch p body),
m_ctxt :: HsMatchContext (NoGhcTc p),
-- See note [m_ctxt in Match]
m_pats :: [LPat p], -- The patterns
@@ -1821,7 +1820,7 @@ hsLMatchPats (L _ (Match { m_pats = pats })) = pats
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
data GRHSs p body
= GRHSs {
- grhssExt :: XCGRHSs p body,
+ grhssExt :: !(XCGRHSs p body),
grhssGRHSs :: [LGRHS p body], -- ^ Guarded RHSs
grhssLocalBinds :: LHsLocalBinds p -- ^ The where clause
}
@@ -1834,7 +1833,7 @@ type instance XXGRHSs (GhcPass _) b = NoExtCon
type LGRHS id body = XRec id (GRHS id body)
-- | Guarded Right Hand Side.
-data GRHS p body = GRHS (XCGRHS p body)
+data GRHS p body = GRHS !(XCGRHS p body)
[GuardLStmt p] -- Guards
body -- Right hand side
| XGRHS !(XXGRHS p body)
@@ -1973,7 +1972,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
= LastStmt -- Always the last Stmt in ListComp, MonadComp,
-- and (after the renamer, see GHC.Rename.Expr.checkLastStmt) DoExpr, MDoExpr
-- Not used for GhciStmtCtxt, PatGuard, which scope over other stuff
- (XLastStmt idL idR body)
+ !(XLastStmt idL idR body)
body
(Maybe Bool) -- Whether return was stripped
-- Just True <=> return with a dollar was stripped by ApplicativeDo
@@ -1987,7 +1986,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
-- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLarrow'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | BindStmt (XBindStmt idL idR body)
+ | BindStmt !(XBindStmt idL idR body)
-- ^ Post renaming has optional fail and bind / (>>=) operator.
-- Post typechecking, also has multiplicity of the argument
-- and the result type of the function passed to bind;
@@ -2004,14 +2003,14 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
-- For full details, see Note [ApplicativeDo] in "GHC.Rename.Expr"
--
| ApplicativeStmt
- (XApplicativeStmt idL idR body) -- Post typecheck, Type of the body
+ !(XApplicativeStmt idL idR body) -- Post typecheck, Type of the body
[ ( SyntaxExpr idR
, ApplicativeArg idL) ]
-- [(<$>, e1), (<*>, e2), ..., (<*>, en)]
(Maybe (SyntaxExpr idR)) -- 'join', if necessary
- | BodyStmt (XBodyStmt idL idR body) -- Post typecheck, element type
- -- of the RHS (used for arrows)
+ | BodyStmt !(XBodyStmt idL idR body) -- Post typecheck, element type
+ -- of the RHS (used for arrows)
body -- See Note [BodyStmt]
(SyntaxExpr idR) -- The (>>) operator
(SyntaxExpr idR) -- The `guard` operator; used only in MonadComp
@@ -2021,11 +2020,11 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
-- 'GHC.Parser.Annotation.AnnOpen' @'{'@,'GHC.Parser.Annotation.AnnClose' @'}'@,
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | LetStmt (XLetStmt idL idR body) (LHsLocalBindsLR idL idR)
+ | LetStmt !(XLetStmt idL idR body) (LHsLocalBindsLR idL idR)
-- ParStmts only occur in a list/monad comprehension
- | ParStmt (XParStmt idL idR body) -- Post typecheck,
- -- S in (>>=) :: Q -> (R -> S) -> T
+ | ParStmt !(XParStmt idL idR body) -- Post typecheck,
+ -- S in (>>=) :: Q -> (R -> S) -> T
[ParStmtBlock idL idR]
(HsExpr idR) -- Polymorphic `mzip` for monad comprehensions
(SyntaxExpr idR) -- The `>>=` operator
@@ -2034,8 +2033,8 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
-- bound by the stmts and used after themp
| TransStmt {
- trS_ext :: XTransStmt idL idR body, -- Post typecheck,
- -- R in (>>=) :: Q -> (R -> S) -> T
+ trS_ext :: !(XTransStmt idL idR body), -- Post typecheck,
+ -- R in (>>=) :: Q -> (R -> S) -> T
trS_form :: TransForm,
trS_stmts :: [ExprLStmt idL], -- Stmts to the *left* of the 'group'
-- which generates the tuples to be grouped
@@ -2060,7 +2059,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| RecStmt
- { recS_ext :: XRecStmt idL idR body
+ { recS_ext :: !(XRecStmt idL idR body)
, recS_stmts :: [LStmtLR idL idR body]
-- The next two fields are only valid after renaming
@@ -2154,7 +2153,7 @@ data TransForm -- The 'f' below is the 'using' function, 'e' is the by functio
-- | Parenthesised Statement Block
data ParStmtBlock idL idR
= ParStmtBlock
- (XParStmtBlock idL idR)
+ !(XParStmtBlock idL idR)
[ExprLStmt idL]
[IdP idR] -- The variables to be returned
(SyntaxExpr idR) -- The return operator
@@ -2182,7 +2181,7 @@ type FailOperator id = Maybe (SyntaxExpr id)
-- | Applicative Argument
data ApplicativeArg idL
= ApplicativeArgOne -- A single statement (BindStmt or BodyStmt)
- { xarg_app_arg_one :: XApplicativeArgOne idL
+ { xarg_app_arg_one :: !(XApplicativeArgOne idL)
-- ^ The fail operator, after renaming
--
-- The fail operator is needed if this is a BindStmt
@@ -2201,7 +2200,7 @@ data ApplicativeArg idL
-- See Note [Applicative BodyStmt]
}
| ApplicativeArgMany -- do { stmts; return vars }
- { xarg_app_arg_many :: XApplicativeArgMany idL
+ { xarg_app_arg_many :: !(XApplicativeArgMany idL)
, app_stmts :: [ExprLStmt idL] -- stmts
, final_expr :: HsExpr idL -- return (v1,..,vn), or just (v1,..,vn)
, bv_pattern :: LPat idL -- (v1,...,vn)
@@ -2549,19 +2548,19 @@ pprQuals quals = interpp'SP quals
-- | Haskell Splice
data HsSplice id
= HsTypedSplice -- $$z or $$(f 4)
- (XTypedSplice id)
+ !(XTypedSplice id)
SpliceDecoration -- Whether $$( ) variant found, for pretty printing
(IdP id) -- A unique name to identify this splice point
(LHsExpr id) -- See Note [Pending Splices]
| HsUntypedSplice -- $z or $(f 4)
- (XUntypedSplice id)
+ !(XUntypedSplice id)
SpliceDecoration -- Whether $( ) variant found, for pretty printing
(IdP id) -- A unique name to identify this splice point
(LHsExpr id) -- See Note [Pending Splices]
| HsQuasiQuote -- See Note [Quasi-quote overview] in GHC.Tc.Gen.Splice
- (XQuasiQuote id)
+ !(XQuasiQuote id)
(IdP id) -- Splice point
(IdP id) -- Quoter
SrcSpan -- The span of the enclosed string
@@ -2573,7 +2572,7 @@ data HsSplice id
-- This is the result of splicing a splice. It is produced by
-- the renamer and consumed by the typechecker. It lives only
-- between the two.
- (XSpliced id)
+ !(XSpliced id)
ThModFinalizers -- TH finalizers produced by the splice.
(HsSplicedThing id) -- The result of splicing
| XSplice !(XXSplice id) -- Note [Trees that Grow] extension point
@@ -2779,14 +2778,14 @@ ppr_splice herald n e trail
-- | Haskell Bracket
data HsBracket p
- = ExpBr (XExpBr p) (LHsExpr p) -- [| expr |]
- | PatBr (XPatBr p) (LPat p) -- [p| pat |]
- | DecBrL (XDecBrL p) [LHsDecl p] -- [d| decls |]; result of parser
- | DecBrG (XDecBrG p) (HsGroup p) -- [d| decls |]; result of renamer
- | TypBr (XTypBr p) (LHsType p) -- [t| type |]
- | VarBr (XVarBr p) Bool (IdP p) -- True: 'x, False: ''T
+ = ExpBr !(XExpBr p) (LHsExpr p) -- [| expr |]
+ | PatBr !(XPatBr p) (LPat p) -- [p| pat |]
+ | DecBrL !(XDecBrL p) [LHsDecl p] -- [d| decls |]; result of parser
+ | DecBrG !(XDecBrG p) (HsGroup p) -- [d| decls |]; result of renamer
+ | TypBr !(XTypBr p) (LHsType p) -- [t| type |]
+ | VarBr !(XVarBr p) Bool (IdP p) -- True: 'x, False: ''T
-- (The Bool flag is used only in pprHsBracket)
- | TExpBr (XTExpBr p) (LHsExpr p) -- [|| expr ||]
+ | TExpBr !(XTExpBr p) (LHsExpr p) -- [|| expr ||]
| XBracket !(XXBracket p) -- Note [Trees that Grow] extension point
type instance XExpBr (GhcPass _) = NoExtField
=====================================
compiler/GHC/Hs/Extension.hs
=====================================
@@ -156,7 +156,7 @@ noExtField = NoExtField
-- This should not be confused with 'NoExtField', which are found in unused
-- extension /points/ (not /constructors/) and therefore can be inhabited.
--- See also [NoExtCon and strict fields].
+-- See also [TTG and strict fields].
data NoExtCon
deriving (Data,Eq,Ord)
@@ -223,20 +223,30 @@ instance WrapXRec (GhcPass p) where
wrapXRec = noLoc
{-
-Note [NoExtCon and strict fields]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Currently, any unused TTG extension constructor will generally look like the
-following:
+Note [TTG and strict fields]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The TTG extension points are all strict, note the !-annotations:
- type instance XXHsDecl (GhcPass _) = NoExtCon
data HsDecl p
= ...
+ | ValD !(XValD p) (HsBind p) -- ^ Value declaration
+ | SigD !(XSigD p) (Sig p) -- ^ Signature declaration
+ | ...
| XHsDecl !(XXHsDecl p)
-The field of type `XXHsDecl p` is strict for a good reason: it allows the
-pattern-match coverage checker to conclude that any matches against XHsDecl
-are unreachable whenever `p ~ GhcPass _`. To see why this is the case, consider
-the following function which consumes an HsDecl:
+This allows us to selectively exclude constructors from pattern matches. One
+can pick an arbitrary subset of constructors that are possible/impossible in a
+particular pass.
+
+For example, GHC does not currently make use of XHsDecl, so it defines the
+following instance:
+
+ type instance XXHsDecl (GhcPass _) = NoExtCon
+
+NoExtCon is an uninhabited data type (just like Void). Since the field of type
+`XXHsDecl p` is strict, the pattern-match coverage checker concludes that any
+matches against XHsDecl are unreachable whenever `p ~ GhcPass _`. To see why
+this is the case, consider the following function which consumes an HsDecl:
ex :: HsDecl GhcPs -> HsDecl GhcRn
...
@@ -250,8 +260,14 @@ inaccessible, so it can be removed.
(See Note [Strict argument type constraints] in GHC.HsToCore.Pmc.Solver for
more on how this works.)
-Bottom line: if you add a TTG extension constructor that uses NoExtCon, make
-sure that any uses of it as a field are strict.
+It is easy to recover laziness, if needed, by using a wrapper, at the cost of a
+pointer indirection:
+
+ data Box a = Box a
+ type instance XHsSyn MyPass = Box MyData -- The MyData field is non-strict
+
+Bottom line: if you add a TTG extension type family, make sure that any uses of
+it as a field are strict.
-}
-- | Used as a data type index for the hsSyn AST; also serves
@@ -331,11 +347,11 @@ type family XHsIPBinds x x'
type family XEmptyLocalBinds x x'
type family XXHsLocalBindsLR x x'
--- ValBindsLR type families
+-- HsValBindsLR type families
type family XValBinds x x'
type family XXValBindsLR x x'
--- HsBindsLR type families
+-- HsBindLR type families
type family XFunBind x x'
type family XPatBind x x'
type family XVarBind x x'
@@ -469,7 +485,7 @@ type family XCClsInstDecl x
type family XXClsInstDecl x
-- -------------------------------------
--- ClsInstDecl type families
+-- InstDecl type families
type family XClsInstD x
type family XDataFamInstD x
type family XTyFamInstD x
@@ -490,7 +506,7 @@ type family XCDefaultDecl x
type family XXDefaultDecl x
-- -------------------------------------
--- DefaultDecl type families
+-- ForeignDecl type families
type family XForeignImport x
type family XForeignExport x
type family XXForeignDecl x
@@ -517,7 +533,7 @@ type family XWarnings x
type family XXWarnDecls x
-- -------------------------------------
--- AnnDecl type families
+-- WarnDecl type families
type family XWarning x
type family XXWarnDecl x
@@ -574,32 +590,34 @@ type family XBinTick x
type family XPragE x
type family XXExpr x
+-- -------------------------------------
+-- HsPragE type families
type family XSCC x
-type family XCoreAnn x
-type family XTickPragma x
type family XXPragE x
--- ---------------------------------------------------------------------
+
+-- -------------------------------------
+-- AmbiguousFieldOcc type families
type family XUnambiguous x
type family XAmbiguous x
type family XXAmbiguousFieldOcc x
--- ----------------------------------------------------------------------
-
+-- -------------------------------------
+-- HsTupArg type families
type family XPresent x
type family XMissing x
type family XXTupArg x
--- ---------------------------------------------------------------------
-
+-- -------------------------------------
+-- HsSplice type families
type family XTypedSplice x
type family XUntypedSplice x
type family XQuasiQuote x
type family XSpliced x
type family XXSplice x
--- ---------------------------------------------------------------------
-
+-- -------------------------------------
+-- HsBracket type families
type family XExpBr x
type family XPatBr x
type family XDecBrL x
@@ -609,33 +627,33 @@ type family XVarBr x
type family XTExpBr x
type family XXBracket x
--- ---------------------------------------------------------------------
-
+-- -------------------------------------
+-- HsCmdTop type families
type family XCmdTop x
type family XXCmdTop x
-- -------------------------------------
-
+-- MatchGroup type families
type family XMG x b
type family XXMatchGroup x b
-- -------------------------------------
-
+-- Match type families
type family XCMatch x b
type family XXMatch x b
-- -------------------------------------
-
+-- GRHSs type families
type family XCGRHSs x b
type family XXGRHSs x b
-- -------------------------------------
-
+-- GRHS type families
type family XCGRHS x b
type family XXGRHS x b
-- -------------------------------------
-
+-- StmtLR type families
type family XLastStmt x x' b
type family XBindStmt x x' b
type family XApplicativeStmt x x' b
@@ -646,8 +664,8 @@ type family XTransStmt x x' b
type family XRecStmt x x' b
type family XXStmtLR x x' b
--- ---------------------------------------------------------------------
-
+-- -------------------------------------
+-- HsCmd type families
type family XCmdArrApp x
type family XCmdArrForm x
type family XCmdApp x
@@ -661,13 +679,13 @@ type family XCmdDo x
type family XCmdWrap x
type family XXCmd x
--- ---------------------------------------------------------------------
-
+-- -------------------------------------
+-- ParStmtBlock type families
type family XParStmtBlock x x'
type family XXParStmtBlock x x'
--- ---------------------------------------------------------------------
-
+-- -------------------------------------
+-- ApplicativeArg type families
type family XApplicativeArgOne x
type family XApplicativeArgMany x
type family XXApplicativeArg x
@@ -697,6 +715,8 @@ type family XHsFloatPrim x
type family XHsDoublePrim x
type family XXLit x
+-- -------------------------------------
+-- HsOverLit type families
type family XOverLit x
type family XXOverLit x
@@ -725,26 +745,29 @@ type family XXPat x
-- =====================================================================
-- Type families for the HsTypes type families
+
+-- -------------------------------------
+-- LHsQTyVars type families
type family XHsQTvs x
type family XXLHsQTyVars x
-- -------------------------------------
-
+-- HsImplicitBndrs type families
type family XHsIB x b
type family XXHsImplicitBndrs x b
-- -------------------------------------
-
+-- HsWildCardBndrs type families
type family XHsWC x b
type family XXHsWildCardBndrs x b
-- -------------------------------------
-
+-- HsPatSigType type families
type family XHsPS x
type family XXHsPatSigType x
-- -------------------------------------
-
+-- HsType type families
type family XForAllTy x
type family XQualTy x
type family XTyVar x
@@ -770,35 +793,37 @@ type family XWildCardTy x
type family XXType x
-- ---------------------------------------------------------------------
-
+-- HsForAllTelescope type families
type family XHsForAllVis x
type family XHsForAllInvis x
type family XXHsForAllTelescope x
-- ---------------------------------------------------------------------
-
+-- HsTyVarBndr type families
type family XUserTyVar x
type family XKindedTyVar x
type family XXTyVarBndr x
-- ---------------------------------------------------------------------
-
+-- ConDeclField type families
type family XConDeclField x
type family XXConDeclField x
-- ---------------------------------------------------------------------
-
+-- FieldOcc type families
type family XCFieldOcc x
type family XXFieldOcc x
-- =====================================================================
-- Type families for the HsImpExp type families
+-- -------------------------------------
+-- ImportDecl type families
type family XCImportDecl x
type family XXImportDecl x
-- -------------------------------------
-
+-- IE type families
type family XIEVar x
type family XIEThingAbs x
type family XIEThingAll x
=====================================
compiler/GHC/Hs/ImpExp.hs
=====================================
@@ -79,7 +79,7 @@ isImportDeclQualified _ = True
-- A single Haskell @import@ declaration.
data ImportDecl pass
= ImportDecl {
- ideclExt :: XCImportDecl pass,
+ ideclExt :: !(XCImportDecl pass),
ideclSourceSrc :: SourceText,
-- Note [Pragma source text] in GHC.Types.Basic
ideclName :: XRec pass ModuleName, -- ^ Module name.
@@ -203,10 +203,10 @@ type LIE pass = XRec pass (IE pass)
-- | Imported or exported entity.
data IE pass
- = IEVar (XIEVar pass) (LIEWrappedName (IdP pass))
+ = IEVar !(XIEVar pass) (LIEWrappedName (IdP pass))
-- ^ Imported or Exported Variable
- | IEThingAbs (XIEThingAbs pass) (LIEWrappedName (IdP pass))
+ | IEThingAbs !(XIEThingAbs pass) (LIEWrappedName (IdP pass))
-- ^ Imported or exported Thing with Absent list
--
-- The thing is a Class/Type (can't tell)
@@ -215,7 +215,7 @@ data IE pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
-- See Note [Located RdrNames] in GHC.Hs.Expr
- | IEThingAll (XIEThingAll pass) (LIEWrappedName (IdP pass))
+ | IEThingAll !(XIEThingAll pass) (LIEWrappedName (IdP pass))
-- ^ Imported or exported Thing with All imported or exported
--
-- The thing is a Class/Type and the All refers to methods/constructors
@@ -227,7 +227,7 @@ data IE pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
-- See Note [Located RdrNames] in GHC.Hs.Expr
- | IEThingWith (XIEThingWith pass)
+ | IEThingWith !(XIEThingWith pass)
(LIEWrappedName (IdP pass))
IEWildcard
[LIEWrappedName (IdP pass)]
@@ -242,7 +242,7 @@ data IE pass
-- 'GHC.Parser.Annotation.AnnType'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | IEModuleContents (XIEModuleContents pass) (XRec pass ModuleName)
+ | IEModuleContents !(XIEModuleContents pass) (XRec pass ModuleName)
-- ^ Imported or exported module contents
--
-- (Export Only)
@@ -250,9 +250,9 @@ data IE pass
-- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnModule'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | IEGroup (XIEGroup pass) Int HsDocString -- ^ Doc section heading
- | IEDoc (XIEDoc pass) HsDocString -- ^ Some documentation
- | IEDocNamed (XIEDocNamed pass) String -- ^ Reference to named doc
+ | IEGroup !(XIEGroup pass) Int HsDocString -- ^ Doc section heading
+ | IEDoc !(XIEDoc pass) HsDocString -- ^ Some documentation
+ | IEDocNamed !(XIEDocNamed pass) String -- ^ Reference to named doc
| XIE !(XXIE pass)
type instance XIEVar (GhcPass _) = NoExtField
=====================================
compiler/GHC/Hs/Lit.hs
=====================================
@@ -48,36 +48,36 @@ import Data.Data hiding ( Fixity )
-- Note [Trees that grow] in GHC.Hs.Extension for the Xxxxx fields in the following
-- | Haskell Literal
data HsLit x
- = HsChar (XHsChar x) {- SourceText -} Char
+ = HsChar !(XHsChar x) {- SourceText -} Char
-- ^ Character
- | HsCharPrim (XHsCharPrim x) {- SourceText -} Char
+ | HsCharPrim !(XHsCharPrim x) {- SourceText -} Char
-- ^ Unboxed character
- | HsString (XHsString x) {- SourceText -} FastString
+ | HsString !(XHsString x) {- SourceText -} FastString
-- ^ String
- | HsStringPrim (XHsStringPrim x) {- SourceText -} !ByteString
+ | HsStringPrim !(XHsStringPrim x) {- SourceText -} !ByteString
-- ^ Packed bytes
- | HsInt (XHsInt x) IntegralLit
+ | HsInt !(XHsInt x) IntegralLit
-- ^ Genuinely an Int; arises from
-- "GHC.Tc.Deriv.Generate", and from TRANSLATION
- | HsIntPrim (XHsIntPrim x) {- SourceText -} Integer
+ | HsIntPrim !(XHsIntPrim x) {- SourceText -} Integer
-- ^ literal @Int#@
- | HsWordPrim (XHsWordPrim x) {- SourceText -} Integer
+ | HsWordPrim !(XHsWordPrim x) {- SourceText -} Integer
-- ^ literal @Word#@
- | HsInt64Prim (XHsInt64Prim x) {- SourceText -} Integer
+ | HsInt64Prim !(XHsInt64Prim x) {- SourceText -} Integer
-- ^ literal @Int64#@
- | HsWord64Prim (XHsWord64Prim x) {- SourceText -} Integer
+ | HsWord64Prim !(XHsWord64Prim x) {- SourceText -} Integer
-- ^ literal @Word64#@
- | HsInteger (XHsInteger x) {- SourceText -} Integer Type
+ | HsInteger !(XHsInteger x) {- SourceText -} Integer Type
-- ^ Genuinely an integer; arises only
-- from TRANSLATION (overloaded
-- literals are done with HsOverLit)
- | HsRat (XHsRat x) FractionalLit Type
+ | HsRat !(XHsRat x) FractionalLit Type
-- ^ Genuinely a rational; arises only from
-- TRANSLATION (overloaded literals are
-- done with HsOverLit)
- | HsFloatPrim (XHsFloatPrim x) FractionalLit
+ | HsFloatPrim !(XHsFloatPrim x) FractionalLit
-- ^ Unboxed Float
- | HsDoublePrim (XHsDoublePrim x) FractionalLit
+ | HsDoublePrim !(XHsDoublePrim x) FractionalLit
-- ^ Unboxed Double
| XLit !(XXLit x)
@@ -116,7 +116,7 @@ instance Eq (HsLit x) where
-- | Haskell Overloaded Literal
data HsOverLit p
= OverLit {
- ol_ext :: (XOverLit p),
+ ol_ext :: !(XOverLit p),
ol_val :: OverLitVal,
ol_witness :: HsExpr p} -- Note [Overloaded literal witnesses]
=====================================
compiler/GHC/Hs/Pat.hs
=====================================
@@ -87,42 +87,42 @@ type LPat p = XRec p (Pat p)
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
data Pat p
= ------------ Simple patterns ---------------
- WildPat (XWildPat p) -- ^ Wildcard Pattern
+ WildPat !(XWildPat p) -- ^ Wildcard Pattern
-- The sole reason for a type on a WildPat is to
-- support hsPatType :: Pat Id -> Type
-- AZ:TODO above comment needs to be updated
- | VarPat (XVarPat p)
+ | VarPat !(XVarPat p)
(LIdP p) -- ^ Variable Pattern
-- See Note [Located RdrNames] in GHC.Hs.Expr
- | LazyPat (XLazyPat p)
+ | LazyPat !(XLazyPat p)
(LPat p) -- ^ Lazy Pattern
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnTilde'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | AsPat (XAsPat p)
+ | AsPat !(XAsPat p)
(LIdP p) (LPat p) -- ^ As pattern
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnAt'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | ParPat (XParPat p)
+ | ParPat !(XParPat p)
(LPat p) -- ^ Parenthesised pattern
-- See Note [Parens in HsSyn] in GHC.Hs.Expr
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@,
-- 'GHC.Parser.Annotation.AnnClose' @')'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | BangPat (XBangPat p)
+ | BangPat !(XBangPat p)
(LPat p) -- ^ Bang pattern
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnBang'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
------------ Lists, tuples, arrays ---------------
- | ListPat (XListPat p)
+ | ListPat !(XListPat p)
[LPat p]
-- For OverloadedLists a Just (ty,fn) gives
-- overall type of the pattern, and the toList
@@ -135,7 +135,7 @@ data Pat p
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | TuplePat (XTuplePat p)
+ | TuplePat !(XTuplePat p)
-- after typechecking, holds the types of the tuple components
[LPat p] -- Tuple sub-patterns
Boxity -- UnitPat is TuplePat []
@@ -161,7 +161,7 @@ data Pat p
-- 'GHC.Parser.Annotation.AnnOpen' @'('@ or @'(#'@,
-- 'GHC.Parser.Annotation.AnnClose' @')'@ or @'#)'@
- | SumPat (XSumPat p) -- after typechecker, types of the alternative
+ | SumPat !(XSumPat p) -- after typechecker, types of the alternative
(LPat p) -- Sum sub-pattern
ConTag -- Alternative (one-based)
Arity -- Arity (INVARIANT: ≥ 2)
@@ -175,7 +175,7 @@ data Pat p
------------ Constructor patterns ---------------
| ConPat {
- pat_con_ext :: XConPat p,
+ pat_con_ext :: !(XConPat p),
pat_con :: XRec p (ConLikeP p),
pat_args :: HsConPatDetails p
}
@@ -185,7 +185,7 @@ data Pat p
-- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnRarrow'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | ViewPat (XViewPat p) -- The overall type of the pattern
+ | ViewPat !(XViewPat p) -- The overall type of the pattern
-- (= the argument type of the view function)
-- for hsPatType.
(LHsExpr p)
@@ -197,11 +197,11 @@ data Pat p
-- 'GHC.Parser.Annotation.AnnClose' @')'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | SplicePat (XSplicePat p)
+ | SplicePat !(XSplicePat p)
(HsSplice p) -- ^ Splice Pattern (Includes quasi-quotes)
------------ Literal and n+k patterns ---------------
- | LitPat (XLitPat p)
+ | LitPat !(XLitPat p)
(HsLit p) -- ^ Literal Pattern
-- Used for *non-overloaded* literal patterns:
-- Int#, Char#, Int, Char, String, etc.
@@ -209,7 +209,7 @@ data Pat p
| NPat -- Natural Pattern
-- Used for all overloaded literals,
-- including overloaded strings with -XOverloadedStrings
- (XNPat p) -- Overall type of pattern. Might be
+ !(XNPat p) -- Overall type of pattern. Might be
-- different than the literal's type
-- if (==) or negate changes the type
(XRec p (HsOverLit p)) -- ALWAYS positive
@@ -223,7 +223,7 @@ data Pat p
-- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnVal' @'+'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | NPlusKPat (XNPlusKPat p) -- Type of overall pattern
+ | NPlusKPat !(XNPlusKPat p) -- Type of overall pattern
(LIdP p) -- n+k pattern
(XRec p (HsOverLit p)) -- It'll always be an HsIntegral
(HsOverLit p) -- See Note [NPlusK patterns] in GHC.Tc.Gen.Pat
@@ -238,7 +238,7 @@ data Pat p
-- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon'
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | SigPat (XSigPat p) -- After typechecker: Type
+ | SigPat !(XSigPat p) -- After typechecker: Type
(LPat p) -- Pattern with a type signature
(HsPatSigType (NoGhcTc p)) -- Signature can bind both
-- kind and type vars
=====================================
compiler/GHC/Hs/Type.hs
=====================================
@@ -345,12 +345,12 @@ data HsForAllTelescope pass
= HsForAllVis -- ^ A visible @forall@ (e.g., @forall a -> {...}@).
-- These do not have any notion of specificity, so we use
-- '()' as a placeholder value.
- { hsf_xvis :: XHsForAllVis pass
+ { hsf_xvis :: !(XHsForAllVis pass)
, hsf_vis_bndrs :: [LHsTyVarBndr () pass]
}
| HsForAllInvis -- ^ An invisible @forall@ (e.g., @forall a {b} c. {...}@),
-- where each binder has a 'Specificity'.
- { hsf_xinvis :: XHsForAllInvis pass
+ { hsf_xinvis :: !(XHsForAllInvis pass)
, hsf_invis_bndrs :: [LHsTyVarBndr Specificity pass]
}
| XHsForAllTelescope !(XXHsForAllTelescope pass)
@@ -366,7 +366,7 @@ type LHsTyVarBndr flag pass = XRec pass (HsTyVarBndr flag pass)
-- | Located Haskell Quantified Type Variables
data LHsQTyVars pass -- See Note [HsType binders]
- = HsQTvs { hsq_ext :: XHsQTvs pass
+ = HsQTvs { hsq_ext :: !(XHsQTvs pass)
, hsq_explicit :: [LHsTyVarBndr () pass]
-- Explicit variables, written by the user
@@ -410,7 +410,7 @@ emptyLHsQTvs = HsQTvs { hsq_ext = [], hsq_explicit = [] }
-- | Haskell Implicit Binders
data HsImplicitBndrs pass thing -- See Note [HsType binders]
- = HsIB { hsib_ext :: XHsIB pass thing -- after renamer: [Name]
+ = HsIB { hsib_ext :: !(XHsIB pass thing) -- after renamer: [Name]
-- Implicitly-bound kind & type vars
-- Order is important; see
-- Note [Ordering of implicit variables]
@@ -430,7 +430,7 @@ type instance XXHsImplicitBndrs (GhcPass _) _ = NoExtCon
data HsWildCardBndrs pass thing
-- See Note [HsType binders]
-- See Note [The wildcard story for types]
- = HsWC { hswc_ext :: XHsWC pass thing
+ = HsWC { hswc_ext :: !(XHsWC pass thing)
-- after the renamer
-- Wild cards, only named
-- See Note [Wildcards in visible kind application]
@@ -456,7 +456,7 @@ type instance XXHsWildCardBndrs (GhcPass _) b = NoExtCon
-- slightly different semantics: see @Note [HsType binders]@.
-- See also @Note [The wildcard story for types]@.
data HsPatSigType pass
- = HsPS { hsps_ext :: XHsPS pass -- ^ After renamer: 'HsPSRn'
+ = HsPS { hsps_ext :: !(XHsPS pass) -- ^ After renamer: 'HsPSRn'
, hsps_body :: LHsType pass -- ^ Main payload (the type itself)
}
| XHsPatSigType !(XXHsPatSigType pass)
@@ -635,13 +635,13 @@ instance OutputableBndr HsIPName where
-- '()' in other places.
data HsTyVarBndr flag pass
= UserTyVar -- no explicit kinding
- (XUserTyVar pass)
+ !(XUserTyVar pass)
flag
(LIdP pass)
-- See Note [Located RdrNames] in GHC.Hs.Expr
| KindedTyVar
- (XKindedTyVar pass)
+ !(XKindedTyVar pass)
flag
(LIdP pass)
(LHsKind pass) -- The user-supplied kind signature
@@ -687,7 +687,7 @@ instance NamedThing (HsTyVarBndr flag GhcRn) where
-- | Haskell Type
data HsType pass
= HsForAllTy -- See Note [HsType binders]
- { hst_xforall :: XForAllTy pass
+ { hst_xforall :: !(XForAllTy pass)
, hst_tele :: HsForAllTelescope pass
-- Explicit, user-supplied 'forall a {b} c'
, hst_body :: LHsType pass -- body type
@@ -697,11 +697,11 @@ data HsType pass
-- For details on above see note [Api annotations] in "GHC.Parser.Annotation"
| HsQualTy -- See Note [HsType binders]
- { hst_xqual :: XQualTy pass
+ { hst_xqual :: !(XQualTy pass)
, hst_ctxt :: LHsContext pass -- Context C => blah
, hst_body :: LHsType pass }
- | HsTyVar (XTyVar pass)
+ | HsTyVar !(XTyVar pass)
PromotionFlag -- Whether explicitly promoted,
-- for the pretty printer
(LIdP pass)
@@ -712,18 +712,18 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsAppTy (XAppTy pass)
+ | HsAppTy !(XAppTy pass)
(LHsType pass)
(LHsType pass)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsAppKindTy (XAppKindTy pass) -- type level type app
+ | HsAppKindTy !(XAppKindTy pass) -- type level type app
(LHsType pass)
(LHsKind pass)
- | HsFunTy (XFunTy pass)
+ | HsFunTy !(XFunTy pass)
(HsArrow pass)
(LHsType pass) -- function type
(LHsType pass)
@@ -731,14 +731,14 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsListTy (XListTy pass)
+ | HsListTy !(XListTy pass)
(LHsType pass) -- Element type
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'['@,
-- 'GHC.Parser.Annotation.AnnClose' @']'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsTupleTy (XTupleTy pass)
+ | HsTupleTy !(XTupleTy pass)
HsTupleSort
[LHsType pass] -- Element types (length gives arity)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'(' or '(#'@,
@@ -746,20 +746,20 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsSumTy (XSumTy pass)
+ | HsSumTy !(XSumTy pass)
[LHsType pass] -- Element types (length gives arity)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'(#'@,
-- 'GHC.Parser.Annotation.AnnClose' '#)'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsOpTy (XOpTy pass)
+ | HsOpTy !(XOpTy pass)
(LHsType pass) (LIdP pass) (LHsType pass)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsParTy (XParTy pass)
+ | HsParTy !(XParTy pass)
(LHsType pass) -- See Note [Parens in HsSyn] in GHC.Hs.Expr
-- Parenthesis preserved for the precedence re-arrangement in
-- GHC.Rename.HsType
@@ -769,7 +769,7 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsIParamTy (XIParamTy pass)
+ | HsIParamTy !(XIParamTy pass)
(XRec pass HsIPName) -- (?x :: ty)
(LHsType pass) -- Implicit parameters as they occur in
-- contexts
@@ -780,12 +780,12 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsStarTy (XStarTy pass)
+ | HsStarTy !(XStarTy pass)
Bool -- Is this the Unicode variant?
-- Note [HsStarTy]
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None
- | HsKindSig (XKindSig pass)
+ | HsKindSig !(XKindSig pass)
(LHsType pass) -- (ty :: kind)
(LHsKind pass) -- A type with a kind signature
-- ^
@@ -796,20 +796,20 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsSpliceTy (XSpliceTy pass)
+ | HsSpliceTy !(XSpliceTy pass)
(HsSplice pass) -- Includes quasi-quotes
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'$('@,
-- 'GHC.Parser.Annotation.AnnClose' @')'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsDocTy (XDocTy pass)
+ | HsDocTy !(XDocTy pass)
(LHsType pass) LHsDocString -- A documented type
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsBangTy (XBangTy pass)
+ | HsBangTy !(XBangTy pass)
HsSrcBang (LHsType pass) -- Bang-style type annotations
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' :
-- 'GHC.Parser.Annotation.AnnOpen' @'{-\# UNPACK' or '{-\# NOUNPACK'@,
@@ -818,7 +818,7 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsRecTy (XRecTy pass)
+ | HsRecTy !(XRecTy pass)
[LConDeclField pass] -- Only in data type declarations
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'{'@,
-- 'GHC.Parser.Annotation.AnnClose' @'}'@
@@ -832,7 +832,7 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| HsExplicitListTy -- A promoted explicit list
- (XExplicitListTy pass)
+ !(XExplicitListTy pass)
PromotionFlag -- whether explicitly promoted, for pretty printer
[LHsType pass]
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @"'["@,
@@ -841,19 +841,19 @@ data HsType pass
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
| HsExplicitTupleTy -- A promoted explicit tuple
- (XExplicitTupleTy pass)
+ !(XExplicitTupleTy pass)
[LHsType pass]
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @"'("@,
-- 'GHC.Parser.Annotation.AnnClose' @')'@
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsTyLit (XTyLit pass) HsTyLit -- A promoted numeric literal.
+ | HsTyLit !(XTyLit pass) HsTyLit -- A promoted numeric literal.
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None
-- For details on above see note [Api annotations] in GHC.Parser.Annotation
- | HsWildCardTy (XWildCardTy pass) -- A type wildcard
+ | HsWildCardTy !(XWildCardTy pass) -- A type wildcard
-- See Note [The wildcard story for types]
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None
@@ -861,7 +861,7 @@ data HsType pass
-- For adding new constructors via Trees that Grow
| XHsType
- (XXType pass)
+ !(XXType pass)
data NewHsTypeX
= NHsCoreTy Type -- An escape hatch for tunnelling a *closed*
@@ -1083,7 +1083,7 @@ type LConDeclField pass = XRec pass (ConDeclField pass)
-- | Constructor Declaration Field
data ConDeclField pass -- Record fields have Haddock docs on them
- = ConDeclField { cd_fld_ext :: XConDeclField pass,
+ = ConDeclField { cd_fld_ext :: !(XConDeclField pass),
cd_fld_names :: [LFieldOcc pass],
-- ^ See Note [ConDeclField passs]
cd_fld_type :: LBangType pass,
@@ -1680,7 +1680,7 @@ type LFieldOcc pass = XRec pass (FieldOcc pass)
-- Represents an *occurrence* of an unambiguous field. We store
-- both the 'RdrName' the user originally wrote, and after the
-- renamer, the selector function.
-data FieldOcc pass = FieldOcc { extFieldOcc :: XCFieldOcc pass
+data FieldOcc pass = FieldOcc { extFieldOcc :: !(XCFieldOcc pass)
, rdrNameFieldOcc :: Located RdrName
-- ^ See Note [Located RdrNames] in "GHC.Hs.Expr"
}
@@ -1715,8 +1715,8 @@ mkFieldOcc rdr = FieldOcc noExtField rdr
-- Note [Disambiguating record fields] in "GHC.Tc.Gen.Head".
-- See Note [Located RdrNames] in "GHC.Hs.Expr"
data AmbiguousFieldOcc pass
- = Unambiguous (XUnambiguous pass) (Located RdrName)
- | Ambiguous (XAmbiguous pass) (Located RdrName)
+ = Unambiguous !(XUnambiguous pass) (Located RdrName)
+ | Ambiguous !(XAmbiguous pass) (Located RdrName)
| XAmbiguousFieldOcc !(XXAmbiguousFieldOcc pass)
type instance XUnambiguous GhcPs = NoExtField
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4b91e136c2e4d464f4cc7da81b344d5d96336d60
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4b91e136c2e4d464f4cc7da81b344d5d96336d60
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200930/4466781b/attachment-0001.html>
More information about the ghc-commits
mailing list