ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Parser.PostProcess

Synopsis

- mkRdrGetField :: LHsExpr GhcPs -> LocatedAn NoEpAnns (DotFieldOcc GhcPs) -> HsExpr GhcPs
- mkRdrProjection :: NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs)) -> AnnProjection -> HsExpr GhcPs
- type Fbind b = Either (LHsRecField GhcPs (LocatedA b)) (LHsRecProj GhcPs (LocatedA b))
- mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
- mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
- mkHsFractional :: FractionalLit -> HsOverLit GhcPs
- mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
- mkHsDo :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> HsExpr GhcPs
- mkMDo :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> EpaLocation -> EpaLocation -> HsExpr GhcPs
- mkSpliceDecl :: LHsExpr GhcPs -> LHsDecl GhcPs
- mkRoleAnnotDecl :: SrcSpan -> LocatedN RdrName -> [Located (Maybe FastString)] -> (EpToken "type", EpToken "role") -> P (LRoleAnnotDecl GhcPs)
- mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a, [LHsFunDep GhcPs]) -> OrdList (LHsDecl GhcPs) -> EpLayout -> AnnClassDecl -> P (LTyClDecl GhcPs)
- mkTyData :: SrcSpan -> Bool -> NewOrData -> Maybe (LocatedP CType) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> AnnDataDefn -> P (LTyClDecl GhcPs)
- mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (LocatedP CType) -> (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs GhcPs, LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> AnnDataDefn -> P (LInstDecl GhcPs)
- mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> EpToken "type" -> EpToken "=" -> P (LTyClDecl GhcPs)
- mkTyFamInstEqn :: SrcSpan -> HsOuterFamEqnTyVarBndrs GhcPs -> LHsType GhcPs -> LHsType GhcPs -> EpToken "=" -> P (LTyFamInstEqn GhcPs)
- mkStandaloneKindSig :: SrcSpan -> Located [LocatedN RdrName] -> LHsSigType GhcPs -> (EpToken "type", TokDcolon) -> P (LStandaloneKindSig GhcPs)
- mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> EpToken "type" -> EpToken "instance" -> P (LInstDecl GhcPs)
- mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> TopLevelFlag -> LHsType GhcPs -> LFamilyResultSig GhcPs -> Maybe (LInjectivityAnn GhcPs) -> AnnFamilyDecl -> P (LTyClDecl GhcPs)
- mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma
- mkOpaquePragma :: SourceText -> InlinePragma
- mkPatSynMatchGroup :: LocatedN RdrName -> LocatedLW (OrdList (LHsDecl GhcPs)) -> P (MatchGroup GhcPs (LHsExpr GhcPs))
- mkRecConstrOrUpdate :: Bool -> LHsExpr GhcPs -> SrcSpan -> ([Fbind (HsExpr GhcPs)], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (HsExpr GhcPs)
- mkTyClD :: forall (p :: Pass). LTyClDecl (GhcPass p) -> LHsDecl (GhcPass p)
- mkInstD :: forall (p :: Pass). LInstDecl (GhcPass p) -> LHsDecl (GhcPass p)
- mkRdrRecordCon :: LocatedN RdrName -> HsRecordBinds GhcPs -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> HsExpr GhcPs
- mkRdrRecordUpd :: Bool -> LHsExpr GhcPs -> [Fbind (HsExpr GhcPs)] -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (HsExpr GhcPs)
- setRdrNameSpace :: RdrName -> NameSpace -> RdrName
- fromSpecTyVarBndr :: LHsTyVarBndr Specificity GhcPs -> P (LHsTyVarBndr () GhcPs)
- fromSpecTyVarBndrs :: [LHsTyVarBndr Specificity GhcPs] -> P [LHsTyVarBndr () GhcPs]
- annBinds :: EpToken "where" -> EpAnnComments -> HsLocalBinds GhcPs -> (HsLocalBinds GhcPs, Maybe EpAnnComments)
- stmtsAnchor :: forall (tok :: Symbol) a. Located (OrdList (EpToken tok), a) -> Maybe EpaLocation
- stmtsLoc :: forall (tok :: Symbol) a. Located (OrdList (EpToken tok), a) -> SrcSpan
- cvBindGroup :: OrdList (LHsDecl GhcPs) -> P (HsValBinds GhcPs)
- cvBindsAndSigs :: OrdList (LHsDecl GhcPs) -> P (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs], [LTyFamInstDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl GhcPs])
- cvTopDecls :: OrdList (LHsDecl GhcPs) -> [LHsDecl GhcPs]
- placeHolderPunRhs :: DisambECP b => PV (LocatedA b)
- mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> (EpToken "import", TokDcolon) -> P (EpToken "foreign" -> HsDecl GhcPs)
- parseCImport :: forall (p :: Pass). LocatedE CCallConv -> LocatedE Safety -> FastString -> String -> Located SourceText -> Maybe (ForeignImport (GhcPass p))
- mkExport :: Located CCallConv -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> (EpToken "export", TokDcolon) -> P (EpToken "foreign" -> HsDecl GhcPs)
- mkExtName :: RdrName -> CLabelString
- mkGadtDecl :: SrcSpan -> NonEmpty (LocatedN RdrName) -> TokDcolon -> LHsSigType GhcPs -> P (LConDecl GhcPs)
- mkConDeclH98 :: (TokDarrow, (TokForall, EpToken ".")) -> LocatedN RdrName -> Maybe [LHsTyVarBndr Specificity GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclH98Details GhcPs -> ConDecl GhcPs
- checkImportDecl :: Maybe (EpToken "qualified") -> Maybe (EpToken "qualified") -> Maybe EpAnnLevel -> Maybe EpAnnLevel -> P ((Maybe (EpToken "qualified"), ImportDeclQualifiedStyle), (Maybe EpAnnLevel, ImportDeclLevelStyle))
- checkExpBlockArguments :: LHsExpr GhcPs -> PV ()
- checkCmdBlockArguments :: LHsCmd GhcPs -> PV ()
- checkPrecP :: Located (SourceText, Int) -> Located (OrdList (LocatedN RdrName)) -> P ()
- checkContext :: LHsType GhcPs -> P (LHsContext GhcPs)
- checkPattern :: LocatedA (PatBuilder GhcPs) -> P (LPat GhcPs)
- checkPattern_details :: ParseContext -> PV (LocatedA (PatBuilder GhcPs)) -> P (LPat GhcPs)
- incompleteDoBlock :: ParseContext
- data ParseContext = ParseContext {
  - is_infix :: !(Maybe RdrName)
  - incomplete_do_block :: !PatIncompleteDoBlock
  }
- checkMonadComp :: PV HsDoFlavour
- checkValDef :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> (HsMultAnn GhcPs, Maybe (TokDcolon, LHsType GhcPs)) -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> P (HsBind GhcPs)
- checkValSigLhs :: LHsExpr GhcPs -> P (LocatedN RdrName)
- type LRuleTyTmVar = LocatedAn NoEpAnns RuleTyTmVar
- data RuleTyTmVar = RuleTyTmVar AnnTyVarBndr (LocatedN RdrName) (Maybe (LHsType GhcPs))
- mkRuleBndrs :: HsRuleBndrsAnn -> Maybe [LRuleTyTmVar] -> [LRuleTyTmVar] -> RuleBndrs GhcPs
- ruleBndrsOrDef :: Maybe (RuleBndrs GhcPs) -> RuleBndrs GhcPs
- checkRuleTyVarBndrNames :: [LRuleTyTmVar] -> P ()
- mkSpecSig :: InlinePragma -> AnnSpecSig -> Maybe (RuleBndrs GhcPs) -> LHsExpr GhcPs -> Maybe (Located (TokDcolon, OrdList (LHsSigType GhcPs))) -> P (Sig GhcPs)
- checkRecordSyntax :: (MonadP m, Outputable a) => LocatedA a -> m (LocatedA a)
- checkEmptyGADTs :: Located ((EpToken "where", EpToken "{", EpToken "}"), [LConDecl GhcPs]) -> P (Located ((EpToken "where", EpToken "{", EpToken "}"), [LConDecl GhcPs]))
- addFatalError :: MonadP m => MsgEnvelope PsMessage -> m a
- hintBangPat :: SrcSpan -> Pat GhcPs -> PV ()
- mkBangTy :: EpaLocation -> SrcStrictness -> LHsType GhcPs -> HsType GhcPs
- data UnpackednessPragma = UnpackednessPragma (EpaLocation, EpToken "#-}") SourceText SrcUnpackedness
- mkMultAnn :: EpToken "%" -> LHsType GhcPs -> EpArrowOrColon -> HsMultAnn GhcPs
- mkMultField :: EpToken "%" -> LHsType GhcPs -> TokDcolon -> LHsType GhcPs -> HsConDeclField GhcPs
- mkConDeclField :: HsMultAnn GhcPs -> LHsType GhcPs -> HsConDeclField GhcPs
- data ImpExpSubSpec
  - = ImpExpAbs
  - | ImpExpAll (EpToken "..")
  - | ImpExpList [LocatedA ImpExpQcSpec]
  - | ImpExpAllWith [LocatedA ImpExpQcSpec]
- data ImpExpQcSpec
  - = ImpExpQcName (Maybe ExplicitNamespaceKeyword) (LocatedN RdrName)
  - | ImpExpQcWildcard (EpToken "..") (EpToken ",")
- mkModuleImpExp :: Maybe (LWarningTxt GhcPs) -> (EpToken "(", EpToken ")") -> LocatedA ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs)
- mkPlainImpExp :: LocatedN RdrName -> ImpExpQcSpec
- mkTypeImpExp :: EpToken "type" -> LocatedN RdrName -> P ImpExpQcSpec
- mkDataImpExp :: EpToken "data" -> LocatedN RdrName -> P ImpExpQcSpec
- mkImpExpSubSpec :: [LocatedA ImpExpQcSpec] -> P ImpExpSubSpec
- checkImportSpec :: LocatedLI [LIE GhcPs] -> P (LocatedLI [LIE GhcPs])
- warnPatternNamespaceSpecifier :: MonadP m => SrcSpan -> m ()
- starSym :: Bool -> FastString
- warnStarIsType :: SrcSpan -> P ()
- warnPrepositiveQualifiedModule :: SrcSpan -> P ()
- failOpFewArgs :: MonadP m => LocatedN RdrName -> m a
- failNotEnabledImportQualifiedPost :: SrcSpan -> P ()
- failImportQualifiedTwice :: SrcSpan -> P ()
- failSpliceOrQuoteTwice :: EpAnnLevel -> P ()
- data SumOrTuple b
  - = Sum ConTag Arity (LocatedA b) [EpToken "|"] [EpToken "|"]
  - | Tuple [Either (EpAnn Bool) (LocatedA b)]
- data PV a
- runPV :: PV a -> P a
- newtype ECP = ECP {
  - unECP :: forall b. DisambECP b => PV (LocatedA b)
  }
- class DisambInfixOp b where
  - mkHsVarOpPV :: LocatedN RdrName -> PV (LocatedN b)
  - mkHsConOpPV :: LocatedN RdrName -> PV (LocatedN b)
  - mkHsInfixHolePV :: LocatedN RdrName -> PV (LocatedN b)
- class (b ~ Body b GhcPs, AnnoBody b) => DisambECP b where
  - type Body b :: Type -> Type
  - type InfixOp b
  - type FunArg b
  - ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA b)
  - ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA b)
  - ecpFromPat' :: LPat GhcPs -> PV (LocatedA b)
  - mkHsProjUpdatePV :: SrcSpan -> Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) -> LocatedA b -> Bool -> Maybe (EpToken "=") -> PV (LHsRecProj GhcPs (LocatedA b))
  - mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA b -> PV (LocatedA b)
  - superInfixOp :: (DisambInfixOp (InfixOp b) => PV (LocatedA b)) -> PV (LocatedA b)
  - mkHsOpAppPV :: SrcSpan -> LocatedA b -> LocatedN (InfixOp b) -> LocatedA b -> PV (LocatedA b)
  - mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedLW [LMatch GhcPs (LocatedA b)] -> EpAnnHsCase -> PV (LocatedA b)
  - mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedLW [LMatch GhcPs (LocatedA b)] -> EpAnnLam -> PV (LocatedA b)
  - superFunArg :: (DisambECP (FunArg b) => PV (LocatedA b)) -> PV (LocatedA b)
  - mkHsAppPV :: SrcSpanAnnA -> LocatedA b -> LocatedA (FunArg b) -> PV (LocatedA b)
  - mkHsAppTypePV :: SrcSpanAnnA -> LocatedA b -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA b)
  - mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA b -> Bool -> LocatedA b -> AnnsIf -> PV (LocatedA b)
  - mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedLW [LStmt GhcPs (LocatedA b)] -> EpaLocation -> EpaLocation -> PV (LocatedA b)
  - mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA b -> EpToken ")" -> PV (LocatedA b)
  - mkHsVarPV :: LocatedN RdrName -> PV (LocatedA b)
  - mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA b)
  - mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a b)
  - mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a b)
  - mkHsTySigPV :: SrcSpanAnnA -> LocatedA b -> LHsType GhcPs -> TokDcolon -> PV (LocatedA b)
  - mkHsExplicitListPV :: SrcSpan -> [LocatedA b] -> AnnList () -> PV (LocatedA b)
  - mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA b)
  - mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA b -> ([Fbind b], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (LocatedA b)
  - mkHsNegAppPV :: SrcSpan -> LocatedA b -> EpToken "-" -> PV (LocatedA b)
  - mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (LocatedA b)
  - mkHsArrowPV :: SrcSpan -> ArrowParsingMode lhs b -> LocatedA lhs -> HsMultAnnOf (LocatedA b) GhcPs -> LocatedA b -> PV (LocatedA b)
  - mkHsMultPV :: EpToken "%" -> LocatedA b -> PV (TokRarrow -> HsMultAnnOf (LocatedA b) GhcPs)
  - mkHsForallPV :: SrcSpan -> HsForAllTelescope GhcPs -> LocatedA b -> PV (LocatedA b)
  - checkContextPV :: LocatedA b -> PV (LocatedC [LocatedA b])
  - mkQualPV :: SrcSpan -> LocatedC [LocatedA b] -> LocatedA b -> PV (LocatedA b)
  - mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA b -> PV (LocatedA b)
  - mkHsLazyPatPV :: SrcSpan -> LocatedA b -> EpToken "~" -> PV (LocatedA b)
  - mkHsBangPatPV :: SrcSpan -> LocatedA b -> EpToken "!" -> PV (LocatedA b)
  - mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple b -> (EpaLocation, EpaLocation) -> PV (LocatedA b)
  - mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA b)
  - rejectPragmaPV :: LocatedA b -> PV ()
