Haskell Local Bindings
Moduleghc-9.10.3GHC2021
Language.Haskell.Syntax.Binds
- 24 types
- 9 values
- Packageghc-9.10.3
- Exports37
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceBinds.hs
Located Haskell local bindings
Haskell Local Bindings with separate Left and Right identifier types
Bindings in a let expression
or a where clause
Constructors
HsValBinds (XHsValBinds idL idR) (HsValBindsLR idL idR)Haskell Value Bindings
HsIPBinds (XHsIPBinds idL idR) (HsIPBinds idR)Haskell Implicit Parameter Bindings
EmptyLocalBinds (XEmptyLocalBinds idL idR)Empty Local Bindings
XHsLocalBindsLR !(XXHsLocalBindsLR idL idR)
Instances6ToHie, Data, Outputable
HiePass p => ToHie (RScoped (HsLocalBinds (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstData (HsLocalBindsLR GhcPs GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsLocalBindsLR GhcPs GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsLocalBindsLR GhcRn GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsLocalBindsLR GhcTc GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphan(OutputableBndrId pl, OutputableBndrId pr) => Outputable (HsLocalBindsLR (GhcPass pl) (GhcPass pr))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Haskell Value Bindings
Haskell Value bindings with separate Left and Right identifier types (not implicit parameters) Used for both top level and nested bindings May contain pattern synonym bindings
Constructors
ValBinds (XValBinds idL idR) (LHsBindsLR idL idR) [LSig idR]Value Bindings In
Before renaming RHS; idR is always RdrName Not dependency analysed Recursive by default
XValBindsLR !(XXValBindsLR idL idR)Value Bindings Out
After renaming RHS; idR can be Name or Id Dependency analysed, later bindings in the list may depend on earlier ones.
Instances6ToHie, Data, Outputable
HiePass p => ToHie (RScoped (HsValBindsLR (GhcPass p) (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstData (HsValBindsLR GhcPs GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsValBindsLR GhcPs GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsValBindsLR GhcRn GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsValBindsLR GhcTc GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphan(OutputableBndrId pl, OutputableBndrId pr) => Outputable (HsValBindsLR (GhcPass pl) (GhcPass pr))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Located Haskell Binding
Located Haskell Bindings
Haskell Binding
Located Haskell Bindings with separate Left and Right identifier types
Located Haskell Binding with separate Left and Right identifier types
Haskell Binding with separate Left and Right id's
Constructors
FunBindFunction-like Binding
FunBind is used for both functions
f x = eand variablesf = x -> eand strict variables!x = x + 1Reason 1: Special case for type inference: see
GHC.Tc.Gen.Bind.tcMonoBinds.Reason 2: Instance decls can only have FunBinds, which is convenient. If you change this, you'll need to change e.g. rnMethodBinds
But note that the form
f :: a->a = ...parses as a pattern binding, just like(f :: a -> a) = ...Strict bindings have their strictness recorded in the
SrcStrictnessof theirMatchContext. See Note [FunBind vs PatBind] for details about the relationship between FunBind and PatBind.fun_ext :: XFunBind idL idRfun_id :: LIdP idLfun_matches :: MatchGroup idR (LHsExpr idR)The payload
PatBindPattern Binding
The pattern is never a simple variable; That case is done by FunBind. See Note [FunBind vs PatBind] for details about the relationship between FunBind and PatBind.
VarBindVariable Binding
Dictionary binding and suchlike. All VarBinds are introduced by the type checker
PatSynBind (XPatSynBind idL idR) (PatSynBind idL idR)Patterns Synonym Binding
XHsBindsLR !(XXHsBindsLR idL idR)
Instances8HasType, ToHie, Data, Outputable, Anno, …
HiePass p => HasType (LocatedA (HsBind (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (BindContext (LocatedA (HsBind (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstData (HsBindLR GhcPs GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsBindLR GhcPs GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsBindLR GhcRn GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsBindLR GhcTc GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphan(OutputableBndrId pl, OutputableBndrId pr) => Outputable (HsBindLR (GhcPass pl) (GhcPass pr))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphantype Anno (HsBindLR (GhcPass idL) (GhcPass idR)) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Binds · orphan
AnnKeywordId : AnnPattern, AnnEqual,AnnLarrow, AnnWhere,AnnOpen
'{', AnnClose'}',
Pattern Synonym binding
Constructors
PSBpsb_ext :: XPSB idL idRpsb_id :: LIdP idLName of the pattern synonym
psb_args :: HsPatSynDetails idRFormal parameter names
psb_def :: LPat idRRight-hand side
psb_dir :: HsPatSynDir idRDirectionality
XPatSynBind !(XXPatSynBind idL idR)
Instances6ToHie, Data, Outputable
HiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstData (PatSynBind GhcPs GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (PatSynBind GhcPs GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (PatSynBind GhcRn GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (PatSynBind GhcTc GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphan(OutputableBndrId l, OutputableBndrId r) => Outputable (PatSynBind (GhcPass l) (GhcPass r))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Multiplicity annotations, on binders, are always resolved (to a unification variable if there is no annotation) during type-checking. The resolved multiplicity is stored in the extension fields.
Constructors
HsNoMultAnn !(XNoMultAnn pass)HsPct1Ann !(XPct1Ann pass)HsMultAnn !(XMultAnn pass) (LHsType (NoGhcTc pass))XMultAnn !(XXMultAnn pass)
Instances3XNoMultAnn
type XNoMultAnn GhcPs = NoExtFieldDefined in ghc-9.10.3 · GHC.Hs.Binds · orphantype XNoMultAnn GhcRn = NoExtFieldDefined in ghc-9.10.3 · GHC.Hs.Binds · orphantype XNoMultAnn GhcTc = MultDefined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Instances1XXMultAnn
type XXMultAnn (GhcPass _1) = DataConCantHappenDefined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Haskell Implicit Parameter Bindings
Constructors
IPBinds (XIPBinds id) [LIPBind id]XHsIPBinds !(XXHsIPBinds id)
Instances4Data, Outputable
Data (HsIPBinds GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsIPBinds GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsIPBinds GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanOutputableBndrId p => Outputable (HsIPBinds (GhcPass p))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Located Implicit Parameter Binding
May have AnnKeywordId : AnnSemi when in a list
Implicit parameter bindings.
Instances6Data, Outputable, ToHie, Anno
Data (IPBind GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (IPBind GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (IPBind GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanOutputableBndrId p => Outputable (IPBind (GhcPass p))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphanHiePass p => ToHie (RScoped (LocatedA (IPBind (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.Asttype Anno (IPBind (GhcPass p)) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Located Signature
Signatures and pragmas
Constructors
TypeSig (XTypeSig pass) [LIdP pass] (LHsSigWcType pass)An ordinary type signature
f :: Num a => a -> aAfter renaming, this list of Names contains the named wildcards brought into scope by this signature. For a signature
_ -> _a -> Bool, the renamer will leave the unnamed wildcard_untouched, and the named wildcard_ais then replaced with fresh meta vars in the type. Their names are stored in the type signature that brought them into scope, in this third field to be more specific.PatSynSig (XPatSynSig pass) [LIdP pass] (LHsSigType pass)A pattern synonym type signature
pattern Single :: () => (Show a) => a -> [a]ClassOpSig (XClassOpSig pass) Bool [LIdP pass] (LHsSigType pass)A signature for a class method False: ordinary class-method signature True: generic-default class method signature e.g. class C a where op :: a -> a -- Ordinary default op :: Eq a => a -> a -- Generic default No wildcards allowed here
FixSig (XFixSig pass) (FixitySig pass)InlineSig (XInlineSig pass) (LIdP pass) InlinePragmaSpecSig (XSpecSig pass) (LIdP pass) [LHsSigType pass] InlinePragmaSpecInstSig (XSpecInstSig pass) (LHsSigType pass)A specialisation pragma for instance declarations only
{-# SPECIALISE instance Eq [Int] #-}(Class tys); should be a specialisation of the current instance declaration
MinimalSig (XMinimalSig pass) (LBooleanFormula (LIdP pass))A minimal complete definition pragma
{-# MINIMAL a | (b, c | (d | e)) #-}SCCFunSig (XSCCFunSig pass) (LIdP pass) (Maybe (XRec pass StringLiteral))A "set cost centre" pragma for declarations
{-# SCC funName #-}or
{-# SCC funName "cost_centre_name" #-}CompleteMatchSig (XCompleteMatchSig pass) [LIdP pass] (Maybe (LIdP pass))A complete match pragma
{-# COMPLETE C, D [:: T] #-}Used to inform the pattern match checker about additional complete matchings which, for example, arise from pattern synonym definitions.
XSig !(XXSig pass)
Instances6Data, Outputable, ToHie, Anno
Data (Sig GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Sig GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Sig GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanOutputableBndrId p => Outputable (Sig (GhcPass p))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphanHiePass p => ToHie (SigContext (LocatedA (Sig (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.Asttype Anno (Sig (GhcPass p)) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Located Fixity Signature
Fixity Signature
Constructors
FixitySig (XFixitySig pass) [LIdP pass] FixityXFixitySig !(XXFixitySig pass)
Instances6Data, Outputable, ToHie, Anno
Data (FixitySig GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (FixitySig GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (FixitySig GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanOutputableBndrId p => Outputable (FixitySig (GhcPass p))Defined in ghc-9.10.3 · GHC.Hs.Binds · orphanToHie (LocatedA (FixitySig GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.Asttype Anno (FixitySig (GhcPass p)) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Binds · orphan
Haskell Pattern Synonym Details
Record Pattern Synonym Field
Constructors
RecordPatSynFieldrecordPatSynField :: FieldOcc passField label visible in rest of the file
recordPatSynPatVar :: LIdP passFilled in by renamer, the name used internally by the pattern
Instances5Data, Outputable, ToHie
Data (RecordPatSynField GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (RecordPatSynField GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (RecordPatSynField GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanOutputable (XRec a RdrName) => Outputable (RecordPatSynField a)Defined in ghc-9.10.3 · GHC.Hs.Binds · orphanHiePass p => ToHie (PatSynFieldContext (RecordPatSynField (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.Ast
Haskell Pattern Synonym Direction
Constructors
Instances4Data, ToHie
Data (HsPatSynDir GhcPs)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsPatSynDir GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (HsPatSynDir GhcTc)Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanHiePass p => ToHie (HsPatSynDir (GhcPass p))Defined in ghc-9.10.3 · GHC.Iface.Ext.Ast