ghc-7.10.2: The GHC API

Safe Haskell | None
Language | Haskell2010

HsUtils

Synopsis

- mkHsPar :: LHsExpr id -> LHsExpr id
- mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name
- mkHsConApp :: DataCon -> [Type] -> [HsExpr Id] -> LHsExpr Id
- mkSimpleHsAlt :: LPat id -> Located (body id) -> LMatch id (Located (body id))
- mkSimpleMatch :: [LPat id] -> Located (body id) -> LMatch id (Located (body id))
- unguardedGRHSs :: Located (body id) -> GRHSs id (Located (body id))
- unguardedRHS :: SrcSpan -> Located (body id) -> [LGRHS id (Located (body id))]
- mkMatchGroup :: Origin -> [LMatch RdrName (Located (body RdrName))] -> MatchGroup RdrName (Located (body RdrName))
- mkMatchGroupName :: Origin -> [LMatch Name (Located (body Name))] -> MatchGroup Name (Located (body Name))
- mkMatch :: [LPat id] -> LHsExpr id -> HsLocalBinds id -> LMatch id (LHsExpr id)
- mkHsLam :: [LPat RdrName] -> LHsExpr RdrName -> LHsExpr RdrName
- mkHsIf :: LHsExpr id -> LHsExpr id -> LHsExpr id -> HsExpr id
- mkHsWrap :: HsWrapper -> HsExpr id -> HsExpr id
- mkLHsWrap :: HsWrapper -> LHsExpr id -> LHsExpr id
- mkHsWrapCo :: TcCoercion -> HsExpr id -> HsExpr id
- mkHsWrapCoR :: TcCoercion -> HsExpr id -> HsExpr id
- mkLHsWrapCo :: TcCoercion -> LHsExpr id -> LHsExpr id
- coToHsWrapper :: TcCoercion -> HsWrapper
- mkHsDictLet :: TcEvBinds -> LHsExpr Id -> LHsExpr Id
- mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr Id -> LHsExpr Id
- mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id
- mkHsDo :: HsStmtContext Name -> [ExprLStmt RdrName] -> HsExpr RdrName
- mkHsComp :: HsStmtContext Name -> [ExprLStmt RdrName] -> LHsExpr RdrName -> HsExpr RdrName
- mkHsWrapPat :: HsWrapper -> Pat id -> Type -> Pat id
- mkHsWrapPatCo :: TcCoercion -> Pat id -> Type -> Pat id
- mkLHsPar :: LHsExpr name -> LHsExpr name
- mkHsCmdCast :: TcCoercion -> HsCmd id -> HsCmd id
- nlHsTyApp :: name -> [Type] -> LHsExpr name
- nlHsTyApps :: name -> [Type] -> [LHsExpr name] -> LHsExpr name
- nlHsVar :: id -> LHsExpr id
- nlHsLit :: HsLit -> LHsExpr id
- nlHsApp :: LHsExpr id -> LHsExpr id -> LHsExpr id
- nlHsApps :: id -> [LHsExpr id] -> LHsExpr id
- nlHsIntLit :: Integer -> LHsExpr id
- nlHsVarApps :: id -> [id] -> LHsExpr id
- nlHsDo :: HsStmtContext Name -> [LStmt RdrName (LHsExpr RdrName)] -> LHsExpr RdrName
- nlHsOpApp :: LHsExpr id -> id -> LHsExpr id -> LHsExpr id
- nlHsLam :: LMatch RdrName (LHsExpr RdrName) -> LHsExpr RdrName
- nlHsPar :: LHsExpr id -> LHsExpr id
- nlHsIf :: LHsExpr id -> LHsExpr id -> LHsExpr id -> LHsExpr id
- nlHsCase :: LHsExpr RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> LHsExpr RdrName
- nlList :: [LHsExpr RdrName] -> LHsExpr RdrName
- mkLHsTupleExpr :: [LHsExpr a] -> LHsExpr a
- mkLHsVarTuple :: [a] -> LHsExpr a
- missingTupArg :: HsTupArg RdrName
- toHsType :: Type -> LHsType RdrName
- toHsKind :: Kind -> LHsKind RdrName
- mkFunBind :: Located RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> HsBind RdrName
- mkVarBind :: id -> LHsExpr id -> LHsBind id
- mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr RdrName -> LHsBind RdrName
- mk_easy_FunBind :: SrcSpan -> RdrName -> [LPat RdrName] -> LHsExpr RdrName -> LHsBind RdrName
- mkTopFunBind :: Origin -> Located Name -> [LMatch Name (LHsExpr Name)] -> HsBind Name
- mkPatSynBind :: Located RdrName -> HsPatSynDetails (Located RdrName) -> LPat RdrName -> HsPatSynDir RdrName -> HsBind RdrName
- mkHsIntegral :: String -> Integer -> PostTc RdrName Type -> HsOverLit RdrName
- mkHsFractional :: FractionalLit -> PostTc RdrName Type -> HsOverLit RdrName
- mkHsIsString :: String -> FastString -> PostTc RdrName Type -> HsOverLit RdrName
- mkHsString :: String -> HsLit
- mkNPat :: Located (HsOverLit id) -> Maybe (SyntaxExpr id) -> Pat id
- mkNPlusKPat :: Located id -> Located (HsOverLit id) -> Pat id
- nlVarPat :: id -> LPat id
- nlLitPat :: HsLit -> LPat id
- nlConVarPat :: RdrName -> [RdrName] -> LPat RdrName
- nlConPat :: RdrName -> [LPat RdrName] -> LPat RdrName
- nlConPatName :: Name -> [LPat Name] -> LPat Name
- nlInfixConPat :: id -> LPat id -> LPat id -> LPat id
- nlNullaryConPat :: id -> LPat id
- nlWildConPat :: DataCon -> LPat RdrName
- nlWildPat :: LPat RdrName
- nlWildPatName :: LPat Name
- nlWildPatId :: LPat Id
- nlTuplePat :: [LPat id] -> Boxity -> LPat id
- mkParPat :: LPat name -> LPat name
- mkHsAppTy :: LHsType name -> LHsType name -> LHsType name
- userHsTyVarBndrs :: SrcSpan -> [name] -> [Located (HsTyVarBndr name)]
- nlHsAppTy :: LHsType name -> LHsType name -> LHsType name
- nlHsTyVar :: name -> LHsType name
- nlHsFunTy :: LHsType name -> LHsType name -> LHsType name
- nlHsTyConApp :: name -> [LHsType name] -> LHsType name
- mkTransformStmt :: [ExprLStmt idL] -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
- mkTransformByStmt :: [ExprLStmt idL] -> LHsExpr idR -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
- mkBodyStmt :: Located (bodyR RdrName) -> StmtLR idL RdrName (Located (bodyR RdrName))
- mkBindStmt :: LPat idL -> Located (bodyR idR) -> StmtLR idL idR (Located (bodyR idR))
- mkLastStmt :: Located (bodyR idR) -> StmtLR idL idR (Located (bodyR idR))
- emptyTransStmt :: StmtLR idL idR (LHsExpr idR)
- mkGroupUsingStmt :: [ExprLStmt idL] -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
- mkGroupByUsingStmt :: [ExprLStmt idL] -> LHsExpr idR -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
- emptyRecStmt :: StmtLR idL RdrName bodyR
- emptyRecStmtName :: StmtLR Name Name bodyR
- emptyRecStmtId :: StmtLR Id Id bodyR
- mkRecStmt :: [LStmtLR idL RdrName bodyR] -> StmtLR idL RdrName bodyR
- mkHsSpliceTy :: LHsExpr RdrName -> HsType RdrName
- mkHsSpliceE :: LHsExpr RdrName -> HsExpr RdrName
- mkHsSpliceTE :: LHsExpr RdrName -> HsExpr RdrName
- mkHsSplice :: LHsExpr RdrName -> HsSplice RdrName
- mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsQuasiQuote RdrName
- unqualQuasiQuote :: RdrName
- noRebindableInfo :: PlaceHolder
- collectLocalBinders :: HsLocalBindsLR idL idR -> [idL]
- collectHsValBinders :: HsValBindsLR idL idR -> [idL]
- collectHsBindListBinders :: [LHsBindLR idL idR] -> [idL]
- collectHsIdBinders :: HsValBindsLR idL idR -> [idL]
- collectHsBindsBinders :: LHsBindsLR idL idR -> [idL]
- collectHsBindBinders :: HsBindLR idL idR -> [idL]
- collectMethodBinders :: LHsBindsLR RdrName idR -> [Located RdrName]
- collectPatBinders :: LPat a -> [a]
- collectPatsBinders :: [LPat a] -> [a]
- collectLStmtsBinders :: [LStmtLR idL idR body] -> [idL]
- collectStmtsBinders :: [StmtLR idL idR body] -> [idL]
- collectLStmtBinders :: LStmtLR idL idR body -> [idL]
- collectStmtBinders :: StmtLR idL idR body -> [idL]
- hsLTyClDeclBinders :: Eq name => Located (TyClDecl name) -> [Located name]
- hsTyClForeignBinders :: [TyClGroup Name] -> [LInstDecl Name] -> [LForeignDecl Name] -> [Name]
- hsPatSynBinders :: LHsBindsLR idL idR -> [Located idL]
- hsForeignDeclsBinders :: [LForeignDecl name] -> [Located name]
- hsGroupBinders :: HsGroup Name -> [Name]
- hsDataFamInstBinders :: Eq name => DataFamInstDecl name -> [Located name]
- lStmtsImplicits :: [LStmtLR Name idR (Located (body idR))] -> NameSet
- hsValBindsImplicits :: HsValBindsLR Name idR -> NameSet
- lPatImplicits :: LPat Name -> NameSet

