| haskell-src-exts-1.9.0: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer | Source code | Contents | Index
Language.Haskell.Exts.Build |
Portability | portable
Stability | experimental
Maintainer | Niklas Broberg, d00nibro@chalmers.se
Contents
Syntax building functions More advanced building
Description
This module contains combinators to use when building Haskell source trees programmatically, as opposed to parsing them from a string. The contents here are quite experimental and will likely receive a lot of attention when the rest has stabilised.
Synopsis
name :: String -> Name
sym :: String -> Name
var :: Name -> Exp
op :: Name -> QOp
qvar :: ModuleName -> Name -> Exp
pvar :: Name -> Pat
app :: Exp -> Exp -> Exp
infixApp :: Exp -> QOp -> Exp -> Exp
appFun :: Exp -> [Exp] -> Exp
pApp :: Name -> [Pat] -> Pat
tuple :: [Exp] -> Exp
pTuple :: [Pat] -> Pat
varTuple :: [Name] -> Exp
pvarTuple :: [Name] -> Pat
function :: String -> Exp
strE :: String -> Exp
charE :: Char -> Exp
intE :: Integer -> Exp
strP :: String -> Pat
charP :: Char -> Pat
intP :: Integer -> Pat
doE :: [Stmt] -> Exp
lamE :: SrcLoc -> [Pat] -> Exp -> Exp
letE :: [Decl] -> Exp -> Exp
caseE :: Exp -> [Alt] -> Exp
alt :: SrcLoc -> Pat -> Exp -> Alt
altGW :: SrcLoc -> Pat -> [Stmt] -> Exp -> Binds -> Alt
listE :: [Exp] -> Exp
eList :: Exp
peList :: Pat
paren :: Exp -> Exp
pParen :: Pat -> Pat
qualStmt :: Exp -> Stmt
genStmt :: SrcLoc -> Pat -> Exp -> Stmt
letStmt :: [Decl] -> Stmt
binds :: [Decl] -> Binds
noBinds :: Binds
wildcard :: Pat
genNames :: String -> Int -> [Name]
sfun :: SrcLoc -> Name -> [Name] -> Rhs -> Binds -> Decl
simpleFun :: SrcLoc -> Name -> Name -> Exp -> Decl
patBind :: SrcLoc -> Pat -> Exp -> Decl
patBindWhere :: SrcLoc -> Pat -> Exp -> [Decl] -> Decl
nameBind :: SrcLoc -> Name -> Exp -> Decl
metaFunction :: String -> [Exp] -> Exp
metaConPat :: String -> [Pat] -> Pat
Syntax building functions
name :: String -> Name | Source
An identifier with the given string as its name. The string should be a valid Haskell identifier.
sym :: String -> Name | Source
A symbol identifier. The string should be a valid Haskell symbol identifier.
var :: Name -> Exp | Source
A local variable as expression.
op :: Name -> QOp | Source
Use the given identifier as an operator.
qvar :: ModuleName -> Name -> Exp | Source
A qualified variable as expression.
pvar :: Name -> Pat | Source
A pattern variable.
app :: Exp -> Exp -> Exp | Source
Application of expressions by juxtaposition.
infixApp :: Exp -> QOp -> Exp -> Exp | Source
Apply an operator infix.
appFun :: Exp -> [Exp] -> Exp | Source
Apply a function to a list of arguments.
pApp :: Name -> [Pat] -> Pat | Source
A constructor pattern, with argument patterns.
tuple :: [Exp] -> Exp | Source
A tuple expression.
pTuple :: [Pat] -> Pat | Source
A tuple pattern.
varTuple :: [Name] -> Exp | Source
A tuple expression consisting of variables only.
pvarTuple :: [Name] -> Pat | Source
A tuple pattern consisting of variables only.
function :: String -> Exp | Source
A function with a given name.
strE :: String -> Exp | Source
A literal string expression.
charE :: Char -> Exp | Source
A literal character expression.
intE :: Integer -> Exp | Source
A literal integer expression.
strP :: String -> Pat | Source
A literal string pattern.
charP :: Char -> Pat | Source
A literal character pattern.
intP :: Integer -> Pat | Source
A literal integer pattern.
doE :: [Stmt] -> Exp | Source
A do block formed by the given statements. The last statement in the list should be a `Qualifier` expression.
lamE :: SrcLoc -> [Pat] -> Exp -> Exp | Source
Lambda abstraction, given a list of argument patterns and an expression body.
letE :: [Decl] -> Exp -> Exp | Source
A `let` ... `in` block.
caseE :: Exp -> [Alt] -> Exp | Source
A `case` expression.
alt :: SrcLoc -> Pat -> Exp -> Alt | Source
An unguarded alternative in a `case` expression.
altGW :: SrcLoc -> Pat -> [Stmt] -> Exp -> Binds -> Alt | Source
An alternative with a single guard in a `case` expression.
listE :: [Exp] -> Exp | Source
A list expression.
eList :: Exp | Source
The empty list expression.
peList :: Pat | Source
The empty list pattern.
paren :: Exp -> Exp | Source
Put parentheses around an expression.
pParen :: Pat -> Pat | Source
Put parentheses around a pattern.
qualStmt :: Exp -> Stmt | Source
A qualifier expression statement.
genStmt :: SrcLoc -> Pat -> Exp -> Stmt | Source
A generator statement: pat `<-` exp
letStmt :: [Decl] -> Stmt | Source
A `let` binding group as a statement.
binds :: [Decl] -> Binds | Source
Hoist a set of declarations to a binding group.
noBinds :: Binds | Source
An empty binding group.
wildcard :: Pat | Source
The wildcard pattern: `_`
genNames :: String -> Int -> [Name] | Source
Generate k names by appending numbers 1 through k to a given string.
More advanced building
sfun :: SrcLoc -> Name -> [Name] -> Rhs -> Binds -> Decl | Source
A function with a single clause
simpleFun :: SrcLoc -> Name -> Name -> Exp -> Decl | Source
A function with a single clause, a single argument, no guards and no where declarations
patBind :: SrcLoc -> Pat -> Exp -> Decl | Source
A pattern bind where the pattern is a variable, and where there are no guards and no 'where' clause.
patBindWhere :: SrcLoc -> Pat -> Exp -> [Decl] -> Decl | Source
A pattern bind where the pattern is a variable, and where there are no guards, but with a 'where' clause.
nameBind :: SrcLoc -> Name -> Exp -> Decl | Source
Bind an identifier to an expression.
metaFunction :: String -> [Exp] -> Exp | Source
Apply function of a given name to a list of arguments.
metaConPat :: String -> [Pat] -> Pat | Source
Apply a constructor of a given name to a list of pattern arguments, forming a constructor pattern.
Produced by Haddock version 2.4.2