RdrHsSyn

ghc-8.0.1: 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 #

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 #

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 RdrName -> HsExpr RdrName #

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

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

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 #

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

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

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

data ImpExpSubSpec #

Constructors

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