- ecpFromExp :: LHsExpr GhcPs -> ECP
- ecpFromCmd :: LHsCmd GhcPs -> ECP
- ecpFromPat :: LPat GhcPs -> ECP
- data ArrowParsingMode lhs rhs where
  - ArrowIsViewPat :: forall rhs. ArrowParsingMode (HsExpr GhcPs) rhs
  - ArrowIsFunType :: forall lhs. ArrowParsingMode lhs lhs
- withArrowParsingMode :: DisambECP b => (forall lhs. DisambECP lhs => ArrowParsingMode lhs b -> PV r) -> PV r
- withArrowParsingMode' :: DisambECP b => (forall lhs. DisambECP lhs => ArrowParsingMode lhs b -> PV (LocatedA b)) -> PV (LocatedA b)
- setTelescopeBndrsNameSpace :: NameSpace -> HsForAllTelescope GhcPs -> HsForAllTelescope GhcPs
- data PatBuilder p
- class DisambTD b where
  - mkHsAppTyHeadPV :: LHsType GhcPs -> PV (LocatedA b)
  - mkHsAppTyPV :: LocatedA b -> LHsType GhcPs -> PV (LocatedA b)
  - mkHsAppKindTyPV :: LocatedA b -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA b)
  - mkHsOpTyPV :: PromotionFlag -> LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA b)
  - mkUnpackednessPV :: Located UnpackednessPragma -> LocatedA b -> PV (LocatedA b)