# Documentation

mkHsPar :: LHsExpr id -> LHsExpr id Source

mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name Source

mkHsConApp :: DataCon -> [Type] -> [HsExpr Id] -> LHsExpr Id Source

mkSimpleHsAlt :: LPat id -> Located (body id) -> LMatch id (Located (body id)) Source

mkSimpleMatch :: [LPat id] -> Located (body id) -> LMatch id (Located (body id)) Source

unguardedGRHSs :: Located (body id) -> GRHSs id (Located (body id)) Source

unguardedRHS :: SrcSpan -> Located (body id) -> [LGRHS id (Located (body id))] Source

mkMatchGroup :: Origin -> [LMatch RdrName (Located (body RdrName))] -> MatchGroup RdrName (Located (body RdrName)) Source

mkMatchGroupName :: Origin -> [LMatch Name (Located (body Name))] -> MatchGroup Name (Located (body Name)) Source

mkMatch :: [LPat id] -> LHsExpr id -> HsLocalBinds id -> LMatch id (LHsExpr id) Source

mkHsLam :: [LPat RdrName] -> LHsExpr RdrName -> LHsExpr RdrName Source

mkHsIf :: LHsExpr id -> LHsExpr id -> LHsExpr id -> HsExpr id Source

mkHsWrap :: HsWrapper -> HsExpr id -> HsExpr id Source

