Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data SumOrTuple b
- = Sum ConTag Arity (LocatedA b) [EpaLocation] [EpaLocation]
- | Tuple [Either (EpAnn EpaLocation) (LocatedA b)]
- pprSumOrTuple :: Outputable b => Boxity -> SumOrTuple b -> SDoc
- data PatBuilder p
- = PatBuilderPat (Pat p)
- | PatBuilderPar (LHsToken "(" p) (LocatedA (PatBuilder p)) (LHsToken ")" p)
- | PatBuilderApp (LocatedA (PatBuilder p)) (LocatedA (PatBuilder p))
- | PatBuilderAppType (LocatedA (PatBuilder p)) (HsPatSigType GhcPs)
- | PatBuilderOpApp (LocatedA (PatBuilder p)) (LocatedN RdrName) (LocatedA (PatBuilder p)) (EpAnn [AddEpAnn])
- | PatBuilderVar (LocatedN RdrName)
- | PatBuilderOverLit (HsOverLit GhcPs)
- data DataConBuilder
Documentation
data SumOrTuple b Source #
Sum ConTag Arity (LocatedA b) [EpaLocation] [EpaLocation] | Last two are the locations of the '|' before and after the payload |
Tuple [Either (EpAnn EpaLocation) (LocatedA b)] |
pprSumOrTuple :: Outputable b => Boxity -> SumOrTuple b -> SDoc Source #
data PatBuilder p Source #
See Note [Ambiguous syntactic categories] and Note [PatBuilder]
PatBuilderPat (Pat p) | |
PatBuilderPar (LHsToken "(" p) (LocatedA (PatBuilder p)) (LHsToken ")" p) | |
PatBuilderApp (LocatedA (PatBuilder p)) (LocatedA (PatBuilder p)) | |
PatBuilderAppType (LocatedA (PatBuilder p)) (HsPatSigType GhcPs) | |
PatBuilderOpApp (LocatedA (PatBuilder p)) (LocatedN RdrName) (LocatedA (PatBuilder p)) (EpAnn [AddEpAnn]) | |
PatBuilderVar (LocatedN RdrName) | |
PatBuilderOverLit (HsOverLit GhcPs) |
Instances
data DataConBuilder Source #
An accumulator to build a prefix data constructor,
e.g. when parsing MkT A B C
, the accumulator will evolve as follows:
1. PrefixDataConBuilder [] MkT 2. PrefixDataConBuilder [A] MkT 3. PrefixDataConBuilder [A, B] MkT 4. PrefixDataConBuilder [A, B, C] MkT
There are two reasons we have a separate builder type instead of using
HsConDeclDetails GhcPs
directly:
- It's faster, because
OrdList
gives us constant-time snoc. - Having a separate type helps ensure that we don't forget to finalize a
RecTy
into aRecCon
(we do that indataConBuilderDetails
).
See Note [PatBuilder] for another builder type used in the parser. Here the technique is similar, but the motivation is different.
PrefixDataConBuilder (OrdList (LHsType GhcPs)) (LocatedN RdrName) | |
InfixDataConBuilder (LHsType GhcPs) (LocatedN RdrName) (LHsType GhcPs) |
Instances
Outputable DataConBuilder Source # | |
Defined in GHC.Parser.Types ppr :: DataConBuilder -> SDoc Source # | |
DisambTD DataConBuilder Source # | |
Defined in GHC.Parser.PostProcess mkHsAppTyHeadPV :: LHsType GhcPs -> PV (LocatedA DataConBuilder) Source # mkHsAppTyPV :: LocatedA DataConBuilder -> LHsType GhcPs -> PV (LocatedA DataConBuilder) Source # mkHsAppKindTyPV :: LocatedA DataConBuilder -> SrcSpan -> LHsType GhcPs -> PV (LocatedA DataConBuilder) Source # mkHsOpTyPV :: PromotionFlag -> LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA DataConBuilder) Source # mkUnpackednessPV :: Located UnpackednessPragma -> LocatedA DataConBuilder -> PV (LocatedA DataConBuilder) Source # |