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