mkLHsWrap :: HsWrapper -> LHsExpr id -> LHsExpr id Source

mkHsWrapCo :: TcCoercion -> HsExpr id -> HsExpr id Source

mkHsWrapCoR :: TcCoercion -> HsExpr id -> HsExpr id Source

mkLHsWrapCo :: TcCoercion -> LHsExpr id -> LHsExpr id Source

coToHsWrapper :: TcCoercion -> HsWrapper Source

mkHsDictLet :: TcEvBinds -> LHsExpr Id -> LHsExpr Id Source

mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr Id -> LHsExpr Id Source

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

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

mkHsComp :: HsStmtContext Name -> [ExprLStmt RdrName] -> LHsExpr RdrName -> HsExpr RdrName Source

mkHsWrapPat :: HsWrapper -> Pat id -> Type -> Pat id Source

mkHsWrapPatCo :: TcCoercion -> Pat id -> Type -> Pat id Source

mkLHsPar :: LHsExpr name -> LHsExpr name Source

mkHsCmdCast :: TcCoercion -> HsCmd id -> HsCmd id Source

nlHsTyApp :: name -> [Type] -> LHsExpr name Source

nlHsTyApps :: name -> [Type] -> [LHsExpr name] -> LHsExpr name Source

nlHsVar :: id -> LHsExpr id Source