- addUnpackednessP :: MonadP m => Located UnpackednessPragma -> LHsType GhcPs -> m (LHsType GhcPs)
- dataConBuilderCon :: LocatedA DataConBuilder -> LocatedN RdrName
- dataConBuilderDetails :: LocatedA DataConBuilder -> HsConDeclH98Details GhcPs
- mkUnboxedSumCon :: LHsType GhcPs -> ConTag -> Arity -> (LocatedN RdrName, HsConDeclH98Details GhcPs)
- mkTupleSyntaxTy :: EpToken "(" -> [LocatedA (HsType GhcPs)] -> EpToken ")" -> P (HsType GhcPs)
- mkTupleSyntaxTycon :: Boxity -> Int -> P RdrName
- mkListSyntaxTy0 :: EpToken "[" -> EpToken "]" -> SrcSpan -> P (HsType GhcPs)
- mkListSyntaxTy1 :: EpToken "[" -> LocatedA (HsType GhcPs) -> EpToken "]" -> P (HsType GhcPs)
- withCombinedComments :: (HasLoc l1, HasLoc l2) => l1 -> l2 -> (SrcSpan -> P a) -> P (LocatedA a)
- requireLTPuns :: PsErrPunDetails -> Located a -> Located b -> P ()

# Documentation

mkRdrGetField :: LHsExpr GhcPs -> LocatedAn NoEpAnns (DotFieldOcc GhcPs) -> HsExpr GhcPs #

mkRdrProjection :: NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs)) -> AnnProjection -> HsExpr GhcPs #

type Fbind b = Either (LHsRecField GhcPs (LocatedA b)) (LHsRecProj GhcPs (LocatedA b)) #

mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs #

A useful function for building `OpApps`. The operator is always a variable, and we don't know the fixity yet.

mkHsIntegral :: IntegralLit -> HsOverLit GhcPs #

mkHsFractional :: FractionalLit -> HsOverLit GhcPs #

mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs #

mkHsDo :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> HsExpr GhcPs #

mkMDo :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> EpaLocation -> EpaLocation -> HsExpr GhcPs #

mkSpliceDecl :: LHsExpr GhcPs -> LHsDecl GhcPs #

mkRoleAnnotDecl :: SrcSpan -> LocatedN RdrName -> [Located (Maybe FastString)] -> (EpToken "type", EpToken "role") -> P (LRoleAnnotDecl GhcPs) #

mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a, [LHsFunDep GhcPs]) -> OrdList (LHsDecl GhcPs) -> EpLayout -> AnnClassDecl -> P (LTyClDecl GhcPs) #

mkTyData :: SrcSpan -> Bool -> NewOrData -> Maybe (LocatedP CType) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> AnnDataDefn -> P (LTyClDecl GhcPs) #

mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (LocatedP CType) -> (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs GhcPs, LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> AnnDataDefn -> P (LInstDecl GhcPs) #

mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> EpToken "type" -> EpToken "=" -> P (LTyClDecl GhcPs) #

mkTyFamInstEqn :: SrcSpan -> HsOuterFamEqnTyVarBndrs GhcPs -> LHsType GhcPs -> LHsType GhcPs -> EpToken "=" -> P (LTyFamInstEqn GhcPs) #

mkStandaloneKindSig :: SrcSpan -> Located [LocatedN RdrName] -> LHsSigType GhcPs -> (EpToken "type", TokDcolon) -> P (LStandaloneKindSig GhcPs) #

mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> EpToken "type" -> EpToken "instance" -> P (LInstDecl GhcPs) #

mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> TopLevelFlag -> LHsType GhcPs -> LFamilyResultSig GhcPs -> Maybe (LInjectivityAnn GhcPs) -> AnnFamilyDecl -> P (LTyClDecl GhcPs) #

mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma #

mkOpaquePragma :: SourceText -> InlinePragma #

mkPatSynMatchGroup :: LocatedN RdrName -> LocatedLW (OrdList (LHsDecl GhcPs)) -> P (MatchGroup GhcPs (LHsExpr GhcPs)) #

mkRecConstrOrUpdate :: Bool -> LHsExpr GhcPs -> SrcSpan -> ([Fbind (HsExpr GhcPs)], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (HsExpr GhcPs) #

mkTyClD :: forall (p :: Pass). LTyClDecl (GhcPass p) -> LHsDecl (GhcPass p) #

mkClassDecl builds a RdrClassDecl, filling in the names for tycon and datacon by deriving them from the name of the class. We fill in the names for the tycon and datacon corresponding to the class, by deriving them from the name of the class itself. This saves recording the names in the interface file (which would be equally good).

mkInstD :: forall (p :: Pass). LInstDecl (GhcPass p) -> LHsDecl (GhcPass p) #

mkRdrRecordCon :: LocatedN RdrName -> HsRecordBinds GhcPs -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> HsExpr GhcPs #

mkRdrRecordUpd :: Bool -> LHsExpr GhcPs -> [Fbind (HsExpr GhcPs)] -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (HsExpr GhcPs) #

setRdrNameSpace :: RdrName -> NameSpace -> RdrName #

This rather gruesome function is used mainly by the parser.

Case #1. When parsing:

    data T a = T | T1 Int

we parse the data constructors as types because of parser ambiguities, so then we need to change the type constr to a data constr

The exact-name case can occur when parsing:

    data [] a = [] | a : [a]

For the exact-name case we return an original name.

Case #2. When parsing:

    x = fn (forall a. a)   -- RequiredTypeArguments

we use setRdrNameSpace to set the namespace of forall-bound variables.

fromSpecTyVarBndr :: LHsTyVarBndr Specificity GhcPs -> P (LHsTyVarBndr () GhcPs) #

Converts `LHsTyVarBndr` annotated with its `Specificity` to one without annotations. Only accepts specified variables, and errors if the provided binder has an `InferredSpec` annotation.

fromSpecTyVarBndrs :: [LHsTyVarBndr Specificity GhcPs] -> P [LHsTyVarBndr () GhcPs] #

Converts a list of `LHsTyVarBndr`s annotated with their `Specificity` to binders without annotations. Only accepts specified variables, and errors if any of the provided binders has an `InferredSpec` annotation.

annBinds :: EpToken "where" -> EpAnnComments -> HsLocalBinds GhcPs -> (HsLocalBinds GhcPs, Maybe EpAnnComments) #

Add the annotation for a 'where' keyword to existing `HsLocalBinds`

stmtsAnchor :: forall (tok :: Symbol) a. Located (OrdList (EpToken tok), a) -> Maybe EpaLocation #

The anchor for a stmtlist is based on either the location or the first semicolon annotion.

stmtsLoc :: forall (tok :: Symbol) a. Located (OrdList (EpToken tok), a) -> SrcSpan #

cvBindGroup :: OrdList (LHsDecl GhcPs) -> P (HsValBinds GhcPs) #

cvBindsAndSigs :: OrdList (LHsDecl GhcPs) -> P (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs], [LTyFamInstDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl GhcPs]) #

cvTopDecls :: OrdList (LHsDecl GhcPs) -> [LHsDecl GhcPs] #

Function definitions are restructured here. Each is assumed to be recursive initially, and non recursive definitions are discovered by the dependency analyser.

placeHolderPunRhs :: DisambECP b => PV (LocatedA b) #

mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> (EpToken "import", TokDcolon) -> P (EpToken "foreign" -> HsDecl GhcPs) #

parseCImport :: forall (p :: Pass). LocatedE CCallConv -> LocatedE Safety -> FastString -> String -> Located SourceText -> Maybe (ForeignImport (GhcPass p)) #

mkExport :: Located CCallConv -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> (EpToken "export", TokDcolon) -> P (EpToken "foreign" -> HsDecl GhcPs) #

mkExtName :: RdrName -> CLabelString #

mkGadtDecl :: SrcSpan -> NonEmpty (LocatedN RdrName) -> TokDcolon -> LHsSigType GhcPs -> P (LConDecl GhcPs) #

Construct a GADT-style data constructor from the constructor names and their type. Some interesting aspects of this function:

- This splits up the constructor type into its quantified type variables (if provided), context (if provided), argument types, and result type, and records whether this is a prefix or record GADT constructor. See Note [GADT abstract syntax] in GHC.Hs.Decls for more details.

mkConDeclH98 :: (TokDarrow, (TokForall, EpToken ".")) -> LocatedN RdrName -> Maybe [LHsTyVarBndr Specificity GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclH98Details GhcPs -> ConDecl GhcPs #

checkImportDecl :: Maybe (EpToken "qualified") -> Maybe (EpToken "qualified") -> Maybe EpAnnLevel -> Maybe EpAnnLevel -> P ((Maybe (EpToken "qualified"), ImportDeclQualifiedStyle), (Maybe EpAnnLevel, ImportDeclLevelStyle)) #

checkExpBlockArguments :: LHsExpr GhcPs -> PV () #

Yield a parse error if we have a function applied directly to a do block etc. and BlockArguments is not enabled.

checkCmdBlockArguments :: LHsCmd GhcPs -> PV () #

checkPrecP #

Arguments

:: Located (SourceText, Int) | precedence
-> Located (OrdList (LocatedN RdrName)) | operators
-> P () |

Check if a fixity is valid. We support bypassing the usual bound checks for some special operators.

checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) #

Validate the context constraints and break up a context into a list of predicates.

        (Eq a, Ord b)        -->  [Eq a, Ord b]
        Eq a                 -->  [Eq a]
        (Eq a)               -->  [Eq a]
        (((Eq a)))           -->  [Eq a]

checkPattern :: LocatedA (PatBuilder GhcPs) -> P (LPat GhcPs) #

checkPattern_details :: ParseContext -> PV (LocatedA (PatBuilder GhcPs)) -> P (LPat GhcPs) #

incompleteDoBlock :: ParseContext #

data ParseContext #

Extra information for the expression GHC is currently inspecting/parsing. It can be used to generate more informative parser diagnostics and hints.

Constructors

ParseContext |
Fields is_infix :: !(Maybe RdrName) If `Just`, this is an infix pattern with the bound operator name incomplete_do_block :: !PatIncompleteDoBlock Did the parser likely fail due to an incomplete do block?

#### Instances

Instances details

Eq ParseContext # |
Instance details Defined in GHC.Parser.Errors.Types Methods (==) :: ParseContext -> ParseContext -> Bool # (/=) :: ParseContext -> ParseContext -> Bool #

checkMonadComp :: PV HsDoFlavour #

Check for monad comprehensions

If the flag MonadComprehensions is set, return a `MonadComp` context, otherwise use the usual `ListComp` context

checkValDef :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> (HsMultAnn GhcPs, Maybe (TokDcolon, LHsType GhcPs)) -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> P (HsBind GhcPs) #

checkValSigLhs :: LHsExpr GhcPs -> P (LocatedN RdrName) #

type LRuleTyTmVar = LocatedAn NoEpAnns RuleTyTmVar #

data RuleTyTmVar #

Essentially a wrapper for a `RuleBndr GhcPs`

Constructors

RuleTyTmVar AnnTyVarBndr (LocatedN RdrName) (Maybe (LHsType GhcPs)) |

mkRuleBndrs :: HsRuleBndrsAnn -> Maybe [LRuleTyTmVar] -> [LRuleTyTmVar] -> RuleBndrs GhcPs #

ruleBndrsOrDef :: Maybe (RuleBndrs GhcPs) -> RuleBndrs GhcPs #

checkRuleTyVarBndrNames :: [LRuleTyTmVar] -> P () #

mkSpecSig :: InlinePragma -> AnnSpecSig -> Maybe (RuleBndrs GhcPs) -> LHsExpr GhcPs -> Maybe (Located (TokDcolon, OrdList (LHsSigType GhcPs))) -> P (Sig GhcPs) #

Deal with both old-form and new-form specialise pragmas, using the new `SpecSigE` form unless there are multiple comma-separated type signatures, in which case we use the old-form.

See Note [Overview of SPECIALISE pragmas] in GHC.Tc.Gen.Sig.

checkRecordSyntax :: (MonadP m, Outputable a) => LocatedA a -> m (LocatedA a) #

checkEmptyGADTs :: Located ((EpToken "where", EpToken "{", EpToken "}"), [LConDecl GhcPs]) -> P (Located ((EpToken "where", EpToken "{", EpToken "}"), [LConDecl GhcPs])) #

Check if the gadt_constrlist is empty. Only raise parse error for `data T where` to avoid affecting existing error message, see #8258.

addFatalError :: MonadP m => MsgEnvelope PsMessage -> m a #

Add a fatal error. This will be the last error reported by the parser, and the parser will not produce any result, ending in a `PFailed` state.

hintBangPat :: SrcSpan -> Pat GhcPs -> PV () #

Hint about bang patterns, assuming `BangPatterns` is off.

mkBangTy :: EpaLocation -> SrcStrictness -> LHsType GhcPs -> HsType GhcPs #

data UnpackednessPragma #

Result of parsing `{-# UNPACK #-}` or `{-# NOUNPACK #-}`.

Constructors

UnpackednessPragma (EpaLocation, EpToken "#-}") SourceText SrcUnpackedness |

mkMultAnn :: EpToken "%" -> LHsType GhcPs -> EpArrowOrColon -> HsMultAnn GhcPs #

mkMultField :: EpToken "%" -> LHsType GhcPs -> TokDcolon -> LHsType GhcPs -> HsConDeclField GhcPs #

mkConDeclField :: HsMultAnn GhcPs -> LHsType GhcPs -> HsConDeclField GhcPs #

data ImpExpSubSpec #

Constructors

ImpExpAbs |
ImpExpAll (EpToken "..") |
ImpExpList [LocatedA ImpExpQcSpec] |
ImpExpAllWith [LocatedA ImpExpQcSpec] |

data ImpExpQcSpec #

Constructors

ImpExpQcName (Maybe ExplicitNamespaceKeyword) (LocatedN RdrName) |
ImpExpQcWildcard (EpToken "..") (EpToken ",") |

mkModuleImpExp :: Maybe (LWarningTxt GhcPs) -> (EpToken "(", EpToken ")") -> LocatedA ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs) #

mkPlainImpExp :: LocatedN RdrName -> ImpExpQcSpec #

mkTypeImpExp :: EpToken "type" -> LocatedN RdrName -> P ImpExpQcSpec #

mkDataImpExp :: EpToken "data" -> LocatedN RdrName -> P ImpExpQcSpec #

mkImpExpSubSpec :: [LocatedA ImpExpQcSpec] -> P ImpExpSubSpec #

checkImportSpec :: LocatedLI [LIE GhcPs] -> P (LocatedLI [LIE GhcPs]) #

warnPatternNamespaceSpecifier :: MonadP m => SrcSpan -> m () #

starSym :: Bool -> FastString #

warnStarIsType :: SrcSpan -> P () #

warnPrepositiveQualifiedModule :: SrcSpan -> P () #

failOpFewArgs :: MonadP m => LocatedN RdrName -> m a #

failNotEnabledImportQualifiedPost :: SrcSpan -> P () #

failImportQualifiedTwice :: SrcSpan -> P () #

failSpliceOrQuoteTwice :: EpAnnLevel -> P () #

data SumOrTuple b #

Constructors

Sum ConTag Arity (LocatedA b) [EpToken "|"] [EpToken "|"] | Last two are the locations of the '|' before and after the payload
Tuple [Either (EpAnn Bool) (LocatedA b)] |

data PV a #

#### Instances

Instances details

