RdrHsSyn

ghc-8.0.0.20160204: The GHC API

Safe Haskell | None
Language | Haskell2010

RdrHsSyn

Synopsis

- mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id
- mkHsIntegral :: String -> Integer -> PostTc RdrName Type -> HsOverLit RdrName
- mkHsFractional :: FractionalLit -> PostTc RdrName Type -> HsOverLit RdrName
- mkHsIsString :: String -> FastString -> PostTc RdrName Type -> HsOverLit RdrName
- mkHsDo :: HsStmtContext Name -> [ExprLStmt RdrName] -> HsExpr RdrName
- mkSpliceDecl :: LHsExpr RdrName -> HsDecl RdrName
- mkRoleAnnotDecl :: SrcSpan -> Located RdrName -> [Located (Maybe FastString)] -> P (LRoleAnnotDecl RdrName)
- mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Located (a, [Located (FunDep (Located RdrName))]) -> OrdList (LHsDecl RdrName) -> P (LTyClDecl RdrName)
- mkTyData :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Maybe (LHsKind RdrName) -> [LConDecl RdrName] -> HsDeriving RdrName -> P (LTyClDecl RdrName)
- mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Maybe (LHsKind RdrName) -> [LConDecl RdrName] -> HsDeriving RdrName -> P (LInstDecl RdrName)
- mkTySynonym :: SrcSpan -> LHsType RdrName -> LHsType RdrName -> P (LTyClDecl RdrName)
- mkTyFamInstEqn :: LHsType RdrName -> LHsType RdrName -> P (TyFamInstEqn RdrName, [AddAnn])
- mkTyFamInst :: SrcSpan -> LTyFamInstEqn RdrName -> P (LInstDecl RdrName)
- mkFamDecl :: SrcSpan -> FamilyInfo RdrName -> LHsType RdrName -> Located (FamilyResultSig RdrName) -> Maybe (LInjectivityAnn RdrName) -> P (LTyClDecl RdrName)
- mkLHsSigType :: LHsType RdrName -> LHsSigType RdrName
- splitCon :: LHsType RdrName -> P (Located RdrName, HsConDeclDetails RdrName)
- mkInlinePragma :: String -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma
- mkPatSynMatchGroup :: Located RdrName -> Located (OrdList (LHsDecl RdrName)) -> P (MatchGroup RdrName (LHsExpr RdrName))
- mkRecConstrOrUpdate :: LHsExpr RdrName -> SrcSpan -> ([LHsRecField RdrName (LHsExpr RdrName)], Bool) -> P (HsExpr RdrName)
- mkTyClD :: LTyClDecl n -> LHsDecl n
- mkInstD :: LInstDecl n -> LHsDecl n
- mkRdrRecordCon :: Located RdrName -> HsRecordBinds RdrName -> HsExpr RdrName
- mkRdrRecordUpd :: LHsExpr RdrName -> [LHsRecUpdField RdrName] -> HsExpr RdrName
- setRdrNameSpace :: RdrName -> NameSpace -> RdrName
- cvBindGroup :: OrdList (LHsDecl RdrName) -> P (HsValBinds RdrName)
- cvBindsAndSigs :: OrdList (LHsDecl RdrName) -> P (LHsBinds RdrName, [LSig RdrName], [LFamilyDecl RdrName], [LTyFamInstDecl RdrName], [LDataFamInstDecl RdrName], [LDocDecl])
- cvTopDecls :: OrdList (LHsDecl RdrName) -> [LHsDecl RdrName]
- placeHolderPunRhs :: LHsExpr RdrName
- mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, Located RdrName, LHsSigType RdrName) -> P (HsDecl RdrName)
- parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText -> Maybe ForeignImport
- mkExport :: Located CCallConv -> (Located StringLiteral, Located RdrName, LHsSigType RdrName) -> P (HsDecl RdrName)
- mkExtName :: RdrName -> CLabelString
- mkGadtDecl :: [Located RdrName] -> LHsSigType RdrName -> ConDecl RdrName
- mkConDeclH98 :: Located RdrName -> Maybe [LHsTyVarBndr RdrName] -> LHsContext RdrName -> HsConDeclDetails RdrName -> ConDecl RdrName
- mkATDefault :: LTyFamInstDecl RdrName -> Either (SrcSpan, SDoc) (LTyFamDefltEqn RdrName)
- checkPrecP :: Located (SourceText, Int) -> P (Located (SourceText, Int))
- checkContext :: LHsType RdrName -> P ([AddAnn], LHsContext RdrName)
- checkPattern :: SDoc -> LHsExpr RdrName -> P (LPat RdrName)
- bang_RDR :: RdrName
- checkPatterns :: SDoc -> [LHsExpr RdrName] -> P [LPat RdrName]
- checkMonadComp :: P (HsStmtContext Name)
- checkCommand :: LHsExpr RdrName -> P (LHsCmd RdrName)
- checkValDef :: SDoc -> LHsExpr RdrName -> Maybe (LHsType RdrName) -> Located (a, GRHSs RdrName (LHsExpr RdrName)) -> P ([AddAnn], HsBind RdrName)
- checkValSigLhs :: LHsExpr RdrName -> P (Located RdrName)
- checkDoAndIfThenElse :: LHsExpr RdrName -> Bool -> LHsExpr RdrName -> Bool -> LHsExpr RdrName -> P ()
- checkRecordSyntax :: Outputable a => Located a -> P (Located a)
- parseErrorSDoc :: SrcSpan -> SDoc -> P a
- splitTilde :: LHsType RdrName -> P (LHsType RdrName)
- splitTildeApps :: [LHsAppType RdrName] -> P [LHsAppType RdrName]
- data ImpExpSubSpec
  - = ImpExpAbs
  - | ImpExpAll
  - | ImpExpList [Located RdrName]
  - | ImpExpAllWith [Located (Maybe RdrName)]