nlHsLit :: HsLit -> LHsExpr id Source

nlHsApp :: LHsExpr id -> LHsExpr id -> LHsExpr id Source

nlHsApps :: id -> [LHsExpr id] -> LHsExpr id Source

nlHsIntLit :: Integer -> LHsExpr id Source

nlHsVarApps :: id -> [id] -> LHsExpr id Source

nlHsDo :: HsStmtContext Name -> [LStmt RdrName (LHsExpr RdrName)] -> LHsExpr RdrName Source

nlHsOpApp :: LHsExpr id -> id -> LHsExpr id -> LHsExpr id Source

nlHsLam :: LMatch RdrName (LHsExpr RdrName) -> LHsExpr RdrName Source

nlHsPar :: LHsExpr id -> LHsExpr id Source

nlHsIf :: LHsExpr id -> LHsExpr id -> LHsExpr id -> LHsExpr id Source

nlHsCase :: LHsExpr RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> LHsExpr RdrName Source

nlList :: [LHsExpr RdrName] -> LHsExpr RdrName Source

mkLHsTupleExpr :: [LHsExpr a] -> LHsExpr a Source

mkLHsVarTuple :: [a] -> LHsExpr a Source

missingTupArg :: HsTupArg RdrName Source

toHsType :: Type -> LHsType RdrName Source

toHsKind :: Kind -> LHsKind RdrName Source

mkFunBind :: Located RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> HsBind RdrName Source

mkVarBind :: id -> LHsExpr id -> LHsBind id Source

mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr RdrName -> LHsBind RdrName Source

mk_easy_FunBind :: SrcSpan -> RdrName -> [LPat RdrName] -> LHsExpr RdrName -> LHsBind RdrName Source

mkTopFunBind :: Origin -> Located Name -> [LMatch Name (LHsExpr Name)] -> HsBind Name Source

mkPatSynBind :: Located RdrName -> HsPatSynDetails (Located RdrName) -> LPat RdrName -> HsPatSynDir RdrName -> HsBind RdrName 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

mkHsString :: String -> HsLit Source

mkNPat :: Located (HsOverLit id) -> Maybe (SyntaxExpr id) -> Pat id Source

mkNPlusKPat :: Located id -> Located (HsOverLit id) -> Pat id Source

nlVarPat :: id -> LPat id Source

nlLitPat :: HsLit -> LPat id Source

nlConVarPat :: RdrName -> [RdrName] -> LPat RdrName Source

nlConPat :: RdrName -> [LPat RdrName] -> LPat RdrName Source

nlConPatName :: Name -> [LPat Name] -> LPat Name Source

nlInfixConPat :: id -> LPat id -> LPat id -> LPat id Source

nlNullaryConPat :: id -> LPat id Source

nlWildConPat :: DataCon -> LPat RdrName Source

nlWildPat :: LPat RdrName Source

nlWildPatName :: LPat Name Source

nlWildPatId :: LPat Id Source

nlTuplePat :: [LPat id] -> Boxity -> LPat id Source

mkParPat :: LPat name -> LPat name Source

mkHsAppTy :: LHsType name -> LHsType name -> LHsType name Source

userHsTyVarBndrs :: SrcSpan -> [name] -> [Located (HsTyVarBndr name)] Source

nlHsAppTy :: LHsType name -> LHsType name -> LHsType name Source

