ghc-9.2.3: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Parser.Types

Synopsis

Documentation

data SumOrTuple b Source #

Constructors

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)] 

data PatBuilder p Source #

See Note [Ambiguous syntactic categories] and Note [PatBuilder]

Instances

Instances details
DisambECP (PatBuilder GhcPs) Source # 
Instance details

Defined in GHC.Parser.PostProcess

Methods

ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA (PatBuilder GhcPs)) Source #

ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsProjUpdatePV :: SrcSpan -> Located [Located (HsFieldLabel GhcPs)] -> LocatedA (PatBuilder GhcPs) -> Bool -> [AddEpAnn] -> PV (LHsRecProj GhcPs (LocatedA (PatBuilder GhcPs))) Source #

mkHsLamPV :: SrcSpan -> (EpAnnComments -> MatchGroup GhcPs (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsLetPV :: SrcSpan -> HsLocalBinds GhcPs -> LocatedA (PatBuilder GhcPs) -> AnnsLet -> PV (LocatedA (PatBuilder GhcPs)) Source #

superInfixOp :: (DisambInfixOp (InfixOp (PatBuilder GhcPs)) => PV (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsOpAppPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> LocatedN (InfixOp (PatBuilder GhcPs)) -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedL [LMatch GhcPs (LocatedA (PatBuilder GhcPs))] -> EpAnnHsCase -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsLamCasePV :: SrcSpan -> LocatedL [LMatch GhcPs (LocatedA (PatBuilder GhcPs))] -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

superFunArg :: (DisambECP (FunArg (PatBuilder GhcPs)) => PV (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsAppPV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> LocatedA (FunArg (PatBuilder GhcPs)) -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsAppTypePV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> SrcSpan -> LHsType GhcPs -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA (PatBuilder GhcPs) -> Bool -> LocatedA (PatBuilder GhcPs) -> AnnsIf -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedL [LStmt GhcPs (LocatedA (PatBuilder GhcPs))] -> AnnList -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsParPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> AnnParen -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsVarPV :: LocatedN RdrName -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located (PatBuilder GhcPs)) Source #

mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located (PatBuilder GhcPs)) Source #

mkHsWildCardPV :: SrcSpan -> PV (Located (PatBuilder GhcPs)) Source #

mkHsTySigPV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> LHsType GhcPs -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsExplicitListPV :: SrcSpan -> [LocatedA (PatBuilder GhcPs)] -> AnnList -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located (PatBuilder GhcPs)) Source #

mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA (PatBuilder GhcPs) -> ([Fbind (PatBuilder GhcPs)], Maybe SrcSpan) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsNegAppPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp (PatBuilder GhcPs)) -> LocatedA (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) Source #

mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> LocatedA (PatBuilder GhcPs) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> LocatedA (PatBuilder GhcPs) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsLazyPatPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkHsBangPatPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple (PatBuilder GhcPs) -> [AddEpAnn] -> PV (LocatedA (PatBuilder GhcPs)) Source #

rejectPragmaPV :: LocatedA (PatBuilder GhcPs) -> PV () Source #

Outputable (PatBuilder GhcPs) Source # 
Instance details

Defined in GHC.Parser.Types

type Body (PatBuilder GhcPs) Source # 
Instance details

Defined in GHC.Parser.PostProcess

type FunArg (PatBuilder GhcPs) Source # 
Instance details

Defined in GHC.Parser.PostProcess

type InfixOp (PatBuilder GhcPs) Source # 
Instance details

Defined in GHC.Parser.PostProcess

type Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] Source # 
Instance details

Defined in GHC.Parser.PostProcess

type Anno [LocatedA (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs)))] Source # 
Instance details

Defined in GHC.Parser.Types

type Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs))) Source # 
Instance details

Defined in GHC.Parser.PostProcess

type Anno (Match GhcPs (LocatedA (PatBuilder GhcPs))) Source # 
Instance details

Defined in GHC.Parser.PostProcess

type Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs))) Source # 
Instance details

Defined in GHC.Parser.PostProcess

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:

  1. It's faster, because OrdList gives us constant-time snoc.
  2. Having a separate type helps ensure that we don't forget to finalize a RecTy into a RecCon (we do that in dataConBuilderDetails).

See Note [PatBuilder] for another builder type used in the parser. Here the technique is similar, but the motivation is different.