- mkModuleImpExp :: Located RdrName -> ImpExpSubSpec -> P (IE RdrName)
- mkTypeImpExp :: Located RdrName -> P (Located RdrName)
- mkImpExpSubSpec :: [Located (Maybe RdrName)] -> P ([AddAnn], ImpExpSubSpec)
- checkImportSpec :: Located [LIE RdrName] -> P (Located [LIE RdrName])

# Documentation

mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id Source

mkHsIntegral :: String -> Integer -> PostTc RdrName Type -> HsOverLit RdrName Source

mkHsFractional :: FractionalLit -> PostTc RdrName Type -> HsOverLit RdrName Source

mkHsIsString :: String -> FastString -> PostTc RdrName Type -> HsOverLit RdrName Source

mkHsDo :: HsStmtContext Name -> [ExprLStmt RdrName] -> HsExpr RdrName Source

mkSpliceDecl :: LHsExpr RdrName -> HsDecl RdrName Source

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

mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Located (a, [Located (FunDep (Located RdrName))]) -> OrdList (LHsDecl RdrName) -> P (LTyClDecl RdrName) Source

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

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

mkTySynonym :: SrcSpan -> LHsType RdrName -> LHsType RdrName -> P (LTyClDecl RdrName) Source

mkTyFamInstEqn :: LHsType RdrName -> LHsType RdrName -> P (TyFamInstEqn RdrName, [AddAnn]) Source

mkTyFamInst :: SrcSpan -> LTyFamInstEqn RdrName -> P (LInstDecl RdrName) Source

mkFamDecl :: SrcSpan -> FamilyInfo RdrName -> LHsType RdrName -> Located (FamilyResultSig RdrName) -> Maybe (LInjectivityAnn RdrName) -> P (LTyClDecl RdrName) Source

mkLHsSigType :: LHsType RdrName -> LHsSigType RdrName Source

splitCon :: LHsType RdrName -> P (Located RdrName, HsConDeclDetails RdrName) Source

mkInlinePragma :: String -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma Source

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

mkRecConstrOrUpdate :: LHsExpr RdrName -> SrcSpan -> ([LHsRecField RdrName (LHsExpr RdrName)], Bool) -> P (HsExpr RdrName) Source

mkTyClD :: LTyClDecl n -> LHsDecl n 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).

mkInstD :: LInstDecl n -> LHsDecl n Source

mkRdrRecordCon :: Located RdrName -> HsRecordBinds RdrName -> HsExpr RdrName Source

mkRdrRecordUpd :: LHsExpr RdrName -> [LHsRecUpdField RdrName] -> HsExpr RdrName 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.

cvBindGroup :: OrdList (LHsDecl RdrName) -> P (HsValBinds RdrName) Source

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

cvTopDecls :: OrdList (LHsDecl RdrName) -> [LHsDecl RdrName] Source

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

placeHolderPunRhs :: LHsExpr RdrName Source

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

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

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

mkExtName :: RdrName -> CLabelString Source

mkGadtDecl :: [Located RdrName] -> LHsSigType RdrName -> ConDecl RdrName Source

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

mkATDefault :: LTyFamInstDecl RdrName -> Either (SrcSpan, SDoc) (LTyFamDefltEqn RdrName) Source

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

checkContext :: LHsType RdrName -> P ([AddAnn], LHsContext RdrName) Source

checkPattern :: SDoc -> LHsExpr RdrName -> P (LPat RdrName) Source

bang_RDR :: RdrName Source

checkPatterns :: SDoc -> [LHsExpr RdrName] -> P [LPat RdrName] Source

checkMonadComp :: P (HsStmtContext Name) Source

checkCommand :: LHsExpr RdrName -> P (LHsCmd RdrName) Source

checkValDef :: SDoc -> LHsExpr RdrName -> Maybe (LHsType RdrName) -> Located (a, GRHSs RdrName (LHsExpr RdrName)) -> P ([AddAnn], HsBind RdrName) Source

checkValSigLhs :: LHsExpr RdrName -> P (Located RdrName) Source

checkDoAndIfThenElse :: LHsExpr RdrName -> Bool -> LHsExpr RdrName -> Bool -> LHsExpr RdrName -> P () Source

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

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

splitTilde :: LHsType RdrName -> P (LHsType RdrName) Source

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

splitTildeApps :: [LHsAppType RdrName] -> P [LHsAppType RdrName] Source

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

data ImpExpSubSpec Source

Constructors

ImpExpAbs |
ImpExpAll |
ImpExpList [Located RdrName] |
ImpExpAllWith [Located (Maybe RdrName)] |

mkModuleImpExp :: Located RdrName -> ImpExpSubSpec -> P (IE RdrName) Source

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

mkImpExpSubSpec :: [Located (Maybe RdrName)] -> P ([AddAnn], ImpExpSubSpec) Source

checkImportSpec :: Located [LIE RdrName] -> P (Located [LIE RdrName]) Source