nlHsTyVar :: name -> LHsType name Source

nlHsFunTy :: LHsType name -> LHsType name -> LHsType name Source

nlHsTyConApp :: name -> [LHsType name] -> LHsType name Source

mkTransformStmt :: [ExprLStmt idL] -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL) Source

mkTransformByStmt :: [ExprLStmt idL] -> LHsExpr idR -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL) Source

mkBodyStmt :: Located (bodyR RdrName) -> StmtLR idL RdrName (Located (bodyR RdrName)) Source

mkBindStmt :: LPat idL -> Located (bodyR idR) -> StmtLR idL idR (Located (bodyR idR)) Source

mkLastStmt :: Located (bodyR idR) -> StmtLR idL idR (Located (bodyR idR)) Source

emptyTransStmt :: StmtLR idL idR (LHsExpr idR) Source

mkGroupUsingStmt :: [ExprLStmt idL] -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL) Source

mkGroupByUsingStmt :: [ExprLStmt idL] -> LHsExpr idR -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL) Source

emptyRecStmt :: StmtLR idL RdrName bodyR Source

emptyRecStmtName :: StmtLR Name Name bodyR Source

emptyRecStmtId :: StmtLR Id Id bodyR Source

mkRecStmt :: [LStmtLR idL RdrName bodyR] -> StmtLR idL RdrName bodyR Source

mkHsSpliceTy :: LHsExpr RdrName -> HsType RdrName Source

mkHsSpliceE :: LHsExpr RdrName -> HsExpr RdrName Source

mkHsSpliceTE :: LHsExpr RdrName -> HsExpr RdrName Source

mkHsSplice :: LHsExpr RdrName -> HsSplice RdrName Source

mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsQuasiQuote RdrName Source

unqualQuasiQuote :: RdrName Source

noRebindableInfo :: PlaceHolder Source

collectLocalBinders :: HsLocalBindsLR idL idR -> [idL] Source

collectHsValBinders :: HsValBindsLR idL idR -> [idL] Source

collectHsBindListBinders :: [LHsBindLR idL idR] -> [idL] Source

collectHsIdBinders :: HsValBindsLR idL idR -> [idL] Source

collectHsBindsBinders :: LHsBindsLR idL idR -> [idL] Source

collectHsBindBinders :: HsBindLR idL idR -> [idL] Source

collectMethodBinders :: LHsBindsLR RdrName idR -> [Located RdrName] Source

collectPatBinders :: LPat a -> [a] Source

collectPatsBinders :: [LPat a] -> [a] Source

collectLStmtsBinders :: [LStmtLR idL idR body] -> [idL] Source

collectStmtsBinders :: [StmtLR idL idR body] -> [idL] Source

collectLStmtBinders :: LStmtLR idL idR body -> [idL] Source

collectStmtBinders :: StmtLR idL idR body -> [idL] Source

hsLTyClDeclBinders :: Eq name => Located (TyClDecl name) -> [Located name] Source

Returns all the binding names of the decl. The first one is guaranteed to be the name of the decl. For record fields mentioned in multiple constructors, the SrcLoc will be from the first occurrence. We use the equality to filter out duplicate field names.

Each returned (Located name) has a SrcSpan for the whole declaration. See Note [SrcSpan for binders]

hsTyClForeignBinders :: [TyClGroup Name] -> [LInstDecl Name] -> [LForeignDecl Name] -> [Name] Source

hsPatSynBinders :: LHsBindsLR idL idR -> [Located idL] Source

hsForeignDeclsBinders :: [LForeignDecl name] -> [Located name] Source

hsGroupBinders :: HsGroup Name -> [Name] Source

hsDataFamInstBinders :: Eq name => DataFamInstDecl name -> [Located name] Source

lStmtsImplicits :: [LStmtLR Name idR (Located (body idR))] -> NameSet Source

hsValBindsImplicits :: HsValBindsLR Name idR -> NameSet Source

lPatImplicits :: LPat Name -> NameSet Source