Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data SumOrTuple b
- pprSumOrTuple :: Outputable b => Boxity -> SumOrTuple b -> SDoc
- data PatBuilder p
- = PatBuilderPat (Pat p)
- | PatBuilderPar (EpToken "(") (LocatedA (PatBuilder p)) (EpToken ")")
- | PatBuilderApp (LocatedA (PatBuilder p)) (LocatedA (PatBuilder p))
- | PatBuilderAppType (LocatedA (PatBuilder p)) (EpToken "@") (HsTyPat GhcPs)
- | PatBuilderOpApp (LocatedA (PatBuilder p)) (LocatedN RdrName) (LocatedA (PatBuilder p)) [AddEpAnn]
- | PatBuilderVar (LocatedN RdrName)
- | PatBuilderOverLit (HsOverLit GhcPs)
- data DataConBuilder
Documentation
data SumOrTuple b Source #
pprSumOrTuple :: Outputable b => Boxity -> SumOrTuple b -> SDoc Source #
data PatBuilder p Source #
See Note [Ambiguous syntactic categories] and Note [PatBuilder]
PatBuilderPat (Pat p) | |
PatBuilderPar (EpToken "(") (LocatedA (PatBuilder p)) (EpToken ")") | |
PatBuilderApp (LocatedA (PatBuilder p)) (LocatedA (PatBuilder p)) | |
PatBuilderAppType (LocatedA (PatBuilder p)) (EpToken "@") (HsTyPat GhcPs) | |
PatBuilderOpApp (LocatedA (PatBuilder p)) (LocatedN RdrName) (LocatedA (PatBuilder p)) [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
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 -> EpToken "@" -> 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 # | |
Outputable DataConBuilder Source # | |
Defined in GHC.Parser.Types ppr :: DataConBuilder -> SDoc Source # |