RdrHsSyn

ghc-7.10.2: 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] -> Maybe (Located [LHsType RdrName]) -> P (LTyClDecl RdrName)
- mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Maybe (LHsKind RdrName) -> [LConDecl RdrName] -> Maybe (Located [LHsType 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 -> Maybe (LHsKind RdrName) -> P (LTyClDecl 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
- 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 FastString, Located RdrName, LHsType RdrName) -> P (HsDecl RdrName)
- parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText -> Maybe ForeignImport
- mkExport :: Located CCallConv -> (Located FastString, Located RdrName, LHsType RdrName) -> P (HsDecl RdrName)
- mkExtName :: RdrName -> CLabelString
- mkGadtDecl :: [Located RdrName] -> LHsType RdrName -> P ([AddAnn], ConDecl RdrName)
- mkSimpleConDecl :: Located RdrName -> [LHsTyVarBndr RdrName] -> LHsContext RdrName -> HsConDeclDetails RdrName -> ConDecl RdrName
- mkDeprecatedGadtRecordDecl :: SrcSpan -> Located RdrName -> Located [LConDeclField RdrName] -> LHsType RdrName -> P (LConDecl RdrName)
- mkATDefault :: LTyFamInstDecl RdrName -> Either (SrcSpan, SDoc) (LTyFamDefltEqn RdrName)
- checkPrecP :: Located Int -> P (Located 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)
- checkValSig :: LHsExpr RdrName -> LHsType RdrName -> P (Sig RdrName)
- checkPartialTypeSignature :: LHsType RdrName -> P (LHsType RdrName)
- checkNoPartialType :: SDoc -> LHsType RdrName -> P ()
- checkValidPatSynSig :: Sig RdrName -> P (Sig RdrName)
- checkDoAndIfThenElse :: LHsExpr RdrName -> Bool -> LHsExpr RdrName -> Bool -> LHsExpr RdrName -> P ()
- checkRecordSyntax :: Outputable a => Located a -> P (Located a)
- checkValidDefaults :: [LHsType RdrName] -> P (DefaultDecl RdrName)
- parseErrorSDoc :: SrcSpan -> SDoc -> P a
- data ImpExpSubSpec
  - = ImpExpAbs
  - | ImpExpAll
  - | ImpExpList [Located RdrName]
- mkModuleImpExp :: Located RdrName -> ImpExpSubSpec -> IE RdrName
- mkTypeImpExp :: Located RdrName -> P (Located 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] -> Maybe (Located [LHsType RdrName]) -> P (LTyClDecl RdrName) Source

mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Maybe (LHsKind RdrName) -> [LConDecl RdrName] -> Maybe (Located [LHsType 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 -> Maybe (LHsKind RdrName) -> P (LTyClDecl 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

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 FastString, Located RdrName, LHsType RdrName) -> P (HsDecl RdrName) Source

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

mkExport :: Located CCallConv -> (Located FastString, Located RdrName, LHsType RdrName) -> P (HsDecl RdrName) Source

mkExtName :: RdrName -> CLabelString Source

mkGadtDecl :: [Located RdrName] -> LHsType RdrName -> P ([AddAnn], ConDecl RdrName) Source

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

mkDeprecatedGadtRecordDecl :: SrcSpan -> Located RdrName -> Located [LConDeclField RdrName] -> LHsType RdrName -> P (LConDecl RdrName) Source

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

checkPrecP :: Located Int -> P (Located 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

checkValSig :: LHsExpr RdrName -> LHsType RdrName -> P (Sig RdrName) Source

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

Check the validity of a partial type signature. We check the following things:

- There should only be one extra-constraints wildcard in the type signature, i.e. the `_` in `_ => a -> String`. This would be invalid: `(Eq a, _) => a -> (Num a, _) => a -> Bool`. Extra-constraints wildcards are only allowed in the top-level context.
- Named extra-constraints wildcards aren't allowed, e.g. invalid: `(Show a, _x) => a -> String`.
- There is only one extra-constraints wildcard in the context and it must come last, e.g. invalid: `(_, Show a) => a -> String` or `(_, Show a, _) => a -> String`.
- There should be no unnamed wildcards in the context.
- Named wildcards occurring in the context must also occur in the monotype.

An error is reported when an invalid wildcard is found.

checkNoPartialType :: SDoc -> LHsType RdrName -> P () Source

Check that the given type does not contain wildcards, and is thus not a partial type. If it contains wildcards, report an error with the given message.

checkValidPatSynSig :: Sig RdrName -> P (Sig RdrName) Source

Check that the pattern synonym type signature does not contain wildcards.

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

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

checkValidDefaults :: [LHsType RdrName] -> P (DefaultDecl RdrName) Source

Check that the default declarations do not contain wildcards in their types, which we do not want as the types in the default declarations must be fully specified.

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

data ImpExpSubSpec Source

Constructors

ImpExpAbs |
ImpExpAll |
ImpExpList [Located RdrName] |

mkModuleImpExp :: Located RdrName -> ImpExpSubSpec -> IE RdrName Source

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