ghc-7.10.3: 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

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

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

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

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

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)

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

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

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

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

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

data ImpExpSubSpec

Constructors

ImpExpAbs |
ImpExpAll |
ImpExpList [Located RdrName] |

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

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