RdrHsSyn

ghc-8.4.4: The GHC API

Safe Haskell | None
Language | Haskell2010

RdrHsSyn

Synopsis

- mkHsOpApp :: LHsExpr id -> IdP id -> LHsExpr id -> HsExpr id
- mkHsIntegral :: IntegralLit -> PostTc GhcPs Type -> HsOverLit GhcPs
- mkHsFractional :: FractionalLit -> PostTc GhcPs Type -> HsOverLit GhcPs
- mkHsIsString :: SourceText -> FastString -> PostTc GhcPs Type -> 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, [Located (FunDep (Located RdrName))]) -> 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) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> HsDeriving GhcPs -> P (LInstDecl GhcPs)
- mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> P (LTyClDecl GhcPs)
- mkTyFamInstEqn :: LHsType GhcPs -> LHsType GhcPs -> P (TyFamInstEqn GhcPs, [AddAnn])
- 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
- splitCon :: LHsType GhcPs -> P (Located RdrName, HsConDeclDetails 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)], Bool) -> P (HsExpr GhcPs)
- mkTyClD :: LTyClDecl n -> LHsDecl n
- mkInstD :: LInstDecl n -> LHsDecl n
- mkRdrRecordCon :: Located RdrName -> HsRecordBinds GhcPs -> HsExpr GhcPs
- mkRdrRecordUpd :: LHsExpr GhcPs -> [LHsRecUpdField GhcPs] -> HsExpr GhcPs
- setRdrNameSpace :: RdrName -> NameSpace -> 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 :: LHsExpr GhcPs
- 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] -> LHsSigType GhcPs -> ConDecl GhcPs
- mkConDeclH98 :: Located RdrName -> Maybe [LHsTyVarBndr GhcPs] -> LHsContext GhcPs -> HsConDeclDetails GhcPs -> ConDecl GhcPs
- mkATDefault :: LTyFamInstDecl GhcPs -> Either (SrcSpan, SDoc) (LTyFamDefltEqn GhcPs)
- checkPrecP :: Located (SourceText, Int) -> P (Located (SourceText, Int))
- checkContext :: LHsType GhcPs -> P ([AddAnn], LHsContext GhcPs)
- checkPattern :: SDoc -> LHsExpr GhcPs -> P (LPat GhcPs)
- bang_RDR :: RdrName
- checkPatterns :: SDoc -> [LHsExpr GhcPs] -> P [LPat GhcPs]
- checkMonadComp :: P (HsStmtContext Name)
- checkCommand :: LHsExpr GhcPs -> P (LHsCmd GhcPs)
- checkValDef :: SDoc -> SrcStrictness -> LHsExpr GhcPs -> Maybe (LHsType GhcPs) -> Located (a, GRHSs GhcPs (LHsExpr GhcPs)) -> P ([AddAnn], HsBind GhcPs)
- checkValSigLhs :: LHsExpr GhcPs -> P (Located RdrName)
- checkDoAndIfThenElse :: LHsExpr GhcPs -> Bool -> LHsExpr GhcPs -> Bool -> LHsExpr GhcPs -> P ()
- checkRecordSyntax :: Outputable a => Located a -> P (Located a)
- parseErrorSDoc :: SrcSpan -> SDoc -> P a
- splitTilde :: LHsType GhcPs -> P (LHsType GhcPs)
- splitTildeApps :: [LHsAppType GhcPs] -> P [LHsAppType GhcPs]
- 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])
- data SumOrTuple
  - = Sum ConTag Arity (LHsExpr GhcPs)
  - | Tuple [LHsTupArg GhcPs]
- mkSumOrTuple :: Boxity -> SrcSpan -> SumOrTuple -> P (HsExpr GhcPs)

# Documentation

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

mkHsIntegral :: IntegralLit -> PostTc GhcPs Type -> HsOverLit GhcPs #

mkHsFractional :: FractionalLit -> PostTc GhcPs Type -> HsOverLit GhcPs #

mkHsIsString :: SourceText -> FastString -> PostTc GhcPs Type -> 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, [Located (FunDep (Located RdrName))]) -> 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) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> HsDeriving GhcPs -> P (LInstDecl GhcPs) #

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

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

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 #

splitCon :: LHsType GhcPs -> P (Located RdrName, HsConDeclDetails 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)], Bool) -> P (HsExpr GhcPs) #

mkTyClD :: LTyClDecl n -> LHsDecl n #

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 n -> LHsDecl n #

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.

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 :: LHsExpr GhcPs #

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] -> LHsSigType GhcPs -> ConDecl GhcPs #

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

mkATDefault :: LTyFamInstDecl GhcPs -> Either (SrcSpan, SDoc) (LTyFamDefltEqn GhcPs) #

checkPrecP :: Located (SourceText, Int) -> P (Located (SourceText, Int)) #

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 :: SDoc -> LHsExpr GhcPs -> P (LPat GhcPs) #

bang_RDR :: RdrName #

checkPatterns :: SDoc -> [LHsExpr GhcPs] -> P [LPat GhcPs] #

checkMonadComp :: P (HsStmtContext Name) #

checkCommand :: LHsExpr GhcPs -> P (LHsCmd GhcPs) #

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

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

checkDoAndIfThenElse :: LHsExpr GhcPs -> Bool -> LHsExpr GhcPs -> Bool -> LHsExpr GhcPs -> P () #

checkRecordSyntax :: Outputable a => Located a -> P (Located a) #

parseErrorSDoc :: SrcSpan -> SDoc -> P a #

splitTilde :: LHsType GhcPs -> P (LHsType GhcPs) #

Transform btype_no_ops with strict_mark's into HsEqTy's (((~a) ~b) c) ~d ==> ((~a) ~ (b c)) ~ d

splitTildeApps :: [LHsAppType GhcPs] -> P [LHsAppType GhcPs] #

Transform tyapps with strict_marks into uses of twiddle [~a, ~b, c, ~d] ==> (~a) ~ b c ~ d

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

data SumOrTuple #

Constructors

Sum ConTag Arity (LHsExpr GhcPs) |
Tuple [LHsTupArg GhcPs] |

mkSumOrTuple :: Boxity -> SrcSpan -> SumOrTuple -> P (HsExpr GhcPs) #