ghc-7.0.4: The GHC API

HsBinds

Synopsis

- type HsLocalBinds id = HsLocalBindsLR id id
- data HsLocalBindsLR idL idR
  - = HsValBinds (HsValBindsLR idL idR)
  - | HsIPBinds (HsIPBinds idR)
  - | EmptyLocalBinds
- type HsValBinds id = HsValBindsLR id id
- data HsValBindsLR idL idR
  - = ValBindsIn (LHsBindsLR idL idR) [LSig idR]
  - | ValBindsOut [(RecFlag, LHsBinds idL)] [LSig Name]
- type LHsBinds id = Bag (LHsBind id)
- type LHsBind id = Located (HsBind id)
- type HsBind id = HsBindLR id id
- type LHsBindLR idL idR = Located (HsBindLR idL idR)
- type LHsBindsLR idL idR = Bag (LHsBindLR idL idR)
- data HsBindLR idL idR
  - = FunBind {
    - fun_id :: Located idL
    - fun_infix :: Bool
    - fun_matches :: MatchGroup idR
    - fun_co_fn :: HsWrapper
    - bind_fvs :: NameSet
    - fun_tick :: Maybe (Int, [Id])
    }
  - | PatBind {
    - pat_lhs :: LPat idL
    - pat_rhs :: GRHSs idR
    - pat_rhs_ty :: PostTcType
    - bind_fvs :: NameSet
    }
  - | VarBind {
    - var_id :: idL
    - var_rhs :: LHsExpr idR
    - var_inline :: Bool
    }
  - | AbsBinds {
    - abs_tvs :: [TyVar]
    - abs_ev_vars :: [EvVar]
    - abs_exports :: [([TyVar], idL, idL, TcSpecPrags)]
    - abs_ev_binds :: TcEvBinds
    - abs_binds :: LHsBinds idL
    }
- placeHolderNames :: NameSet
- pprValBindsForUser :: (OutputableBndr idL, OutputableBndr idR, OutputableBndr id2) => LHsBindsLR idL idR -> [LSig id2] -> SDoc
- pprLHsBinds :: (OutputableBndr idL, OutputableBndr idR) => LHsBindsLR idL idR -> SDoc
- emptyLocalBinds :: HsLocalBindsLR a b
- isEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
- isEmptyValBinds :: HsValBindsLR a b -> Bool
- emptyValBindsOut :: HsValBindsLR a b
- emptyValBindsIn :: HsValBindsLR a b
- emptyLHsBinds :: LHsBindsLR idL idR
- isEmptyLHsBinds :: LHsBindsLR idL idR -> Bool
- plusHsValBinds :: HsValBinds a -> HsValBinds a -> HsValBinds a
- getTypeSigNames :: HsValBinds a -> NameSet
- ppr_monobind :: (OutputableBndr idL, OutputableBndr idR) => HsBindLR idL idR -> SDoc
- pprTicks :: SDoc -> SDoc -> SDoc
- data HsIPBinds id = IPBinds [LIPBind id] TcEvBinds
- isEmptyIPBinds :: HsIPBinds id -> Bool
- type LIPBind id = Located (IPBind id)
- data IPBind id = IPBind (IPName id) (LHsExpr id)
- data HsWrapper
  - = WpHole
  - | WpCompose HsWrapper HsWrapper
  - | WpCast Coercion
  - | WpEvLam EvVar
  - | WpEvApp EvTerm
  - | WpTyLam TyVar
  - | WpTyApp Type
  - | WpLet TcEvBinds
- data TcEvBinds
  - = TcEvBinds EvBindsVar
  - | EvBinds (Bag EvBind)
- data EvBindsVar = EvBindsVar (IORef EvBindMap) Unique
- type EvBindMap = VarEnv EvBind
- emptyEvBindMap :: EvBindMap
- extendEvBinds :: EvBindMap -> EvVar -> EvTerm -> EvBindMap
- lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind
- evBindMapBinds :: EvBindMap -> Bag EvBind
- data EvBind = EvBind EvVar EvTerm
- data EvTerm
  - = EvId EvId
  - | EvCoercion Coercion
  - | EvCast EvVar Coercion
  - | EvDFunApp DFunId [Type] [EvVar]
  - | EvSuperClass DictId Int
