RdrHsSyn

ghc-8.10.1: The GHC API

Safe Haskell | None
Language | Haskell2010

RdrHsSyn

Synopsis

- mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
- mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
- mkHsFractional :: FractionalLit -> HsOverLit GhcPs
- mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
- mkHsDo :: HsStmtContext Name -> [ExprLStmt GhcPs] -> HsExpr GhcPs
- mkSpliceDecl :: LHsExpr GhcPs -> HsDecl GhcPs
- mkRoleAnnotDecl :: SrcSpan -> Located RdrName -> [Located (Maybe FastString)] -> P (LRoleAnnotDecl GhcPs)
- mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a, [LHsFunDep GhcPs]) -> OrdList (LHsDecl GhcPs) -> P (LTyClDecl GhcPs)
- mkTyData :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> HsDeriving GhcPs -> P (LTyClDecl GhcPs)
- mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (Located CType) -> (Maybe (LHsContext GhcPs), Maybe [LHsTyVarBndr GhcPs], LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> HsDeriving GhcPs -> P (LInstDecl GhcPs)
- mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> P (LTyClDecl GhcPs)
- mkTyFamInstEqn :: Maybe [LHsTyVarBndr GhcPs] -> LHsType GhcPs -> LHsType GhcPs -> P (TyFamInstEqn GhcPs, [AddAnn])
- mkStandaloneKindSig :: SrcSpan -> Located [Located RdrName] -> LHsKind GhcPs -> P (LStandaloneKindSig GhcPs)
- mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> P (LInstDecl GhcPs)
- mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> LHsType GhcPs -> Located (FamilyResultSig GhcPs) -> Maybe (LInjectivityAnn GhcPs) -> P (LTyClDecl GhcPs)
- mkLHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
- mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma
- mkPatSynMatchGroup :: Located RdrName -> Located (OrdList (LHsDecl GhcPs)) -> P (MatchGroup GhcPs (LHsExpr GhcPs))
- mkRecConstrOrUpdate :: LHsExpr GhcPs -> SrcSpan -> ([LHsRecField GhcPs (LHsExpr GhcPs)], Maybe SrcSpan) -> PV (HsExpr GhcPs)
- mkTyClD :: LTyClDecl (GhcPass p) -> LHsDecl (GhcPass p)
- mkInstD :: LInstDecl (GhcPass p) -> LHsDecl (GhcPass p)
- mkRdrRecordCon :: Located RdrName -> HsRecordBinds GhcPs -> HsExpr GhcPs
- mkRdrRecordUpd :: LHsExpr GhcPs -> [LHsRecUpdField GhcPs] -> HsExpr GhcPs
- setRdrNameSpace :: RdrName -> NameSpace -> RdrName
- filterCTuple :: RdrName -> RdrName
- cvBindGroup :: OrdList (LHsDecl GhcPs) -> P (HsValBinds GhcPs)
- cvBindsAndSigs :: OrdList (LHsDecl GhcPs) -> P (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs], [LTyFamInstDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl])
- cvTopDecls :: OrdList (LHsDecl GhcPs) -> [LHsDecl GhcPs]
- placeHolderPunRhs :: DisambECP b => PV (Located b)
- mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, Located RdrName, LHsSigType GhcPs) -> P (HsDecl GhcPs)
- parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText -> Maybe ForeignImport
- mkExport :: Located CCallConv -> (Located StringLiteral, Located RdrName, LHsSigType GhcPs) -> P (HsDecl GhcPs)
- mkExtName :: RdrName -> CLabelString
- mkGadtDecl :: [Located RdrName] -> LHsType GhcPs -> (ConDecl GhcPs, [AddAnn])
- mkConDeclH98 :: Located RdrName -> Maybe [LHsTyVarBndr GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclDetails GhcPs -> ConDecl GhcPs
- checkImportDecl :: Maybe (Located Token) -> Maybe (Located Token) -> P ()
- checkExpBlockArguments :: LHsExpr GhcPs -> PV ()
- checkPrecP :: Located (SourceText, Int) -> Located (OrdList (Located RdrName)) -> P ()
- checkContext :: LHsType GhcPs -> P ([AddAnn], LHsContext GhcPs)
- checkPattern :: Located (PatBuilder GhcPs) -> P (LPat GhcPs)
- checkPattern_msg :: SDoc -> PV (Located (PatBuilder GhcPs)) -> P (LPat GhcPs)
- isBangRdr :: RdrName -> Bool
- isTildeRdr :: RdrName -> Bool
- checkMonadComp :: PV (HsStmtContext Name)
- checkValDef :: SrcStrictness -> Located (PatBuilder GhcPs) -> Maybe (LHsType GhcPs) -> Located (a, GRHSs GhcPs (LHsExpr GhcPs)) -> P ([AddAnn], HsBind GhcPs)
- checkValSigLhs :: LHsExpr GhcPs -> P (Located RdrName)
- type LRuleTyTmVar = Located RuleTyTmVar
- data RuleTyTmVar = RuleTyTmVar (Located RdrName) (Maybe (LHsType GhcPs))
- mkRuleBndrs :: [LRuleTyTmVar] -> [LRuleBndr GhcPs]
- mkRuleTyVarBndrs :: [LRuleTyTmVar] -> [LHsTyVarBndr GhcPs]
- checkRuleTyVarBndrNames :: [LHsTyVarBndr GhcPs] -> P ()
- checkRecordSyntax :: (MonadP m, Outputable a) => Located a -> m (Located a)
- checkEmptyGADTs :: Located ([AddAnn], [LConDecl GhcPs]) -> P (Located ([AddAnn], [LConDecl GhcPs]))
- addFatalError :: MonadP m => SrcSpan -> SDoc -> m a
- hintBangPat :: SrcSpan -> PatBuilder GhcPs -> PV ()
- data TyEl
  - = TyElOpr RdrName
  - | TyElOpd (HsType GhcPs)
  - | TyElKindApp SrcSpan (LHsType GhcPs)
  - | TyElTilde
  - | TyElBang
  - | TyElUnpackedness ([AddAnn], SourceText, SrcUnpackedness)
  - | TyElDocPrev HsDocString
- mergeOps :: [Located TyEl] -> P (LHsType GhcPs)
- mergeDataCon :: [Located TyEl] -> P (Located RdrName, HsConDeclDetails GhcPs, Maybe LHsDocString)
- data ImpExpSubSpec
  - = ImpExpAbs
  - | ImpExpAll
  - | ImpExpList [Located ImpExpQcSpec]
  - | ImpExpAllWith [Located ImpExpQcSpec]
- data ImpExpQcSpec
  - = ImpExpQcName (Located RdrName)
  - | ImpExpQcType (Located RdrName)
  - | ImpExpQcWildcard
- mkModuleImpExp :: Located ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs)
- mkTypeImpExp :: Located RdrName -> P (Located RdrName)
- mkImpExpSubSpec :: [Located ImpExpQcSpec] -> P ([AddAnn], ImpExpSubSpec)
- checkImportSpec :: Located [LIE GhcPs] -> P (Located [LIE GhcPs])
- forallSym :: Bool -> String
- starSym :: Bool -> String
- warnStarIsType :: SrcSpan -> P ()
- warnPrepositiveQualifiedModule :: SrcSpan -> P ()
- failOpFewArgs :: Located RdrName -> P a
- failOpNotEnabledImportQualifiedPost :: SrcSpan -> P ()
- failOpImportQualifiedTwice :: SrcSpan -> P ()
- data SumOrTuple b
  - = Sum ConTag Arity (Located b)
  - | Tuple [Located (Maybe (Located b))]
