ghc-7.6.3: The GHC API

Safe Haskell | None

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 LHsBind id = LHsBindLR id id
- type LHsBinds id = LHsBindsLR id id
- type HsBind id = HsBindLR id id
- type LHsBindsLR idL idR = Bag (LHsBindLR idL idR)
- type LHsBindLR idL idR = Located (HsBindLR 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 (Tickish Id)
    }
  - | PatBind {
    - pat_lhs :: LPat idL
    - pat_rhs :: GRHSs idR
    - pat_rhs_ty :: PostTcType
    - bind_fvs :: NameSet
    - pat_ticks :: (Maybe (Tickish Id), [Maybe (Tickish Id)])
    }
  - | VarBind {
    - var_id :: idL
    - var_rhs :: LHsExpr idR
    - var_inline :: Bool
    }
  - | AbsBinds {
    - abs_tvs :: [TyVar]
    - abs_ev_vars :: [EvVar]
    - abs_exports :: [ABExport idL]
    - abs_ev_binds :: TcEvBinds
    - abs_binds :: LHsBinds idL
    }
- data ABExport id = ABE {
  - abe_poly :: id
  - abe_mono :: id
  - abe_wrap :: HsWrapper
  - abe_prags :: TcSpecPrags
  }
- placeHolderNames :: NameSet
- pprLHsBinds :: (OutputableBndr idL, OutputableBndr idR) => LHsBindsLR idL idR -> SDoc
- pprLHsBindsForUser :: (OutputableBndr idL, OutputableBndr idR, OutputableBndr id2) => LHsBindsLR idL idR -> [LSig id2] -> [SDoc]
- pprDeclList :: [SDoc] -> SDoc
- emptyLocalBinds :: HsLocalBindsLR a b
- isEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
- isEmptyValBinds :: HsValBindsLR a b -> Bool
- emptyValBindsIn :: HsValBindsLR a b
- emptyValBindsOut :: 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 (Either HsIPName id) (LHsExpr id)
- type LSig name = Located (Sig name)
- data Sig name
  - = TypeSig [Located name] (LHsType name)
  - | GenericSig [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
- 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
- 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 id

data HsLocalBindsLR idL idR

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 id

data HsValBindsLR idL idR

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 LHsBind id = LHsBindLR id id

type LHsBinds id = LHsBindsLR id id

type HsBind id = HsBindLR id id

type LHsBindsLR idL idR = Bag (LHsBindLR idL idR)

type LHsBindLR idL idR = Located (HsBindLR idL idR)

data HsBindLR idL idR

Constructors

FunBind | FunBind is used for both functions `f x = e` and variables `f = x -> e` Reason 1: Special case for type inference: see `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 the locally-bound free variables of this defn. See Note [Bind free vars] fun_tick :: Maybe (Tickish Id) Tick to put on the rhs, if any
PatBind |
Fields pat_lhs :: LPat idL pat_rhs :: GRHSs idR pat_rhs_ty :: PostTcType bind_fvs :: NameSet After the renamer, this contains the locally-bound free variables of this defn. See Note [Bind free vars] pat_ticks :: (Maybe (Tickish Id), [Maybe (Tickish Id)]) Tick to put on the rhs, if any, and ticks to put on the bound variables.
VarBind |
Fields var_id :: idL var_rhs :: LHsExpr idR var_inline :: Bool
AbsBinds |
Fields abs_tvs :: [TyVar] abs_ev_vars :: [EvVar] abs_exports :: [ABExport idL] 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) |

data ABExport id

Constructors

ABE |
Fields abe_poly :: id abe_mono :: id abe_wrap :: HsWrapper abe_prags :: TcSpecPrags

Instances

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

placeHolderNames :: NameSet

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

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

pprDeclList :: [SDoc] -> SDoc

emptyLocalBinds :: HsLocalBindsLR a b

isEmptyLocalBinds :: HsLocalBindsLR a b -> Bool

isEmptyValBinds :: HsValBindsLR a b -> Bool

emptyValBindsIn :: HsValBindsLR a b

emptyValBindsOut :: 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

Constructors

IPBinds [LIPBind id] TcEvBinds |

Instances

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

isEmptyIPBinds :: HsIPBinds id -> Bool

type LIPBind id = Located (IPBind id)

data IPBind id

Implicit parameter bindings.

Constructors

IPBind (Either HsIPName id) (LHsExpr id) |

Instances

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

type LSig name = Located (Sig name)

data Sig name

Constructors

TypeSig [Located name] (LHsType name) |
GenericSig [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)

data FixitySig name

Constructors

FixitySig (Located name) Fixity |

Instances

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

data TcSpecPrags

Constructors

IsDefaultMethod |
SpecPrags [LTcSpecPrag] |

Instances

Data TcSpecPrags |
Typeable TcSpecPrags |

type LTcSpecPrag = Located TcSpecPrag

data TcSpecPrag

Constructors

SpecPrag Id HsWrapper InlinePragma |

Instances

Data TcSpecPrag |
Typeable TcSpecPrag |
Outputable TcSpecPrag |

noSpecPrags :: TcSpecPrags

hasSpecPrags :: TcSpecPrags -> Bool

isDefaultMethod :: TcSpecPrags -> Bool

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

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