Safe Haskell | Ignore |
---|---|
Language | GHC2021 |
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 -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
- mkSpliceDecl :: LHsExpr GhcPs -> LHsDecl GhcPs
- mkRoleAnnotDecl :: SrcSpan -> LocatedN RdrName -> [Located (Maybe FastString)] -> [AddEpAnn] -> P (LRoleAnnotDecl GhcPs)
- mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a, [LHsFunDep GhcPs]) -> OrdList (LHsDecl GhcPs) -> EpLayout -> [AddEpAnn] -> P (LTyClDecl GhcPs)
- mkTyData :: SrcSpan -> Bool -> NewOrData -> Maybe (LocatedP CType) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> [AddEpAnn] -> P (LTyClDecl GhcPs)
- mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (LocatedP CType) -> (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs GhcPs, LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> [AddEpAnn] -> P (LInstDecl GhcPs)
- mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> [AddEpAnn] -> P (LTyClDecl GhcPs)
- mkTyFamInstEqn :: SrcSpan -> HsOuterFamEqnTyVarBndrs GhcPs -> LHsType GhcPs -> LHsType GhcPs -> [AddEpAnn] -> P (LTyFamInstEqn GhcPs)
- mkStandaloneKindSig :: SrcSpan -> Located [LocatedN RdrName] -> LHsSigType GhcPs -> [AddEpAnn] -> P (LStandaloneKindSig GhcPs)
- mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> [AddEpAnn] -> P (LInstDecl GhcPs)
- mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> TopLevelFlag -> LHsType GhcPs -> LFamilyResultSig GhcPs -> Maybe (LInjectivityAnn GhcPs) -> [AddEpAnn] -> P (LTyClDecl GhcPs)
- mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma
- mkOpaquePragma :: SourceText -> InlinePragma
- mkPatSynMatchGroup :: LocatedN RdrName -> LocatedL (OrdList (LHsDecl GhcPs)) -> P (MatchGroup GhcPs (LHsExpr GhcPs))
- mkRecConstrOrUpdate :: Bool -> LHsExpr GhcPs -> SrcSpan -> ([Fbind (HsExpr GhcPs)], Maybe SrcSpan) -> [AddEpAnn] -> PV (HsExpr GhcPs)
- mkTyClD :: LTyClDecl (GhcPass p) -> LHsDecl (GhcPass p)
- mkInstD :: LInstDecl (GhcPass p) -> LHsDecl (GhcPass p)
- mkRdrRecordCon :: LocatedN RdrName -> HsRecordBinds GhcPs -> [AddEpAnn] -> HsExpr GhcPs
- mkRdrRecordUpd :: Bool -> LHsExpr GhcPs -> [Fbind (HsExpr GhcPs)] -> [AddEpAnn] -> PV (HsExpr GhcPs)
- setRdrNameSpace :: RdrName -> NameSpace -> RdrName
- fromSpecTyVarBndr :: LHsTyVarBndr Specificity GhcPs -> P (LHsTyVarBndr () GhcPs)
- fromSpecTyVarBndrs :: [LHsTyVarBndr Specificity GhcPs] -> P [LHsTyVarBndr () GhcPs]
- annBinds :: AddEpAnn -> EpAnnComments -> HsLocalBinds GhcPs -> (HsLocalBinds GhcPs, Maybe EpAnnComments)
- fixValbindsAnn :: EpAnn AnnList -> EpAnn AnnList
- stmtsAnchor :: Located (OrdList AddEpAnn, a) -> Maybe Anchor
- stmtsLoc :: Located (OrdList AddEpAnn, 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) -> P ([AddEpAnn] -> HsDecl GhcPs)
- parseCImport :: LocatedE CCallConv -> LocatedE Safety -> FastString -> String -> Located SourceText -> Maybe (ForeignImport (GhcPass p))
- mkExport :: Located CCallConv -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> P ([AddEpAnn] -> HsDecl GhcPs)
- mkExtName :: RdrName -> CLabelString
- mkGadtDecl :: SrcSpan -> NonEmpty (LocatedN RdrName) -> EpUniToken "::" "\8759" -> LHsSigType GhcPs -> P (LConDecl GhcPs)
- mkConDeclH98 :: [AddEpAnn] -> LocatedN RdrName -> Maybe [LHsTyVarBndr Specificity GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclH98Details GhcPs -> ConDecl GhcPs
- checkImportDecl :: Maybe EpaLocation -> Maybe EpaLocation -> P ()
- 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 {}
- checkMonadComp :: PV HsDoFlavour
- checkValDef :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> (HsMultAnn GhcPs, Maybe (AddEpAnn, LHsType GhcPs)) -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> P (HsBind GhcPs)
- checkValSigLhs :: LHsExpr GhcPs -> P (LocatedN RdrName)
- type LRuleTyTmVar = LocatedAn NoEpAnns RuleTyTmVar
- data RuleTyTmVar = RuleTyTmVar [AddEpAnn] (LocatedN RdrName) (Maybe (LHsType GhcPs))
- mkRuleBndrs :: [LRuleTyTmVar] -> [LRuleBndr GhcPs]
- mkRuleTyVarBndrs :: [LRuleTyTmVar] -> [LHsTyVarBndr () GhcPs]
- checkRuleTyVarBndrNames :: [LHsTyVarBndr flag GhcPs] -> P ()
- checkRecordSyntax :: (MonadP m, Outputable a) => LocatedA a -> m (LocatedA a)
- checkEmptyGADTs :: Located ([AddEpAnn], [LConDecl GhcPs]) -> P (Located ([AddEpAnn], [LConDecl GhcPs]))
- addFatalError :: MonadP m => MsgEnvelope PsMessage -> m a
- hintBangPat :: SrcSpan -> Pat GhcPs -> PV ()
- mkBangTy :: [AddEpAnn] -> SrcStrictness -> LHsType GhcPs -> HsType GhcPs
- data UnpackednessPragma = UnpackednessPragma [AddEpAnn] SourceText SrcUnpackedness
- mkMultTy :: EpToken "%" -> LHsType GhcPs -> EpUniToken "->" "\8594" -> HsArrow GhcPs
- mkMultAnn :: EpToken "%" -> LHsType GhcPs -> HsMultAnn GhcPs
- mkTokenLocation :: SrcSpan -> TokenLocation
- data ImpExpSubSpec
- data ImpExpQcSpec
- mkModuleImpExp :: Maybe (LWarningTxt GhcPs) -> [AddEpAnn] -> LocatedA ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs)
- mkTypeImpExp :: LocatedN RdrName -> P (LocatedN RdrName)
- mkImpExpSubSpec :: [LocatedA ImpExpQcSpec] -> P ([AddEpAnn], ImpExpSubSpec)
- checkImportSpec :: LocatedL [LIE GhcPs] -> P (LocatedL [LIE GhcPs])
- starSym :: Bool -> FastString
- warnStarIsType :: SrcSpan -> P ()
- warnPrepositiveQualifiedModule :: SrcSpan -> P ()
- failOpFewArgs :: MonadP m => LocatedN RdrName -> m a
- failNotEnabledImportQualifiedPost :: SrcSpan -> P ()
- failImportQualifiedTwice :: SrcSpan -> P ()
- requireExplicitNamespaces :: MonadP m => SrcSpan -> m ()
- data SumOrTuple b
- data PV a
- runPV :: PV a -> P a
- newtype ECP = ECP {}
- class DisambInfixOp b where
- 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)
- mkHsProjUpdatePV :: SrcSpan -> Located [LocatedAn NoEpAnns (DotFieldOcc GhcPs)] -> LocatedA b -> Bool -> [AddEpAnn] -> 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 -> LocatedL [LMatch GhcPs (LocatedA b)] -> EpAnnHsCase -> PV (LocatedA b)
- mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedL [LMatch GhcPs (LocatedA b)] -> [AddEpAnn] -> 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 -> LocatedL [LStmt GhcPs (LocatedA b)] -> AnnList -> 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 -> [AddEpAnn] -> 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) -> [AddEpAnn] -> PV (LocatedA b)
- mkHsNegAppPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
- mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (LocatedA b)
- mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
- mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA b -> PV (LocatedA b)
- mkHsLazyPatPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
- mkHsBangPatPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
- mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple b -> [AddEpAnn] -> PV (LocatedA b)
- mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA b)
- rejectPragmaPV :: LocatedA b -> PV ()
- ecpFromExp :: LHsExpr GhcPs -> ECP
- ecpFromCmd :: LHsCmd GhcPs -> ECP
- data PatBuilder p
- hsHoleExpr :: Maybe EpAnnUnboundVar -> HsExpr GhcPs
- 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 :: EpaLocation -> [LocatedA (HsType GhcPs)] -> EpaLocation -> P (HsType GhcPs)
- mkTupleSyntaxTycon :: Boxity -> Int -> P RdrName
- mkListSyntaxTy0 :: EpaLocation -> EpaLocation -> SrcSpan -> P (HsType GhcPs)
- mkListSyntaxTy1 :: EpaLocation -> LocatedA (HsType GhcPs) -> EpaLocation -> P (HsType GhcPs)
- withCombinedComments :: HasLoc l1 => HasLoc l2 => l1 -> l2 -> (SrcSpan -> P a) -> P (LocatedA a)
- requireLTPuns :: PsErrPunDetails -> Located a -> Located b -> P ()
Documentation
mkRdrProjection :: NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs)) -> AnnProjection -> HsExpr GhcPs Source #
type Fbind b = Either (LHsRecField GhcPs (LocatedA b)) (LHsRecProj GhcPs (LocatedA b)) Source #
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs Source #
A useful function for building OpApps
. The operator is always a
variable, and we don't know the fixity yet.
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs Source #
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs Source #
mkRoleAnnotDecl :: SrcSpan -> LocatedN RdrName -> [Located (Maybe FastString)] -> [AddEpAnn] -> P (LRoleAnnotDecl GhcPs) Source #
mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a, [LHsFunDep GhcPs]) -> OrdList (LHsDecl GhcPs) -> EpLayout -> [AddEpAnn] -> P (LTyClDecl GhcPs) Source #
mkTyData :: SrcSpan -> Bool -> NewOrData -> Maybe (LocatedP CType) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> [AddEpAnn] -> P (LTyClDecl GhcPs) Source #
mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (LocatedP CType) -> (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs GhcPs, LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> [AddEpAnn] -> P (LInstDecl GhcPs) Source #
mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> [AddEpAnn] -> P (LTyClDecl GhcPs) Source #
mkTyFamInstEqn :: SrcSpan -> HsOuterFamEqnTyVarBndrs GhcPs -> LHsType GhcPs -> LHsType GhcPs -> [AddEpAnn] -> P (LTyFamInstEqn GhcPs) Source #
mkStandaloneKindSig :: SrcSpan -> Located [LocatedN RdrName] -> LHsSigType GhcPs -> [AddEpAnn] -> P (LStandaloneKindSig GhcPs) Source #
mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> [AddEpAnn] -> P (LInstDecl GhcPs) Source #
mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> TopLevelFlag -> LHsType GhcPs -> LFamilyResultSig GhcPs -> Maybe (LInjectivityAnn GhcPs) -> [AddEpAnn] -> P (LTyClDecl GhcPs) Source #
mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma Source #
mkPatSynMatchGroup :: LocatedN RdrName -> LocatedL (OrdList (LHsDecl GhcPs)) -> P (MatchGroup GhcPs (LHsExpr GhcPs)) Source #
mkRecConstrOrUpdate :: Bool -> LHsExpr GhcPs -> SrcSpan -> ([Fbind (HsExpr GhcPs)], Maybe SrcSpan) -> [AddEpAnn] -> PV (HsExpr GhcPs) Source #
mkTyClD :: LTyClDecl (GhcPass p) -> LHsDecl (GhcPass p) Source #
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).
mkRdrRecordCon :: LocatedN RdrName -> HsRecordBinds GhcPs -> [AddEpAnn] -> HsExpr GhcPs Source #
mkRdrRecordUpd :: Bool -> LHsExpr GhcPs -> [Fbind (HsExpr GhcPs)] -> [AddEpAnn] -> PV (HsExpr GhcPs) Source #
setRdrNameSpace :: RdrName -> NameSpace -> RdrName Source #
This rather gruesome function is used mainly by the parser. 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.
fromSpecTyVarBndr :: LHsTyVarBndr Specificity GhcPs -> P (LHsTyVarBndr () GhcPs) Source #
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] Source #
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 :: AddEpAnn -> EpAnnComments -> HsLocalBinds GhcPs -> (HsLocalBinds GhcPs, Maybe EpAnnComments) Source #
Add the annotation for a 'where' keyword to existing HsLocalBinds
stmtsAnchor :: Located (OrdList AddEpAnn, a) -> Maybe Anchor Source #
The Anchor
for a stmtlist is based on either the location or
the first semicolon annotion.
cvBindGroup :: OrdList (LHsDecl GhcPs) -> P (HsValBinds GhcPs) Source #
cvBindsAndSigs :: OrdList (LHsDecl GhcPs) -> P (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs], [LTyFamInstDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl GhcPs]) Source #
cvTopDecls :: OrdList (LHsDecl GhcPs) -> [LHsDecl GhcPs] Source #
Function definitions are restructured here. Each is assumed to be recursive initially, and non recursive definitions are discovered by the dependency analyser.
mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> P ([AddEpAnn] -> HsDecl GhcPs) Source #
parseCImport :: LocatedE CCallConv -> LocatedE Safety -> FastString -> String -> Located SourceText -> Maybe (ForeignImport (GhcPass p)) Source #
mkExport :: Located CCallConv -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> P ([AddEpAnn] -> HsDecl GhcPs) Source #
mkExtName :: RdrName -> CLabelString Source #
mkGadtDecl :: SrcSpan -> NonEmpty (LocatedN RdrName) -> EpUniToken "::" "\8759" -> LHsSigType GhcPs -> P (LConDecl GhcPs) Source #
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 :: [AddEpAnn] -> LocatedN RdrName -> Maybe [LHsTyVarBndr Specificity GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclH98Details GhcPs -> ConDecl GhcPs Source #
checkImportDecl :: Maybe EpaLocation -> Maybe EpaLocation -> P () Source #
checkExpBlockArguments :: LHsExpr GhcPs -> PV () Source #
Yield a parse error if we have a function applied directly to a do block etc. and BlockArguments is not enabled.
Check if a fixity is valid. We support bypassing the usual bound checks for some special operators.
checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) Source #
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) Source #
checkPattern_details :: ParseContext -> PV (LocatedA (PatBuilder GhcPs)) -> P (LPat GhcPs) Source #
data ParseContext Source #
Extra information for the expression GHC is currently inspecting/parsing. It can be used to generate more informative parser diagnostics and hints.
ParseContext | |
|
Instances
Eq ParseContext Source # | |
Defined in GHC.Parser.Errors.Types (==) :: ParseContext -> ParseContext -> Bool # (/=) :: ParseContext -> ParseContext -> Bool # |
checkValDef :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> (HsMultAnn GhcPs, Maybe (AddEpAnn, LHsType GhcPs)) -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> P (HsBind GhcPs) Source #
type LRuleTyTmVar = LocatedAn NoEpAnns RuleTyTmVar Source #
data RuleTyTmVar Source #
Essentially a wrapper for a RuleBndr GhcPs
mkRuleBndrs :: [LRuleTyTmVar] -> [LRuleBndr GhcPs] Source #
mkRuleTyVarBndrs :: [LRuleTyTmVar] -> [LHsTyVarBndr () GhcPs] Source #
checkRuleTyVarBndrNames :: [LHsTyVarBndr flag GhcPs] -> P () Source #
checkRecordSyntax :: (MonadP m, Outputable a) => LocatedA a -> m (LocatedA a) Source #
checkEmptyGADTs :: Located ([AddEpAnn], [LConDecl GhcPs]) -> P (Located ([AddEpAnn], [LConDecl GhcPs])) Source #
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 Source #
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 () Source #
Hint about bang patterns, assuming BangPatterns
is off.
data UnpackednessPragma Source #
Result of parsing {-# UNPACK #-}
or {-# NOUNPACK #-}
.
data ImpExpSubSpec Source #
data ImpExpQcSpec Source #
mkModuleImpExp :: Maybe (LWarningTxt GhcPs) -> [AddEpAnn] -> LocatedA ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs) Source #
mkImpExpSubSpec :: [LocatedA ImpExpQcSpec] -> P ([AddEpAnn], ImpExpSubSpec) Source #
starSym :: Bool -> FastString Source #
warnStarIsType :: SrcSpan -> P () Source #
warnPrepositiveQualifiedModule :: SrcSpan -> P () Source #
failNotEnabledImportQualifiedPost :: SrcSpan -> P () Source #
failImportQualifiedTwice :: SrcSpan -> P () Source #
requireExplicitNamespaces :: MonadP m => SrcSpan -> m () Source #
data SumOrTuple b Source #
Instances
Applicative PV Source # | |
Functor PV Source # | |
Monad PV Source # | |
MonadP PV Source # | |
Defined in GHC.Parser.PostProcess addError :: MsgEnvelope PsMessage -> PV () Source # addWarning :: MsgEnvelope PsMessage -> PV () Source # addFatalError :: MsgEnvelope PsMessage -> PV a Source # getBit :: ExtBits -> PV Bool Source # allocateCommentsP :: RealSrcSpan -> PV EpAnnComments Source # allocatePriorCommentsP :: RealSrcSpan -> PV EpAnnComments Source # allocateFinalCommentsP :: RealSrcSpan -> PV EpAnnComments Source # |
class DisambInfixOp b where Source #
Disambiguate infix operators. See Note [Ambiguous syntactic categories]
mkHsVarOpPV :: LocatedN RdrName -> PV (LocatedN b) Source #
mkHsConOpPV :: LocatedN RdrName -> PV (LocatedN b) Source #
mkHsInfixHolePV :: LocatedN (HsExpr GhcPs) -> PV (LocatedN b) Source #
Instances
class (b ~ Body b GhcPs, AnnoBody b) => DisambECP b where Source #
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]
type Body b :: Type -> Type Source #
See Note [Body in DisambECP]
Infix operator representation
Function argument representation
ecpFromCmd' :: LHsCmd GhcPs -> PV (LocatedA b) Source #
Return a command without ambiguity, or fail in a non-command context.
ecpFromExp' :: LHsExpr GhcPs -> PV (LocatedA b) Source #
Return an expression without ambiguity, or fail in a non-expression context.
mkHsProjUpdatePV :: SrcSpan -> Located [LocatedAn NoEpAnns (DotFieldOcc GhcPs)] -> LocatedA b -> Bool -> [AddEpAnn] -> PV (LHsRecProj GhcPs (LocatedA b)) Source #
mkHsLetPV :: SrcSpan -> EpToken "let" -> HsLocalBinds GhcPs -> EpToken "in" -> LocatedA b -> PV (LocatedA b) Source #
Disambiguate "let ... in ..."
superInfixOp :: (DisambInfixOp (InfixOp b) => PV (LocatedA b)) -> PV (LocatedA b) Source #
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) Source #
Disambiguate "f # x" (infix operator)
mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> LocatedL [LMatch GhcPs (LocatedA b)] -> EpAnnHsCase -> PV (LocatedA b) Source #
Disambiguate "case ... of ..."
mkHsLamPV :: SrcSpan -> HsLamVariant -> LocatedL [LMatch GhcPs (LocatedA b)] -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "... -> ..." (lambda), "case" and "cases"
superFunArg :: (DisambECP (FunArg b) => PV (LocatedA b)) -> PV (LocatedA b) Source #
Bring superclass constraints on FunArg into scope. See Note [UndecidableSuperClasses for associated types]
mkHsAppPV :: SrcSpanAnnA -> LocatedA b -> LocatedA (FunArg b) -> PV (LocatedA b) Source #
Disambiguate "f x" (function application)
mkHsAppTypePV :: SrcSpanAnnA -> LocatedA b -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA b) Source #
Disambiguate "f @t" (visible type application)
mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA b -> Bool -> LocatedA b -> AnnsIf -> PV (LocatedA b) Source #
Disambiguate "if ... then ... else ..."
mkHsDoPV :: SrcSpan -> Maybe ModuleName -> LocatedL [LStmt GhcPs (LocatedA b)] -> AnnList -> PV (LocatedA b) Source #
Disambiguate "do { ... }" (do notation)
mkHsParPV :: SrcSpan -> EpToken "(" -> LocatedA b -> EpToken ")" -> PV (LocatedA b) Source #
Disambiguate "( ... )" (parentheses)
mkHsVarPV :: LocatedN RdrName -> PV (LocatedA b) Source #
Disambiguate a variable "f" or a data constructor MkF.
mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA b) Source #
Disambiguate a monomorphic literal
mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a b) Source #
Disambiguate an overloaded literal
mkHsWildCardPV :: NoAnn a => SrcSpan -> PV (LocatedAn a b) Source #
Disambiguate a wildcard
mkHsTySigPV :: SrcSpanAnnA -> LocatedA b -> LHsType GhcPs -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "a :: t" (type annotation)
mkHsExplicitListPV :: SrcSpan -> [LocatedA b] -> AnnList -> PV (LocatedA b) Source #
Disambiguate "[a,b,c]" (list syntax)
mkHsSplicePV :: Located (HsUntypedSplice GhcPs) -> PV (LocatedA b) Source #
Disambiguate "$(...)" and "[quasi|...|]" (TH splices)
mkHsRecordPV :: Bool -> SrcSpan -> SrcSpan -> LocatedA b -> ([Fbind b], Maybe SrcSpan) -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "f { a = b, ... }" syntax (record construction and record updates)
mkHsNegAppPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "-a" (negation)
mkHsSectionR_PV :: SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (LocatedA b) Source #
Disambiguate "(# a)" (right operator section)
mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "(a -> b)" (view pattern)
mkHsAsPatPV :: SrcSpan -> LocatedN RdrName -> EpToken "@" -> LocatedA b -> PV (LocatedA b) Source #
Disambiguate "a@b" (as-pattern)
mkHsLazyPatPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "~a" (lazy pattern)
mkHsBangPatPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate "!a" (bang pattern)
mkSumOrTuplePV :: SrcSpanAnnA -> Boxity -> SumOrTuple b -> [AddEpAnn] -> PV (LocatedA b) Source #
Disambiguate tuple sections and unboxed sums
mkHsEmbTyPV :: SrcSpan -> EpToken "type" -> LHsType GhcPs -> PV (LocatedA b) Source #
Disambiguate "type t" (embedded type)
rejectPragmaPV :: LocatedA b -> PV () Source #
Validate infixexp LHS to reject unwanted {-# SCC ... #-} pragmas
Instances
data PatBuilder p Source #
See Note [Ambiguous syntactic categories] and Note [PatBuilder]
Instances
hsHoleExpr :: Maybe EpAnnUnboundVar -> HsExpr GhcPs Source #
class DisambTD b where Source #
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.
mkHsAppTyHeadPV :: LHsType GhcPs -> PV (LocatedA b) Source #
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) Source #
Disambiguate f x
(function application or prefix data constructor).
mkHsAppKindTyPV :: LocatedA b -> EpToken "@" -> LHsType GhcPs -> PV (LocatedA b) Source #
Disambiguate f @t
(visible kind application)
mkHsOpTyPV :: PromotionFlag -> LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA b) Source #
Disambiguate f # x
(infix operator)
mkUnpackednessPV :: Located UnpackednessPragma -> LocatedA b -> PV (LocatedA b) Source #
Disambiguate {-# UNPACK #-} t
(unpack/nounpack pragma)
Instances
addUnpackednessP :: MonadP m => Located UnpackednessPragma -> LHsType GhcPs -> m (LHsType GhcPs) Source #
Annotate a type with either an {-# UNPACK #-}
or a {-# NOUNPACK #-}
pragma.
mkUnboxedSumCon :: LHsType GhcPs -> ConTag -> Arity -> (LocatedN RdrName, HsConDeclH98Details GhcPs) Source #
mkTupleSyntaxTy :: EpaLocation -> [LocatedA (HsType GhcPs)] -> EpaLocation -> P (HsType GhcPs) Source #
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 Source #
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 :: EpaLocation -> EpaLocation -> SrcSpan -> P (HsType GhcPs) Source #
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 :: EpaLocation -> LocatedA (HsType GhcPs) -> EpaLocation -> P (HsType GhcPs) Source #
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) Source #
Call a parser with a span and its comments given by a start and end token.
requireLTPuns :: PsErrPunDetails -> Located a -> Located b -> P () Source #
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.