- data PV a
- runPV :: PV a -> P a
- newtype ECP = ECP {
  - runECP_PV :: forall b. DisambECP b => PV (Located b)
  }
- runECP_P :: DisambECP b => ECP -> P (Located b)
- class DisambInfixOp b where
  - mkHsVarOpPV :: Located RdrName -> PV (Located b)
  - mkHsConOpPV :: Located RdrName -> PV (Located b)
  - mkHsInfixHolePV :: SrcSpan -> PV (Located b)
- class b ~ Body b GhcPs => DisambECP b where
  - type Body b :: * -> *
  - type InfixOp b
  - type FunArg b
  - ecpFromCmd' :: LHsCmd GhcPs -> PV (Located b)
  - ecpFromExp' :: LHsExpr GhcPs -> PV (Located b)
  - mkHsLamPV :: SrcSpan -> MatchGroup GhcPs (Located b) -> PV (Located b)
  - mkHsLetPV :: SrcSpan -> LHsLocalBinds GhcPs -> Located b -> PV (Located b)
  - superInfixOp :: (DisambInfixOp (InfixOp b) => PV (Located b)) -> PV (Located b)
  - mkHsOpAppPV :: SrcSpan -> Located b -> Located (InfixOp b) -> Located b -> PV (Located b)
  - mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> MatchGroup GhcPs (Located b) -> PV (Located b)
  - superFunArg :: (DisambECP (FunArg b) => PV (Located b)) -> PV (Located b)
  - mkHsAppPV :: SrcSpan -> Located b -> Located (FunArg b) -> PV (Located b)
  - mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> Located b -> Bool -> Located b -> PV (Located b)
  - mkHsDoPV :: SrcSpan -> Located [LStmt GhcPs (Located b)] -> PV (Located b)
  - mkHsParPV :: SrcSpan -> Located b -> PV (Located b)
  - mkHsVarPV :: Located RdrName -> PV (Located b)
  - mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located b)
  - mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located b)
  - mkHsWildCardPV :: SrcSpan -> PV (Located b)
  - mkHsTySigPV :: SrcSpan -> Located b -> LHsType GhcPs -> PV (Located b)
  - mkHsExplicitListPV :: SrcSpan -> [Located b] -> PV (Located b)
  - mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located b)
  - mkHsRecordPV :: SrcSpan -> SrcSpan -> Located b -> ([LHsRecField GhcPs (Located b)], Maybe SrcSpan) -> PV (Located b)
  - mkHsNegAppPV :: SrcSpan -> Located b -> PV (Located b)
  - mkHsSectionR_PV :: SrcSpan -> Located (InfixOp b) -> Located b -> PV (Located b)
  - mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> Located b -> PV (Located b)
  - mkHsAsPatPV :: SrcSpan -> Located RdrName -> Located b -> PV (Located b)
  - mkHsLazyPatPV :: SrcSpan -> Located b -> PV (Located b)
  - mkSumOrTuplePV :: SrcSpan -> Boxity -> SumOrTuple b -> PV (Located b)