Applicative PV # |
Instance details Defined in GHC.Parser.PostProcess Methods pure :: a -> PV a # (<*>) :: PV (a -> b) -> PV a -> PV b # liftA2 :: (a -> b -> c) -> PV a -> PV b -> PV c # (*>) :: PV a -> PV b -> PV b # (<*) :: PV a -> PV b -> PV a #
Functor PV # |
Instance details Defined in GHC.Parser.PostProcess Methods fmap :: (a -> b) -> PV a -> PV b # (<$) :: a -> PV b -> PV a #
Monad PV # |
Instance details Defined in GHC.Parser.PostProcess Methods (>>=) :: PV a -> (a -> PV b) -> PV b # (>>) :: PV a -> PV b -> PV b # return :: a -> PV a #
MonadP PV # |
Instance details Defined in GHC.Parser.PostProcess Methods addError :: MsgEnvelope PsMessage -> PV () # addWarning :: MsgEnvelope PsMessage -> PV () # addFatalError :: MsgEnvelope PsMessage -> PV a # getParserOpts :: PV ParserOpts # allocateCommentsP :: RealSrcSpan -> PV EpAnnComments # allocatePriorCommentsP :: RealSrcSpan -> PV EpAnnComments # allocateFinalCommentsP :: RealSrcSpan -> PV EpAnnComments #

runPV :: PV a -> P a #

newtype ECP #

Constructors

ECP |
Fields unECP :: forall b. DisambECP b => PV (LocatedA b)

class DisambInfixOp b where #

Disambiguate infix operators. See Note [Ambiguous syntactic categories]

Methods

mkHsVarOpPV :: LocatedN RdrName -> PV (LocatedN b) #

mkHsConOpPV :: LocatedN RdrName -> PV (LocatedN b) #

mkHsInfixHolePV :: LocatedN RdrName -> PV (LocatedN b) #

#### Instances

Instances details

DisambInfixOp RdrName # |
Instance details Defined in GHC.Parser.PostProcess Methods mkHsVarOpPV :: LocatedN RdrName -> PV (LocatedN RdrName) # mkHsConOpPV :: LocatedN RdrName -> PV (LocatedN RdrName) # mkHsInfixHolePV :: LocatedN RdrName -> PV (LocatedN RdrName) #
DisambInfixOp (HsExpr GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess Methods mkHsVarOpPV :: LocatedN RdrName -> PV (LocatedN (HsExpr GhcPs)) # mkHsConOpPV :: LocatedN RdrName -> PV (LocatedN (HsExpr GhcPs)) # mkHsInfixHolePV :: LocatedN RdrName -> PV (LocatedN (HsExpr GhcPs)) #

class (b ~ Body b GhcPs, AnnoBody b) => DisambECP b where #

Disambiguate constructs that may appear when we do not know ahead of time whether we are parsing an expression, a command, or a pattern. See Note [Ambiguous syntactic categories]

Associated Types

type Body b :: Type -> Type #

See Note [Body in DisambECP]

type InfixOp b #

Infix operator representation

type FunArg b #

Function argument representation

Methods

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

Return a command without ambiguity, or fail in a non-command context.

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

Return an expression without ambiguity, or fail in a non-expression context.

ecpFromPat' :: LPat GhcPs -> PV (LocatedA b) #

Return a pattern without ambiguity, or fail in a non-pattern context.

mkHsProjUpdatePV :: SrcSpan -> Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) -> LocatedA b -> Bool -> Maybe (EpToken "=") -> PV (LHsRecProj GhcPs (LocatedA b)) #

mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA b -> PV (LocatedA b) #

Disambiguate "let ... in ..."

superInfixOp :: (DisambInfixOp (InfixOp b) => PV (LocatedA b)) -> PV (LocatedA b) #

Bring superclass constraints on InfixOp into scope. See Note [UndecidableSuperClasses for associated types]

mkHsOpAppPV :: SrcSpan -> LocatedA b -> LocatedN (InfixOp b) -> LocatedA b -> PV (LocatedA b) #

Disambiguate "f # x" (infix operator)

mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedLW [LMatch GhcPs (LocatedA b)] -> EpAnnHsCase -> PV (LocatedA b) #

Disambiguate "case ... of ..."

mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedLW [LMatch GhcPs (LocatedA b)] -> EpAnnLam -> PV (LocatedA b) #

Disambiguate "... -> ..." (lambda), "case" and "cases"

superFunArg :: (DisambECP (FunArg b) => PV (LocatedA b)) -> PV (LocatedA b) #

Bring superclass constraints on FunArg into scope. See Note [UndecidableSuperClasses for associated types]

mkHsAppPV :: SrcSpanAnnA -> LocatedA b -> LocatedA (FunArg b) -> PV (LocatedA b) #

Disambiguate "f x" (function application)

mkHsAppTypePV :: SrcSpanAnnA -> LocatedA b -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA b) #

Disambiguate "f @t" (visible type application)

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

Disambiguate "if ... then ... else ..."

mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedLW [LStmt GhcPs (LocatedA b)] -> EpaLocation -> EpaLocation -> PV (LocatedA b) #

Disambiguate "do { ... }" (do notation)

mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA b -> EpToken ")" -> PV (LocatedA b) #

Disambiguate "( ... )" (parentheses)

mkHsVarPV :: LocatedN RdrName -> PV (LocatedA b) #

Disambiguate a variable "f" or a data constructor MkF.

mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA b) #

Disambiguate a monomorphic literal

mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a b) #

Disambiguate an overloaded literal

mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a b) #

Disambiguate a wildcard

mkHsTySigPV :: SrcSpanAnnA -> LocatedA b -> LHsType GhcPs -> TokDcolon -> PV (LocatedA b) #

Disambiguate "a :: t" (type annotation)

mkHsExplicitListPV :: SrcSpan -> [LocatedA b] -> AnnList () -> PV (LocatedA b) #

Disambiguate "[a,b,c]" (list syntax)

mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA b) #

Disambiguate "$(...)" and "[quasi|...|]" (TH splices)

mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA b -> ([Fbind b], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (LocatedA b) #

Disambiguate "f { a = b, ... }" syntax (record construction and record updates)

mkHsNegAppPV :: SrcSpan -> LocatedA b -> EpToken "-" -> PV (LocatedA b) #

Disambiguate "-a" (negation)

mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (LocatedA b) #

Disambiguate "(# a)" (right operator section)

mkHsArrowPV :: SrcSpan -> ArrowParsingMode lhs b -> LocatedA lhs -> HsMultAnnOf (LocatedA b) GhcPs -> LocatedA b -> PV (LocatedA b) #

Disambiguate "(a -> b)" (view pattern or function type arrow)

mkHsMultPV :: EpToken "%" -> LocatedA b -> PV (TokRarrow -> HsMultAnnOf (LocatedA b) GhcPs) #

Disambiguate "%m" to the left of "->" (multiplicity)

mkHsForallPV :: SrcSpan -> HsForAllTelescope GhcPs -> LocatedA b -> PV (LocatedA b) #

Disambiguate "forall a. b" and "forall a -> b" (forall telescope)

checkContextPV :: LocatedA b -> PV (LocatedC [LocatedA b]) #

Disambiguate "(a,b,c)" to the left of "=>" (constraint list)

mkQualPV :: SrcSpan -> LocatedC [LocatedA b] -> LocatedA b -> PV (LocatedA b) #

Disambiguate "a => b" (constraint context)

mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA b -> PV (LocatedA b) #

Disambiguate "a@b" (as-pattern)

mkHsLazyPatPV :: SrcSpan -> LocatedA b -> EpToken "~" -> PV (LocatedA b) #

Disambiguate "~a" (lazy pattern)

mkHsBangPatPV :: SrcSpan -> LocatedA b -> EpToken "!" -> PV (LocatedA b) #

Disambiguate "!a" (bang pattern)

mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple b -> (EpaLocation, EpaLocation) -> PV (LocatedA b) #

Disambiguate tuple sections and unboxed sums

mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA b) #

Disambiguate "type t" (embedded type)

rejectPragmaPV :: LocatedA b -> PV () #