- evVarTerm :: EvVar -> EvTerm
- emptyTcEvBinds :: TcEvBinds
- isEmptyTcEvBinds :: TcEvBinds -> Bool
- (<.>) :: HsWrapper -> HsWrapper -> HsWrapper
- mkWpTyApps :: [Type] -> HsWrapper
- mkWpEvApps :: [EvTerm] -> HsWrapper
- mkWpEvVarApps :: [EvVar] -> HsWrapper
- mkWpTyLams :: [TyVar] -> HsWrapper
- mkWpLams :: [Var] -> HsWrapper
- mkWpLet :: TcEvBinds -> HsWrapper
- mk_co_lam_fn :: (a -> HsWrapper) -> [a] -> HsWrapper
- mk_co_app_fn :: (a -> HsWrapper) -> [a] -> HsWrapper
- idHsWrapper :: HsWrapper
- isIdHsWrapper :: HsWrapper -> Bool
- pprHsWrapper :: SDoc -> HsWrapper -> SDoc
- type LSig name = Located (Sig name)
- data Sig name
  - = TypeSig (Located name) (LHsType name)
  - | IdSig Id
  - | FixSig (FixitySig name)
  - | InlineSig (Located name) InlinePragma
  - | SpecSig (Located name) (LHsType name) InlinePragma
  - | SpecInstSig (LHsType name)
- type LFixitySig name = Located (FixitySig name)
- data FixitySig name = FixitySig (Located name) Fixity
- data TcSpecPrags
  - = IsDefaultMethod
  - | SpecPrags [LTcSpecPrag]
- type LTcSpecPrag = Located TcSpecPrag
- data TcSpecPrag = SpecPrag Id HsWrapper InlinePragma
- noSpecPrags :: TcSpecPrags
- hasSpecPrags :: TcSpecPrags -> Bool
- isDefaultMethod :: TcSpecPrags -> Bool
- okBindSig :: Sig a -> Bool
- okHsBootSig :: Sig a -> Bool
- okClsDclSig :: Sig a -> Bool
- okInstDclSig :: Sig a -> Bool
- sigForThisGroup :: NameSet -> LSig Name -> Bool
- sigName :: LSig name -> Maybe name
- sigNameNoLoc :: Sig name -> Maybe name
- isFixityLSig :: LSig name -> Bool
- isVanillaLSig :: LSig name -> Bool
- isTypeLSig :: LSig name -> Bool
- isSpecLSig :: LSig name -> Bool
- isSpecInstLSig :: LSig name -> Bool
- isPragLSig :: LSig name -> Bool
- isInlineLSig :: LSig name -> Bool
- hsSigDoc :: Sig name -> SDoc
- eqHsSig :: Eq a => LSig a -> LSig a -> Bool
- ppr_sig :: OutputableBndr name => Sig name -> SDoc
- pragBrackets :: SDoc -> SDoc
- pprVarSig :: Outputable id => id -> SDoc -> SDoc
- pprSpec :: Outputable id => id -> SDoc -> InlinePragma -> SDoc
- pprTcSpecPrags :: TcSpecPrags -> SDoc

# Documentation

type HsLocalBinds id = HsLocalBindsLR id idSource

data HsLocalBindsLR idL idR Source

Constructors

HsValBinds (HsValBindsLR idL idR) |
HsIPBinds (HsIPBinds idR) |
EmptyLocalBinds |

Instances

Typeable2 HsLocalBindsLR |
(Data idL, Data idR) => Data (HsLocalBindsLR idL idR) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (HsLocalBindsLR idL idR) |

type HsValBinds id = HsValBindsLR id idSource

data HsValBindsLR idL idR Source

Constructors

ValBindsIn (LHsBindsLR idL idR) [LSig idR] |
ValBindsOut [(RecFlag, LHsBinds idL)] [LSig Name] |

Instances

Typeable2 HsValBindsLR |
(Data idL, Data idR) => Data (HsValBindsLR idL idR) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (HsValBindsLR idL idR) |

type LHsBinds id = Bag (LHsBind id)Source

type LHsBind id = Located (HsBind id)Source

type HsBind id = HsBindLR id idSource

type LHsBindLR idL idR = Located (HsBindLR idL idR)Source

type LHsBindsLR idL idR = Bag (LHsBindLR idL idR)Source

data HsBindLR idL idR Source

Constructors

FunBind | FunBind is used for both functions `f x = e` and variables `f = x -> e` Reason 1: Special case for type inference: see `TcBinds.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) = ...`