- ecpFromExp :: LHsExpr GhcPs -> ECP
- ecpFromCmd :: LHsCmd GhcPs -> ECP
- data PatBuilder p
- patBuilderBang :: SrcSpan -> Located (PatBuilder p) -> Located (PatBuilder p)

# Documentation

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 :: HsStmtContext Name -> [ExprLStmt GhcPs] -> HsExpr GhcPs #

mkSpliceDecl :: LHsExpr GhcPs -> HsDecl GhcPs #

mkRoleAnnotDecl :: SrcSpan -> Located RdrName -> [Located (Maybe FastString)] -> P (LRoleAnnotDecl GhcPs) #

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

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

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

mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> P (LTyClDecl GhcPs) #

mkTyFamInstEqn :: Maybe [LHsTyVarBndr GhcPs] -> LHsType GhcPs -> LHsType GhcPs -> P (TyFamInstEqn GhcPs, [AddAnn]) #

mkStandaloneKindSig :: SrcSpan -> Located [Located RdrName] -> LHsKind GhcPs -> P (LStandaloneKindSig GhcPs) #

mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> P (LInstDecl GhcPs) #

mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> LHsType GhcPs -> Located (FamilyResultSig GhcPs) -> Maybe (LInjectivityAnn GhcPs) -> P (LTyClDecl GhcPs) #

mkLHsSigType :: LHsType GhcPs -> LHsSigType GhcPs #

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

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

mkRecConstrOrUpdate :: LHsExpr GhcPs -> SrcSpan -> ([LHsRecField GhcPs (LHsExpr GhcPs)], Maybe SrcSpan) -> PV (HsExpr GhcPs) #

mkTyClD :: 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 :: LInstDecl (GhcPass p) -> LHsDecl (GhcPass p) #

mkRdrRecordCon :: Located RdrName -> HsRecordBinds GhcPs -> HsExpr GhcPs #

mkRdrRecordUpd :: LHsExpr GhcPs -> [LHsRecUpdField GhcPs] -> HsExpr GhcPs #

setRdrNameSpace :: RdrName -> NameSpace -> RdrName #

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.

filterCTuple :: RdrName -> RdrName #

Replaces constraint tuple names with corresponding boxed ones.

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

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

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 (Located b) #

mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, Located RdrName, LHsSigType GhcPs) -> P (HsDecl GhcPs) #

parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText -> Maybe ForeignImport #

mkExport :: Located CCallConv -> (Located StringLiteral, Located RdrName, LHsSigType GhcPs) -> P (HsDecl GhcPs) #

mkExtName :: RdrName -> CLabelString #

mkGadtDecl :: [Located RdrName] -> LHsType GhcPs -> (ConDecl GhcPs, [AddAnn]) #