Validate infixexp LHS to reject unwanted {-# SCC ... #-} pragmas

#### Instances

Instances details

DisambECP (PatBuilder GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess Associated Types
type Body (PatBuilder GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type Body (PatBuilder GhcPs) = PatBuilder
type InfixOp (PatBuilder GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type InfixOp (PatBuilder GhcPs) = RdrName
type FunArg (PatBuilder GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type FunArg (PatBuilder GhcPs) = PatBuilder GhcPs
Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # ecpFromPat' :: LPat GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # mkHsProjUpdatePV :: SrcSpan -> Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) -> LocatedA (PatBuilder GhcPs) -> Bool -> Maybe (EpToken "=") -> PV (LHsRecProj GhcPs (LocatedA (PatBuilder GhcPs))) # mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # superInfixOp :: (DisambInfixOp (InfixOp (PatBuilder GhcPs)) => PV (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsOpAppPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> LocatedN (InfixOp (PatBuilder GhcPs)) -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedLW [LMatch GhcPs (LocatedA (PatBuilder GhcPs))] -> EpAnnHsCase -> PV (LocatedA (PatBuilder GhcPs)) # mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedLW [LMatch GhcPs (LocatedA (PatBuilder GhcPs))] -> EpAnnLam -> PV (LocatedA (PatBuilder GhcPs)) # superFunArg :: (DisambECP (FunArg (PatBuilder GhcPs)) => PV (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsAppPV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> LocatedA (FunArg (PatBuilder GhcPs)) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsAppTypePV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA (PatBuilder GhcPs) -> Bool -> LocatedA (PatBuilder GhcPs) -> AnnsIf -> PV (LocatedA (PatBuilder GhcPs)) # mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedLW [LStmt GhcPs (LocatedA (PatBuilder GhcPs))] -> EpaLocation -> EpaLocation -> PV (LocatedA (PatBuilder GhcPs)) # mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA (PatBuilder GhcPs) -> EpToken ")" -> PV (LocatedA (PatBuilder GhcPs)) # mkHsVarPV :: LocatedN RdrName -> PV (LocatedA (PatBuilder GhcPs)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a (PatBuilder GhcPs)) # mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a (PatBuilder GhcPs)) # mkHsTySigPV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> LHsType GhcPs -> TokDcolon -> PV (LocatedA (PatBuilder GhcPs)) # mkHsExplicitListPV :: SrcSpan -> [LocatedA (PatBuilder GhcPs)] -> AnnList () -> PV (LocatedA (PatBuilder GhcPs)) # mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA (PatBuilder GhcPs) -> ([Fbind (PatBuilder GhcPs)], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsNegAppPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> EpToken "-" -> PV (LocatedA (PatBuilder GhcPs)) # mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp (PatBuilder GhcPs)) -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsArrowPV :: SrcSpan -> ArrowParsingMode lhs (PatBuilder GhcPs) -> LocatedA lhs -> HsMultAnnOf (LocatedA (PatBuilder GhcPs)) GhcPs -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsMultPV :: EpToken "%" -> LocatedA (PatBuilder GhcPs) -> PV (TokRarrow -> HsMultAnnOf (LocatedA (PatBuilder GhcPs)) GhcPs) # mkHsForallPV :: SrcSpan -> HsForAllTelescope GhcPs -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # checkContextPV :: LocatedA (PatBuilder GhcPs) -> PV (LocatedC [LocatedA (PatBuilder GhcPs)]) # mkQualPV :: SrcSpan -> LocatedC [LocatedA (PatBuilder GhcPs)] -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsLazyPatPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> EpToken "~" -> PV (LocatedA (PatBuilder GhcPs)) # mkHsBangPatPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> EpToken "!" -> PV (LocatedA (PatBuilder GhcPs)) # mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple (PatBuilder GhcPs) -> (EpaLocation, EpaLocation) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # rejectPragmaPV :: LocatedA (PatBuilder GhcPs) -> PV () #
DisambECP (HsCmd GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess Associated Types
type Body (HsCmd GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type Body (HsCmd GhcPs) = HsCmd
type InfixOp (HsCmd GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type InfixOp (HsCmd GhcPs) = HsExpr GhcPs
type FunArg (HsCmd GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type FunArg (HsCmd GhcPs) = HsExpr GhcPs
Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA (HsCmd GhcPs)) # ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA (HsCmd GhcPs)) # ecpFromPat' :: LPat GhcPs -> PV (LocatedA (HsCmd GhcPs)) # mkHsProjUpdatePV :: SrcSpan -> Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) -> LocatedA (HsCmd GhcPs) -> Bool -> Maybe (EpToken "=") -> PV (LHsRecProj GhcPs (LocatedA (HsCmd GhcPs))) # mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # superInfixOp :: (DisambInfixOp (InfixOp (HsCmd GhcPs)) => PV (LocatedA (HsCmd GhcPs))) -> PV (LocatedA (HsCmd GhcPs)) # mkHsOpAppPV :: SrcSpan -> LocatedA (HsCmd GhcPs) -> LocatedN (InfixOp (HsCmd GhcPs)) -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedLW [LMatch GhcPs (LocatedA (HsCmd GhcPs))] -> EpAnnHsCase -> PV (LocatedA (HsCmd GhcPs)) # mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedLW [LMatch GhcPs (LocatedA (HsCmd GhcPs))] -> EpAnnLam -> PV (LocatedA (HsCmd GhcPs)) # superFunArg :: (DisambECP (FunArg (HsCmd GhcPs)) => PV (LocatedA (HsCmd GhcPs))) -> PV (LocatedA (HsCmd GhcPs)) # mkHsAppPV :: SrcSpanAnnA -> LocatedA (HsCmd GhcPs) -> LocatedA (FunArg (HsCmd GhcPs)) -> PV (LocatedA (HsCmd GhcPs)) # mkHsAppTypePV :: SrcSpanAnnA -> LocatedA (HsCmd GhcPs) -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA (HsCmd GhcPs)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA (HsCmd GhcPs) -> Bool -> LocatedA (HsCmd GhcPs) -> AnnsIf -> PV (LocatedA (HsCmd GhcPs)) # mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedLW [LStmt GhcPs (LocatedA (HsCmd GhcPs))] -> EpaLocation -> EpaLocation -> PV (LocatedA (HsCmd GhcPs)) # mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA (HsCmd GhcPs) -> EpToken ")" -> PV (LocatedA (HsCmd GhcPs)) # mkHsVarPV :: LocatedN RdrName -> PV (LocatedA (HsCmd GhcPs)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a (HsCmd GhcPs)) # mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a (HsCmd GhcPs)) # mkHsTySigPV :: SrcSpanAnnA -> LocatedA (HsCmd GhcPs) -> LHsType GhcPs -> TokDcolon -> PV (LocatedA (HsCmd GhcPs)) # mkHsExplicitListPV :: SrcSpan -> [LocatedA (HsCmd GhcPs)] -> AnnList () -> PV (LocatedA (HsCmd GhcPs)) # mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA (HsCmd GhcPs) -> ([Fbind (HsCmd GhcPs)], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (LocatedA (HsCmd GhcPs)) # mkHsNegAppPV :: SrcSpan -> LocatedA (HsCmd GhcPs) -> EpToken "-" -> PV (LocatedA (HsCmd GhcPs)) # mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp (HsCmd GhcPs)) -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsArrowPV :: SrcSpan -> ArrowParsingMode lhs (HsCmd GhcPs) -> LocatedA lhs -> HsMultAnnOf (LocatedA (HsCmd GhcPs)) GhcPs -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsMultPV :: EpToken "%" -> LocatedA (HsCmd GhcPs) -> PV (TokRarrow -> HsMultAnnOf (LocatedA (HsCmd GhcPs)) GhcPs) # mkHsForallPV :: SrcSpan -> HsForAllTelescope GhcPs -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # checkContextPV :: LocatedA (HsCmd GhcPs) -> PV (LocatedC [LocatedA (HsCmd GhcPs)]) # mkQualPV :: SrcSpan -> LocatedC [LocatedA (HsCmd GhcPs)] -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA (HsCmd GhcPs) -> PV (LocatedA (HsCmd GhcPs)) # mkHsLazyPatPV :: SrcSpan -> LocatedA (HsCmd GhcPs) -> EpToken "~" -> PV (LocatedA (HsCmd GhcPs)) # mkHsBangPatPV :: SrcSpan -> LocatedA (HsCmd GhcPs) -> EpToken "!" -> PV (LocatedA (HsCmd GhcPs)) # mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple (HsCmd GhcPs) -> (EpaLocation, EpaLocation) -> PV (LocatedA (HsCmd GhcPs)) # mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA (HsCmd GhcPs)) # rejectPragmaPV :: LocatedA (HsCmd GhcPs) -> PV () #
DisambECP (HsExpr GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess Associated Types
type Body (HsExpr GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type Body (HsExpr GhcPs) = HsExpr
type InfixOp (HsExpr GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type InfixOp (HsExpr GhcPs) = HsExpr GhcPs
type FunArg (HsExpr GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type FunArg (HsExpr GhcPs) = HsExpr GhcPs
Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA (HsExpr GhcPs)) # ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA (HsExpr GhcPs)) # ecpFromPat' :: LPat GhcPs -> PV (LocatedA (HsExpr GhcPs)) # mkHsProjUpdatePV :: SrcSpan -> Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) -> LocatedA (HsExpr GhcPs) -> Bool -> Maybe (EpToken "=") -> PV (LHsRecProj GhcPs (LocatedA (HsExpr GhcPs))) # mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # superInfixOp :: (DisambInfixOp (InfixOp (HsExpr GhcPs)) => PV (LocatedA (HsExpr GhcPs))) -> PV (LocatedA (HsExpr GhcPs)) # mkHsOpAppPV :: SrcSpan -> LocatedA (HsExpr GhcPs) -> LocatedN (InfixOp (HsExpr GhcPs)) -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedLW [LMatch GhcPs (LocatedA (HsExpr GhcPs))] -> EpAnnHsCase -> PV (LocatedA (HsExpr GhcPs)) # mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedLW [LMatch GhcPs (LocatedA (HsExpr GhcPs))] -> EpAnnLam -> PV (LocatedA (HsExpr GhcPs)) # superFunArg :: (DisambECP (FunArg (HsExpr GhcPs)) => PV (LocatedA (HsExpr GhcPs))) -> PV (LocatedA (HsExpr GhcPs)) # mkHsAppPV :: SrcSpanAnnA -> LocatedA (HsExpr GhcPs) -> LocatedA (FunArg (HsExpr GhcPs)) -> PV (LocatedA (HsExpr GhcPs)) # mkHsAppTypePV :: SrcSpanAnnA -> LocatedA (HsExpr GhcPs) -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA (HsExpr GhcPs)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA (HsExpr GhcPs) -> Bool -> LocatedA (HsExpr GhcPs) -> AnnsIf -> PV (LocatedA (HsExpr GhcPs)) # mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedLW [LStmt GhcPs (LocatedA (HsExpr GhcPs))] -> EpaLocation -> EpaLocation -> PV (LocatedA (HsExpr GhcPs)) # mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA (HsExpr GhcPs) -> EpToken ")" -> PV (LocatedA (HsExpr GhcPs)) # mkHsVarPV :: LocatedN RdrName -> PV (LocatedA (HsExpr GhcPs)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a (HsExpr GhcPs)) # mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a (HsExpr GhcPs)) # mkHsTySigPV :: SrcSpanAnnA -> LocatedA (HsExpr GhcPs) -> LHsType GhcPs -> TokDcolon -> PV (LocatedA (HsExpr GhcPs)) # mkHsExplicitListPV :: SrcSpan -> [LocatedA (HsExpr GhcPs)] -> AnnList () -> PV (LocatedA (HsExpr GhcPs)) # mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA (HsExpr GhcPs) -> ([Fbind (HsExpr GhcPs)], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (LocatedA (HsExpr GhcPs)) # mkHsNegAppPV :: SrcSpan -> LocatedA (HsExpr GhcPs) -> EpToken "-" -> PV (LocatedA (HsExpr GhcPs)) # mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp (HsExpr GhcPs)) -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsArrowPV :: SrcSpan -> ArrowParsingMode lhs (HsExpr GhcPs) -> LocatedA lhs -> HsMultAnnOf (LocatedA (HsExpr GhcPs)) GhcPs -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsMultPV :: EpToken "%" -> LocatedA (HsExpr GhcPs) -> PV (TokRarrow -> HsMultAnnOf (LocatedA (HsExpr GhcPs)) GhcPs) # mkHsForallPV :: SrcSpan -> HsForAllTelescope GhcPs -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # checkContextPV :: LocatedA (HsExpr GhcPs) -> PV (LocatedC [LocatedA (HsExpr GhcPs)]) # mkQualPV :: SrcSpan -> LocatedC [LocatedA (HsExpr GhcPs)] -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA (HsExpr GhcPs) -> PV (LocatedA (HsExpr GhcPs)) # mkHsLazyPatPV :: SrcSpan -> LocatedA (HsExpr GhcPs) -> EpToken "~" -> PV (LocatedA (HsExpr GhcPs)) # mkHsBangPatPV :: SrcSpan -> LocatedA (HsExpr GhcPs) -> EpToken "!" -> PV (LocatedA (HsExpr GhcPs)) # mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple (HsExpr GhcPs) -> (EpaLocation, EpaLocation) -> PV (LocatedA (HsExpr GhcPs)) # mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA (HsExpr GhcPs)) # rejectPragmaPV :: LocatedA (HsExpr GhcPs) -> PV () #

ecpFromExp :: LHsExpr GhcPs -> ECP #

ecpFromCmd :: LHsCmd GhcPs -> ECP #

ecpFromPat :: LPat GhcPs -> ECP #

data ArrowParsingMode lhs rhs where #

Constructors

ArrowIsViewPat :: forall rhs. ArrowParsingMode (HsExpr GhcPs) rhs |
ArrowIsFunType :: forall lhs. ArrowParsingMode lhs lhs |

withArrowParsingMode :: DisambECP b => (forall lhs. DisambECP lhs => ArrowParsingMode lhs b -> PV r) -> PV r #

withArrowParsingMode' :: DisambECP b => (forall lhs. DisambECP lhs => ArrowParsingMode lhs b -> PV (LocatedA b)) -> PV (LocatedA b) #

setTelescopeBndrsNameSpace :: NameSpace -> HsForAllTelescope GhcPs -> HsForAllTelescope GhcPs #

data PatBuilder p #

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

#### Instances

Instances details

DisambECP (PatBuilder GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess Associated Types
type Body (PatBuilder GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type Body (PatBuilder GhcPs) = PatBuilder
type InfixOp (PatBuilder GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type InfixOp (PatBuilder GhcPs) = RdrName
type FunArg (PatBuilder GhcPs) |
Instance details Defined in GHC.Parser.PostProcess type FunArg (PatBuilder GhcPs) = PatBuilder GhcPs
Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # ecpFromPat' :: LPat GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # mkHsProjUpdatePV :: SrcSpan -> Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) -> LocatedA (PatBuilder GhcPs) -> Bool -> Maybe (EpToken "=") -> PV (LHsRecProj GhcPs (LocatedA (PatBuilder GhcPs))) # mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # superInfixOp :: (DisambInfixOp (InfixOp (PatBuilder GhcPs)) => PV (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsOpAppPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> LocatedN (InfixOp (PatBuilder GhcPs)) -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedLW [LMatch GhcPs (LocatedA (PatBuilder GhcPs))] -> EpAnnHsCase -> PV (LocatedA (PatBuilder GhcPs)) # mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedLW [LMatch GhcPs (LocatedA (PatBuilder GhcPs))] -> EpAnnLam -> PV (LocatedA (PatBuilder GhcPs)) # superFunArg :: (DisambECP (FunArg (PatBuilder GhcPs)) => PV (LocatedA (PatBuilder GhcPs))) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsAppPV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> LocatedA (FunArg (PatBuilder GhcPs)) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsAppTypePV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA (PatBuilder GhcPs) -> Bool -> LocatedA (PatBuilder GhcPs) -> AnnsIf -> PV (LocatedA (PatBuilder GhcPs)) # mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedLW [LStmt GhcPs (LocatedA (PatBuilder GhcPs))] -> EpaLocation -> EpaLocation -> PV (LocatedA (PatBuilder GhcPs)) # mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA (PatBuilder GhcPs) -> EpToken ")" -> PV (LocatedA (PatBuilder GhcPs)) # mkHsVarPV :: LocatedN RdrName -> PV (LocatedA (PatBuilder GhcPs)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a (PatBuilder GhcPs)) # mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a (PatBuilder GhcPs)) # mkHsTySigPV :: SrcSpanAnnA -> LocatedA (PatBuilder GhcPs) -> LHsType GhcPs -> TokDcolon -> PV (LocatedA (PatBuilder GhcPs)) # mkHsExplicitListPV :: SrcSpan -> [LocatedA (PatBuilder GhcPs)] -> AnnList () -> PV (LocatedA (PatBuilder GhcPs)) # mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA (PatBuilder GhcPs) -> ([Fbind (PatBuilder GhcPs)], Maybe SrcSpan) -> (Maybe (EpToken "{"), Maybe (EpToken "}")) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsNegAppPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> EpToken "-" -> PV (LocatedA (PatBuilder GhcPs)) # mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp (PatBuilder GhcPs)) -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsArrowPV :: SrcSpan -> ArrowParsingMode lhs (PatBuilder GhcPs) -> LocatedA lhs -> HsMultAnnOf (LocatedA (PatBuilder GhcPs)) GhcPs -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsMultPV :: EpToken "%" -> LocatedA (PatBuilder GhcPs) -> PV (TokRarrow -> HsMultAnnOf (LocatedA (PatBuilder GhcPs)) GhcPs) # mkHsForallPV :: SrcSpan -> HsForAllTelescope GhcPs -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # checkContextPV :: LocatedA (PatBuilder GhcPs) -> PV (LocatedC [LocatedA (PatBuilder GhcPs)]) # mkQualPV :: SrcSpan -> LocatedC [LocatedA (PatBuilder GhcPs)] -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA (PatBuilder GhcPs) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsLazyPatPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> EpToken "~" -> PV (LocatedA (PatBuilder GhcPs)) # mkHsBangPatPV :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> EpToken "!" -> PV (LocatedA (PatBuilder GhcPs)) # mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple (PatBuilder GhcPs) -> (EpaLocation, EpaLocation) -> PV (LocatedA (PatBuilder GhcPs)) # mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA (PatBuilder GhcPs)) # rejectPragmaPV :: LocatedA (PatBuilder GhcPs) -> PV () #
Outputable (PatBuilder GhcPs) # |
Instance details Defined in GHC.Parser.Types Methods ppr :: PatBuilder GhcPs -> SDoc #
type Body (PatBuilder GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess type Body (PatBuilder GhcPs) = PatBuilder
type FunArg (PatBuilder GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess type FunArg (PatBuilder GhcPs) = PatBuilder GhcPs
type InfixOp (PatBuilder GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess type InfixOp (PatBuilder GhcPs) = RdrName
type Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] # |
Instance details Defined in GHC.Parser.Types type Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnLW
type Anno [LocatedA (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs)))] # |
Instance details Defined in GHC.Parser.Types type Anno [LocatedA (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnLW
type Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs))) # |
Instance details Defined in GHC.Parser.Types type Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs))) = EpAnnCO
type Anno (Match GhcPs (LocatedA (PatBuilder GhcPs))) # |
Instance details Defined in GHC.Parser.Types type Anno (Match GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnA
type Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs))) # |
Instance details Defined in GHC.Parser.Types type Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnA

class DisambTD b where #

Disambiguate constructs that may appear when we do not know ahead of time whether we are parsing a type or a newtype/data constructor.

See Note [Ambiguous syntactic categories] for the general idea.

See Note [Parsing data constructors is hard] for the specific issue this particular class is solving.

Methods

mkHsAppTyHeadPV :: LHsType GhcPs -> PV (LocatedA b) #

Process the head of a type-level function/constructor application, i.e. the `H` in `H a b c`.

mkHsAppTyPV :: LocatedA b -> LHsType GhcPs -> PV (LocatedA b) #

Disambiguate `f x` (function application or prefix data constructor).

mkHsAppKindTyPV :: LocatedA b -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA b) #

Disambiguate `f @t` (visible kind application)

mkHsOpTyPV :: PromotionFlag -> LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA b) #

Disambiguate `f # x` (infix operator)

mkUnpackednessPV :: Located UnpackednessPragma -> LocatedA b -> PV (LocatedA b) #

Disambiguate `{-# UNPACK #-} t` (unpack/nounpack pragma)

#### Instances

Instances details

DisambTD DataConBuilder # |
Instance details Defined in GHC.Parser.PostProcess Methods mkHsAppTyHeadPV :: LHsType GhcPs -> PV (LocatedA DataConBuilder) # mkHsAppTyPV :: LocatedA DataConBuilder -> LHsType GhcPs -> PV (LocatedA DataConBuilder) # mkHsAppKindTyPV :: LocatedA DataConBuilder -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA DataConBuilder) # mkHsOpTyPV :: PromotionFlag -> LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA DataConBuilder) # mkUnpackednessPV :: Located UnpackednessPragma -> LocatedA DataConBuilder -> PV (LocatedA DataConBuilder) #
DisambTD (HsType GhcPs) # |
Instance details Defined in GHC.Parser.PostProcess Methods mkHsAppTyHeadPV :: LHsType GhcPs -> PV (LocatedA (HsType GhcPs)) # mkHsAppTyPV :: LocatedA (HsType GhcPs) -> LHsType GhcPs -> PV (LocatedA (HsType GhcPs)) # mkHsAppKindTyPV :: LocatedA (HsType GhcPs) -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA (HsType GhcPs)) # mkHsOpTyPV :: PromotionFlag -> LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA (HsType GhcPs)) # mkUnpackednessPV :: Located UnpackednessPragma -> LocatedA (HsType GhcPs) -> PV (LocatedA (HsType GhcPs)) #

addUnpackednessP :: MonadP m => Located UnpackednessPragma -> LHsType GhcPs -> m (LHsType GhcPs) #

Annotate a type with either an `{-# UNPACK #-}` or a `{-# NOUNPACK #-}` pragma.

dataConBuilderCon :: LocatedA DataConBuilder -> LocatedN RdrName #

dataConBuilderDetails :: LocatedA DataConBuilder -> HsConDeclH98Details GhcPs #

mkUnboxedSumCon :: LHsType GhcPs -> ConTag -> Arity -> (LocatedN RdrName, HsConDeclH98Details GhcPs) #

mkTupleSyntaxTy :: EpToken "(" -> [LocatedA (HsType GhcPs)] -> EpToken ")" -> P (HsType GhcPs) #

Decide whether to parse tuple syntax `(Int, Double)` in a type as a type or data constructor, based on the extension `ListTuplePuns`. The case with an explicit promotion quote, `'(Int, Double)`, is handled by `mkExplicitTupleTy`.

mkTupleSyntaxTycon :: Boxity -> Int -> P RdrName #

Decide whether to parse tuple con syntax `(,)` in a type as a type or data constructor, based on the extension `ListTuplePuns`. The case with an explicit promotion quote, `'(,)`, is handled by the rule `SIMPLEQUOTE sysdcon_nolist` in `atype`.

mkListSyntaxTy0 :: EpToken "[" -> EpToken "]" -> SrcSpan -> P (HsType GhcPs) #

Decide whether to parse list tycon syntax `[]` in a type as a type or data constructor, based on the extension `ListTuplePuns`. The case with an explicit promotion quote, `'[]`, is handled by `mkExplicitListTy`.

mkListSyntaxTy1 :: EpToken "[" -> LocatedA (HsType GhcPs) -> EpToken "]" -> P (HsType GhcPs) #

Decide whether to parse list type syntax `[Int]` in a type as a type or data constructor, based on the extension `ListTuplePuns`. The case with an explicit promotion quote, `'[Int]`, is handled by `mkExplicitListTy`.

withCombinedComments :: (HasLoc l1, HasLoc l2) => l1 -> l2 -> (SrcSpan -> P a) -> P (LocatedA a) #

Call a parser with a span and its comments given by a start and end token.

requireLTPuns :: PsErrPunDetails -> Located a -> Located b -> P () #

Emit an error of type `PsErrInvalidPun` with a location from `start` to `end` if the extension `ListTuplePuns` is disabled.

This is used in Parser.y to guard rules that require punning.