Fields

fun_id :: Located idL
fun_infix :: Bool

  True => infix declaration

fun_matches :: MatchGroup idR

  The payload

fun_co_fn :: HsWrapper

  Coercion from the type of the MatchGroup to the type of the Id. Example: `f :: Int -> forall a. a -> a f x y = y` Then the MatchGroup will have type (Int -> a' -> a') (with a free type variable a'). The coercion will take a CoreExpr of this type and convert it to a CoreExpr of type Int -> forall a'. a' -> a' Notice that the coercion captures the free a'.

bind_fvs :: NameSet

  After the renamer, this contains a superset of the Names of the other binders in this binding group that are free in the RHS of the defn Before renaming, and after typechecking, the field is unused; it's just an error thunk

fun_tick :: Maybe (Int, [Id])

  This is the (optional) module-local tick number.

PatBind |

Fields

pat_lhs :: LPat idL
pat_rhs :: GRHSs idR
pat_rhs_ty :: PostTcType
bind_fvs :: NameSet

  After the renamer, this contains a superset of the Names of the other binders in this binding group that are free in the RHS of the defn Before renaming, and after typechecking, the field is unused; it's just an error thunk

VarBind |

Fields

var_id :: idL
var_rhs :: LHsExpr idR
var_inline :: Bool

AbsBinds |

Fields

abs_tvs :: [TyVar]
abs_ev_vars :: [EvVar]
abs_exports :: [([TyVar], idL, idL, TcSpecPrags)]
abs_ev_binds :: TcEvBinds
abs_binds :: LHsBinds idL

Instances

Typeable2 HsBindLR |
(Data idL, Data idR) => Data (HsBindLR idL idR) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (HsBindLR idL idR) |

placeHolderNames :: NameSet Source

pprValBindsForUser :: (OutputableBndr idL, OutputableBndr idR, OutputableBndr id2) => LHsBindsLR idL idR -> [LSig id2] -> SDoc Source

pprLHsBinds :: (OutputableBndr idL, OutputableBndr idR) => LHsBindsLR idL idR -> SDoc Source

emptyLocalBinds :: HsLocalBindsLR a bSource

isEmptyLocalBinds :: HsLocalBindsLR a b -> Bool Source

isEmptyValBinds :: HsValBindsLR a b -> Bool Source

emptyValBindsOut :: HsValBindsLR a bSource

emptyValBindsIn :: HsValBindsLR a bSource

emptyLHsBinds :: LHsBindsLR idL idRSource

isEmptyLHsBinds :: LHsBindsLR idL idR -> Bool Source

plusHsValBinds :: HsValBinds a -> HsValBinds a -> HsValBinds aSource

getTypeSigNames :: HsValBinds a -> NameSet Source

ppr_monobind :: (OutputableBndr idL, OutputableBndr idR) => HsBindLR idL idR -> SDoc Source

pprTicks :: SDoc -> SDoc -> SDoc Source

data HsIPBinds id Source

Constructors

IPBinds [LIPBind id] TcEvBinds |

Instances

Typeable1 HsIPBinds |
Data id => Data (HsIPBinds id) |
OutputableBndr id => Outputable (HsIPBinds id) |

isEmptyIPBinds :: HsIPBinds id -> Bool Source

type LIPBind id = Located (IPBind id)Source

data IPBind id Source

Implicit parameter bindings.

Constructors

IPBind (IPName id) (LHsExpr id) |

Instances

Typeable1 IPBind |
Data id => Data (IPBind id) |
OutputableBndr id => Outputable (IPBind id) |

data HsWrapper Source

Constructors

WpHole |
WpCompose HsWrapper HsWrapper |
WpCast Coercion |
WpEvLam EvVar |
WpEvApp EvTerm |
WpTyLam TyVar |
WpTyApp Type |
WpLet TcEvBinds |

Instances

Data HsWrapper |
Typeable HsWrapper |
Outputable HsWrapper |

data TcEvBinds Source

Constructors

TcEvBinds EvBindsVar |
EvBinds (Bag EvBind) |

Instances

Data TcEvBinds |
Typeable TcEvBinds |
Outputable TcEvBinds |

data EvBindsVar Source

Constructors

EvBindsVar (IORef EvBindMap) Unique |

Instances

Outputable EvBindsVar |

type EvBindMap = VarEnv EvBind Source

emptyEvBindMap :: EvBindMap Source

extendEvBinds :: EvBindMap -> EvVar -> EvTerm -> EvBindMap Source

lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind Source

evBindMapBinds :: EvBindMap -> Bag EvBind Source

data EvBind Source

Constructors

EvBind EvVar EvTerm |

Instances

Outputable EvBind |

data EvTerm Source

Constructors

EvId EvId |
EvCoercion Coercion |
EvCast EvVar Coercion |
EvDFunApp DFunId [Type] [EvVar] |
EvSuperClass DictId Int |

Instances

Data EvTerm |
Typeable EvTerm |
Outputable EvTerm |

evVarTerm :: EvVar -> EvTerm Source

emptyTcEvBinds :: TcEvBinds Source

isEmptyTcEvBinds :: TcEvBinds -> Bool Source

(<.>) :: HsWrapper -> HsWrapper -> HsWrapper Source

mkWpTyApps :: [Type] -> HsWrapper Source

mkWpEvApps :: [EvTerm] -> HsWrapper Source

mkWpEvVarApps :: [EvVar] -> HsWrapper Source

mkWpTyLams :: [TyVar] -> HsWrapper Source

mkWpLams :: [Var] -> HsWrapper Source

mkWpLet :: TcEvBinds -> HsWrapper Source

mk_co_lam_fn :: (a -> HsWrapper) -> [a] -> HsWrapper Source

mk_co_app_fn :: (a -> HsWrapper) -> [a] -> HsWrapper Source

idHsWrapper :: HsWrapper Source

isIdHsWrapper :: HsWrapper -> Bool Source

pprHsWrapper :: SDoc -> HsWrapper -> SDoc Source

type LSig name = Located (Sig name)Source

data Sig name Source

Constructors

TypeSig (Located name) (LHsType name) |
IdSig Id |
FixSig (FixitySig name) |
InlineSig (Located name) InlinePragma |
SpecSig (Located name) (LHsType name) InlinePragma |
SpecInstSig (LHsType name) |

Instances

Typeable1 Sig |
Data name => Data (Sig name) |
OutputableBndr name => Outputable (Sig name) |

type LFixitySig name = Located (FixitySig name)Source

data FixitySig name Source

Constructors

FixitySig (Located name) Fixity |

Instances

Typeable1 FixitySig |
Data name => Data (FixitySig name) |
Outputable name => Outputable (FixitySig name) |

data TcSpecPrags Source

Constructors

IsDefaultMethod |
SpecPrags [LTcSpecPrag] |

Instances

Data TcSpecPrags |
Typeable TcSpecPrags |

type LTcSpecPrag = Located TcSpecPrag Source

data TcSpecPrag Source

Constructors

SpecPrag Id HsWrapper InlinePragma |

Instances

Data TcSpecPrag |
Typeable TcSpecPrag |
Outputable TcSpecPrag |

noSpecPrags :: TcSpecPrags Source

hasSpecPrags :: TcSpecPrags -> Bool Source

isDefaultMethod :: TcSpecPrags -> Bool Source

okBindSig :: Sig a -> Bool Source

okHsBootSig :: Sig a -> Bool Source

okClsDclSig :: Sig a -> Bool Source

okInstDclSig :: Sig a -> Bool Source

sigForThisGroup :: NameSet -> LSig Name -> Bool Source

sigName :: LSig name -> Maybe nameSource

sigNameNoLoc :: Sig name -> Maybe nameSource

isFixityLSig :: LSig name -> Bool Source

isVanillaLSig :: LSig name -> Bool Source

isTypeLSig :: LSig name -> Bool Source

isSpecLSig :: LSig name -> Bool Source

isSpecInstLSig :: LSig name -> Bool Source

isPragLSig :: LSig name -> Bool Source

isInlineLSig :: LSig name -> Bool Source

hsSigDoc :: Sig name -> SDoc Source

eqHsSig :: Eq a => LSig a -> LSig a -> Bool Source

ppr_sig :: OutputableBndr name => Sig name -> SDoc Source

pragBrackets :: SDoc -> SDoc Source

pprVarSig :: Outputable id => id -> SDoc -> SDoc Source

pprSpec :: Outputable id => id -> SDoc -> InlinePragma -> SDoc Source

pprTcSpecPrags :: TcSpecPrags -> SDoc Source