mkConDeclH98 :: Located RdrName -> Maybe [LHsTyVarBndr GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclDetails GhcPs -> ConDecl GhcPs #

checkImportDecl :: Maybe (Located Token) -> Maybe (Located Token) -> P () #

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.

checkPrecP #

Arguments

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

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

checkContext :: LHsType GhcPs -> P ([AddAnn], 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 :: Located (PatBuilder GhcPs) -> P (LPat GhcPs) #

checkPattern_msg :: SDoc -> PV (Located (PatBuilder GhcPs)) -> P (LPat GhcPs) #

isBangRdr :: RdrName -> Bool #

isTildeRdr :: RdrName -> Bool #

checkMonadComp :: PV (HsStmtContext Name) #

Check for monad comprehensions

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

checkValDef :: SrcStrictness -> Located (PatBuilder GhcPs) -> Maybe (LHsType GhcPs) -> Located (a, GRHSs GhcPs (LHsExpr GhcPs)) -> P ([AddAnn], HsBind GhcPs) #

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

type LRuleTyTmVar = Located RuleTyTmVar #

data RuleTyTmVar #

Essentially a wrapper for a `RuleBndr GhcPs`

Constructors

RuleTyTmVar (Located RdrName) (Maybe (LHsType GhcPs)) |

mkRuleBndrs :: [LRuleTyTmVar] -> [LRuleBndr GhcPs] #

mkRuleTyVarBndrs :: [LRuleTyTmVar] -> [LHsTyVarBndr GhcPs] #

checkRuleTyVarBndrNames :: [LHsTyVarBndr GhcPs] -> P () #

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

checkEmptyGADTs :: Located ([AddAnn], [LConDecl GhcPs]) -> P (Located ([AddAnn], [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 => SrcSpan -> SDoc -> 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 -> PatBuilder GhcPs -> PV () #

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

data TyEl #

Either an operator or an operand.

Constructors

TyElOpr RdrName |
TyElOpd (HsType GhcPs) |
TyElKindApp SrcSpan (LHsType GhcPs) |
TyElTilde |
TyElBang |
TyElUnpackedness ([AddAnn], SourceText, SrcUnpackedness) |
TyElDocPrev HsDocString |

#### Instances

Instances details

Outputable TyEl # |
Instance details Defined in RdrHsSyn Methods ppr :: TyEl -> SDoc # pprPrec :: Rational -> TyEl -> SDoc #

mergeOps :: [Located TyEl] -> P (LHsType GhcPs) #

Merge a reversed and non-empty soup of operators and operands into a type.

User input: `F x y + G a b * X` Input to `mergeOps`: [X, *, b, a, G, +, y, x, F] Output corresponds to what the user wrote assuming all operators are of the same fixity and right-associative.

It's a bit silly that we're doing it at all, as the renamer will have to rearrange this, and it'd be easier to keep things separate.

See Note [Parsing data constructors is hard]

mergeDataCon :: [Located TyEl] -> P (Located RdrName, HsConDeclDetails GhcPs, Maybe LHsDocString) #

Merge a reversed and non-empty soup of operators and operands into a data constructor.

User input: `C !A B -- ^ doc` Input to `mergeDataCon`: ["doc", B, !, A, C] Output: (C, PrefixCon [!A, B], "doc")

See Note [Parsing data constructors is hard] See Note [isFunLhs vs mergeDataCon]

data ImpExpSubSpec #

Constructors

ImpExpAbs |
ImpExpAll |
ImpExpList [Located ImpExpQcSpec] |
ImpExpAllWith [Located ImpExpQcSpec] |

data ImpExpQcSpec #

Constructors

ImpExpQcName (Located RdrName) |
ImpExpQcType (Located RdrName) |
ImpExpQcWildcard |

mkModuleImpExp :: Located ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs) #

mkTypeImpExp :: Located RdrName -> P (Located RdrName) #

mkImpExpSubSpec :: [Located ImpExpQcSpec] -> P ([AddAnn], ImpExpSubSpec) #

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

forallSym :: Bool -> String #

starSym :: Bool -> String #

warnStarIsType :: SrcSpan -> P () #

warnPrepositiveQualifiedModule :: SrcSpan -> P () #

failOpFewArgs :: Located RdrName -> P a #

failOpNotEnabledImportQualifiedPost :: SrcSpan -> P () #

failOpImportQualifiedTwice :: SrcSpan -> P () #

data SumOrTuple b #

Constructors

Sum ConTag Arity (Located b) |
Tuple [Located (Maybe (Located b))] |

data PV a #

#### Instances

Instances details

Monad PV # |
Instance details Defined in RdrHsSyn Methods (>>=) :: PV a -> (a -> PV b) -> PV b Source # (>>) :: PV a -> PV b -> PV b Source # return :: a -> PV a Source #
Functor PV # |
Instance details Defined in RdrHsSyn Methods fmap :: (a -> b) -> PV a -> PV b Source # (<$) :: a -> PV b -> PV a Source #
Applicative PV # |
Instance details Defined in RdrHsSyn Methods pure :: a -> PV a Source # (<*>) :: PV (a -> b) -> PV a -> PV b Source # liftA2 :: (a -> b -> c) -> PV a -> PV b -> PV c Source # (*>) :: PV a -> PV b -> PV b Source # (<*) :: PV a -> PV b -> PV a Source #
MonadP PV # |
Instance details Defined in RdrHsSyn Methods addError :: SrcSpan -> SDoc -> PV () # addWarning :: WarningFlag -> SrcSpan -> SDoc -> PV () # addFatalError :: SrcSpan -> SDoc -> PV a # getBit :: ExtBits -> PV Bool # addAnnotation :: SrcSpan -> AnnKeywordId -> SrcSpan -> PV () #

runPV :: PV a -> P a #

newtype ECP #

Constructors

ECP |
Fields runECP_PV :: forall b. DisambECP b => PV (Located b)

runECP_P :: DisambECP b => ECP -> P (Located b) #

class DisambInfixOp b where #

Disambiguate infix operators. See Note [Ambiguous syntactic categories]

Methods

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

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

mkHsInfixHolePV :: SrcSpan -> PV (Located b) #

#### Instances

Instances details

DisambInfixOp RdrName # |
Instance details Defined in RdrHsSyn Methods mkHsVarOpPV :: Located RdrName -> PV (Located RdrName) # mkHsConOpPV :: Located RdrName -> PV (Located RdrName) # mkHsInfixHolePV :: SrcSpan -> PV (Located RdrName) #
p ~ GhcPs => DisambInfixOp (HsExpr p) # |
Instance details Defined in RdrHsSyn Methods mkHsVarOpPV :: Located RdrName -> PV (Located (HsExpr p)) # mkHsConOpPV :: Located RdrName -> PV (Located (HsExpr p)) # mkHsInfixHolePV :: SrcSpan -> PV (Located (HsExpr p)) #

class b ~ Body b GhcPs => 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 :: * -> * #

See Note [Body in DisambECP]

type InfixOp b #

Infix operator representation

type FunArg b #

Function argument representation

Methods

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

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

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

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

mkHsLamPV :: SrcSpan -> MatchGroup GhcPs (Located b) -> PV (Located b) #

Disambiguate "... -> ..." (lambda)

mkHsLetPV :: SrcSpan -> LHsLocalBinds GhcPs -> Located b -> PV (Located b) #

Disambiguate "let ... in ..."

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

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

mkHsOpAppPV :: SrcSpan -> Located b -> Located (InfixOp b) -> Located b -> PV (Located b) #

Disambiguate "f # x" (infix operator)

mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> MatchGroup GhcPs (Located b) -> PV (Located b) #

Disambiguate "case ... of ..."

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

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

mkHsAppPV :: SrcSpan -> Located b -> Located (FunArg b) -> PV (Located b) #

Disambiguate "f x" (function application)

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

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

mkHsDoPV :: SrcSpan -> Located [LStmt GhcPs (Located b)] -> PV (Located b) #

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

mkHsParPV :: SrcSpan -> Located b -> PV (Located b) #

Disambiguate "( ... )" (parentheses)

mkHsVarPV :: Located RdrName -> PV (Located b) #

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

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

Disambiguate a monomorphic literal

mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located b) #

Disambiguate an overloaded literal

mkHsWildCardPV :: SrcSpan -> PV (Located b) #

Disambiguate a wildcard

mkHsTySigPV :: SrcSpan -> Located b -> LHsType GhcPs -> PV (Located b) #

Disambiguate "a :: t" (type annotation)

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

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

mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located b) #

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

mkHsRecordPV :: SrcSpan -> SrcSpan -> Located b -> ([LHsRecField GhcPs (Located b)], Maybe SrcSpan) -> PV (Located b) #

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

mkHsNegAppPV :: SrcSpan -> Located b -> PV (Located b) #

Disambiguate "-a" (negation)

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

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

mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> Located b -> PV (Located b) #

Disambiguate "(a -> b)" (view pattern)

mkHsAsPatPV :: SrcSpan -> Located RdrName -> Located b -> PV (Located b) #

Disambiguate "a@b" (as-pattern)

mkHsLazyPatPV :: SrcSpan -> Located b -> PV (Located b) #

Disambiguate "~a" (lazy pattern)

mkSumOrTuplePV :: SrcSpan -> Boxity -> SumOrTuple b -> PV (Located b) #

Disambiguate tuple sections and unboxed sums

#### Instances

Instances details

p ~ GhcPs => DisambECP (HsCmd p) # |
Instance details Defined in RdrHsSyn Associated Types type Body (HsCmd p) :: Type -> Type # type InfixOp (HsCmd p) # type FunArg (HsCmd p) # Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (Located (HsCmd p)) # ecpFromExp' :: LHsExpr GhcPs -> PV (Located (HsCmd p)) # mkHsLamPV :: SrcSpan -> MatchGroup GhcPs (Located (HsCmd p)) -> PV (Located (HsCmd p)) # mkHsLetPV :: SrcSpan -> LHsLocalBinds GhcPs -> Located (HsCmd p) -> PV (Located (HsCmd p)) # superInfixOp :: (DisambInfixOp (InfixOp (HsCmd p)) => PV (Located (HsCmd p))) -> PV (Located (HsCmd p)) # mkHsOpAppPV :: SrcSpan -> Located (HsCmd p) -> Located (InfixOp (HsCmd p)) -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> MatchGroup GhcPs (Located (HsCmd p)) -> PV (Located (HsCmd p)) # superFunArg :: (DisambECP (FunArg (HsCmd p)) => PV (Located (HsCmd p))) -> PV (Located (HsCmd p)) # mkHsAppPV :: SrcSpan -> Located (HsCmd p) -> Located (FunArg (HsCmd p)) -> PV (Located (HsCmd p)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> Located (HsCmd p) -> Bool -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsDoPV :: SrcSpan -> Located [LStmt GhcPs (Located (HsCmd p))] -> PV (Located (HsCmd p)) # mkHsParPV :: SrcSpan -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsVarPV :: Located RdrName -> PV (Located (HsCmd p)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located (HsCmd p)) # mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located (HsCmd p)) # mkHsWildCardPV :: SrcSpan -> PV (Located (HsCmd p)) # mkHsTySigPV :: SrcSpan -> Located (HsCmd p) -> LHsType GhcPs -> PV (Located (HsCmd p)) # mkHsExplicitListPV :: SrcSpan -> [Located (HsCmd p)] -> PV (Located (HsCmd p)) # mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located (HsCmd p)) # mkHsRecordPV :: SrcSpan -> SrcSpan -> Located (HsCmd p) -> ([LHsRecField GhcPs (Located (HsCmd p))], Maybe SrcSpan) -> PV (Located (HsCmd p)) # mkHsNegAppPV :: SrcSpan -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsSectionR_PV :: SrcSpan -> Located (InfixOp (HsCmd p)) -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsAsPatPV :: SrcSpan -> Located RdrName -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkHsLazyPatPV :: SrcSpan -> Located (HsCmd p) -> PV (Located (HsCmd p)) # mkSumOrTuplePV :: SrcSpan -> Boxity -> SumOrTuple (HsCmd p) -> PV (Located (HsCmd p)) #
p ~ GhcPs => DisambECP (HsExpr p) # |
Instance details Defined in RdrHsSyn Associated Types type Body (HsExpr p) :: Type -> Type # type InfixOp (HsExpr p) # type FunArg (HsExpr p) # Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (Located (HsExpr p)) # ecpFromExp' :: LHsExpr GhcPs -> PV (Located (HsExpr p)) # mkHsLamPV :: SrcSpan -> MatchGroup GhcPs (Located (HsExpr p)) -> PV (Located (HsExpr p)) # mkHsLetPV :: SrcSpan -> LHsLocalBinds GhcPs -> Located (HsExpr p) -> PV (Located (HsExpr p)) # superInfixOp :: (DisambInfixOp (InfixOp (HsExpr p)) => PV (Located (HsExpr p))) -> PV (Located (HsExpr p)) # mkHsOpAppPV :: SrcSpan -> Located (HsExpr p) -> Located (InfixOp (HsExpr p)) -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> MatchGroup GhcPs (Located (HsExpr p)) -> PV (Located (HsExpr p)) # superFunArg :: (DisambECP (FunArg (HsExpr p)) => PV (Located (HsExpr p))) -> PV (Located (HsExpr p)) # mkHsAppPV :: SrcSpan -> Located (HsExpr p) -> Located (FunArg (HsExpr p)) -> PV (Located (HsExpr p)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> Located (HsExpr p) -> Bool -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsDoPV :: SrcSpan -> Located [LStmt GhcPs (Located (HsExpr p))] -> PV (Located (HsExpr p)) # mkHsParPV :: SrcSpan -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsVarPV :: Located RdrName -> PV (Located (HsExpr p)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located (HsExpr p)) # mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located (HsExpr p)) # mkHsWildCardPV :: SrcSpan -> PV (Located (HsExpr p)) # mkHsTySigPV :: SrcSpan -> Located (HsExpr p) -> LHsType GhcPs -> PV (Located (HsExpr p)) # mkHsExplicitListPV :: SrcSpan -> [Located (HsExpr p)] -> PV (Located (HsExpr p)) # mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located (HsExpr p)) # mkHsRecordPV :: SrcSpan -> SrcSpan -> Located (HsExpr p) -> ([LHsRecField GhcPs (Located (HsExpr p))], Maybe SrcSpan) -> PV (Located (HsExpr p)) # mkHsNegAppPV :: SrcSpan -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsSectionR_PV :: SrcSpan -> Located (InfixOp (HsExpr p)) -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsAsPatPV :: SrcSpan -> Located RdrName -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkHsLazyPatPV :: SrcSpan -> Located (HsExpr p) -> PV (Located (HsExpr p)) # mkSumOrTuplePV :: SrcSpan -> Boxity -> SumOrTuple (HsExpr p) -> PV (Located (HsExpr p)) #
DisambECP (PatBuilder GhcPs) # |
Instance details Defined in RdrHsSyn Associated Types type Body (PatBuilder GhcPs) :: Type -> Type # type InfixOp (PatBuilder GhcPs) # type FunArg (PatBuilder GhcPs) # Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (Located (PatBuilder GhcPs)) # ecpFromExp' :: LHsExpr GhcPs -> PV (Located (PatBuilder GhcPs)) # mkHsLamPV :: SrcSpan -> MatchGroup GhcPs (Located (PatBuilder GhcPs)) -> PV (Located (PatBuilder GhcPs)) # mkHsLetPV :: SrcSpan -> LHsLocalBinds GhcPs -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # superInfixOp :: (DisambInfixOp (InfixOp (PatBuilder GhcPs)) => PV (Located (PatBuilder GhcPs))) -> PV (Located (PatBuilder GhcPs)) # mkHsOpAppPV :: SrcSpan -> Located (PatBuilder GhcPs) -> Located (InfixOp (PatBuilder GhcPs)) -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> MatchGroup GhcPs (Located (PatBuilder GhcPs)) -> PV (Located (PatBuilder GhcPs)) # superFunArg :: (DisambECP (FunArg (PatBuilder GhcPs)) => PV (Located (PatBuilder GhcPs))) -> PV (Located (PatBuilder GhcPs)) # mkHsAppPV :: SrcSpan -> Located (PatBuilder GhcPs) -> Located (FunArg (PatBuilder GhcPs)) -> PV (Located (PatBuilder GhcPs)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> Located (PatBuilder GhcPs) -> Bool -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsDoPV :: SrcSpan -> Located [LStmt GhcPs (Located (PatBuilder GhcPs))] -> PV (Located (PatBuilder GhcPs)) # mkHsParPV :: SrcSpan -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsVarPV :: Located RdrName -> PV (Located (PatBuilder GhcPs)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsWildCardPV :: SrcSpan -> PV (Located (PatBuilder GhcPs)) # mkHsTySigPV :: SrcSpan -> Located (PatBuilder GhcPs) -> LHsType GhcPs -> PV (Located (PatBuilder GhcPs)) # mkHsExplicitListPV :: SrcSpan -> [Located (PatBuilder GhcPs)] -> PV (Located (PatBuilder GhcPs)) # mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsRecordPV :: SrcSpan -> SrcSpan -> Located (PatBuilder GhcPs) -> ([LHsRecField GhcPs (Located (PatBuilder GhcPs))], Maybe SrcSpan) -> PV (Located (PatBuilder GhcPs)) # mkHsNegAppPV :: SrcSpan -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsSectionR_PV :: SrcSpan -> Located (InfixOp (PatBuilder GhcPs)) -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsAsPatPV :: SrcSpan -> Located RdrName -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsLazyPatPV :: SrcSpan -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkSumOrTuplePV :: SrcSpan -> Boxity -> SumOrTuple (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) #

ecpFromExp :: LHsExpr GhcPs -> ECP #

ecpFromCmd :: LHsCmd GhcPs -> ECP #

data PatBuilder p #

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

#### Instances

Instances details

Outputable (PatBuilder GhcPs) # |
Instance details Defined in RdrHsSyn Methods ppr :: PatBuilder GhcPs -> SDoc # pprPrec :: Rational -> PatBuilder GhcPs -> SDoc #
DisambECP (PatBuilder GhcPs) # |
Instance details Defined in RdrHsSyn Associated Types type Body (PatBuilder GhcPs) :: Type -> Type # type InfixOp (PatBuilder GhcPs) # type FunArg (PatBuilder GhcPs) # Methods ecpFromCmd' :: LHsCmd GhcPs -> PV (Located (PatBuilder GhcPs)) # ecpFromExp' :: LHsExpr GhcPs -> PV (Located (PatBuilder GhcPs)) # mkHsLamPV :: SrcSpan -> MatchGroup GhcPs (Located (PatBuilder GhcPs)) -> PV (Located (PatBuilder GhcPs)) # mkHsLetPV :: SrcSpan -> LHsLocalBinds GhcPs -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # superInfixOp :: (DisambInfixOp (InfixOp (PatBuilder GhcPs)) => PV (Located (PatBuilder GhcPs))) -> PV (Located (PatBuilder GhcPs)) # mkHsOpAppPV :: SrcSpan -> Located (PatBuilder GhcPs) -> Located (InfixOp (PatBuilder GhcPs)) -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsCasePV :: SrcSpan -> LHsExpr GhcPs -> MatchGroup GhcPs (Located (PatBuilder GhcPs)) -> PV (Located (PatBuilder GhcPs)) # superFunArg :: (DisambECP (FunArg (PatBuilder GhcPs)) => PV (Located (PatBuilder GhcPs))) -> PV (Located (PatBuilder GhcPs)) # mkHsAppPV :: SrcSpan -> Located (PatBuilder GhcPs) -> Located (FunArg (PatBuilder GhcPs)) -> PV (Located (PatBuilder GhcPs)) # mkHsIfPV :: SrcSpan -> LHsExpr GhcPs -> Bool -> Located (PatBuilder GhcPs) -> Bool -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsDoPV :: SrcSpan -> Located [LStmt GhcPs (Located (PatBuilder GhcPs))] -> PV (Located (PatBuilder GhcPs)) # mkHsParPV :: SrcSpan -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsVarPV :: Located RdrName -> PV (Located (PatBuilder GhcPs)) # mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsOverLitPV :: Located (HsOverLit GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsWildCardPV :: SrcSpan -> PV (Located (PatBuilder GhcPs)) # mkHsTySigPV :: SrcSpan -> Located (PatBuilder GhcPs) -> LHsType GhcPs -> PV (Located (PatBuilder GhcPs)) # mkHsExplicitListPV :: SrcSpan -> [Located (PatBuilder GhcPs)] -> PV (Located (PatBuilder GhcPs)) # mkHsSplicePV :: Located (HsSplice GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsRecordPV :: SrcSpan -> SrcSpan -> Located (PatBuilder GhcPs) -> ([LHsRecField GhcPs (Located (PatBuilder GhcPs))], Maybe SrcSpan) -> PV (Located (PatBuilder GhcPs)) # mkHsNegAppPV :: SrcSpan -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsSectionR_PV :: SrcSpan -> Located (InfixOp (PatBuilder GhcPs)) -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsViewPatPV :: SrcSpan -> LHsExpr GhcPs -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsAsPatPV :: SrcSpan -> Located RdrName -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkHsLazyPatPV :: SrcSpan -> Located (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) # mkSumOrTuplePV :: SrcSpan -> Boxity -> SumOrTuple (PatBuilder GhcPs) -> PV (Located (PatBuilder GhcPs)) #
type Body (PatBuilder GhcPs) # |
Instance details Defined in RdrHsSyn type Body (PatBuilder GhcPs) = PatBuilder
type InfixOp (PatBuilder GhcPs) # |
Instance details Defined in RdrHsSyn type InfixOp (PatBuilder GhcPs) = RdrName
type FunArg (PatBuilder GhcPs) # |
Instance details Defined in RdrHsSyn type FunArg (PatBuilder GhcPs) = PatBuilder GhcPs

patBuilderBang :: SrcSpan -> Located (PatBuilder p) -> Located (PatBuilder p) #