 | haskell-src-exts-0.4.8: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer | Contents | Index |
|
Language.Haskell.Exts.Syntax | Portability | portable | Stability | experimental | Maintainer | Niklas Broberg, d00nibro@dtek.chalmers.se |
|
|
|
|
|
Description |
A suite of datatypes describing the abstract syntax of Haskell 98
http://www.haskell.org/onlinereport/ plus some extensions:
- multi-parameter type classes with functional dependencies
- parameters of type class assertions are unrestricted
- forall types as universal and existential quantification
- pattern guards
- implicit parameters
- generalised algebraic data types
- template haskell
- empty data type declarations
- unboxed tuples
- regular patterns (HaRP)
- HSP-style XML expressions and patterns (HSP)
Also worth noting is that (n+k) patterns from Haskell 98 are not supported
|
|
Synopsis |
|
|
|
|
Modules
|
|
data Module |
A Haskell source module.
| Constructors | | Instances | |
|
|
data ExportSpec |
Export specification.
| Constructors | EVar QName | variable
| EAbs QName | T:
a class or datatype exported abstractly,
or a type synonym.
| EThingAll QName | T(..):
a class exported with all of its methods, or
a datatype exported with all of its constructors.
| EThingWith QName [CName] | T(C_1,...,C_n):
a class exported with some of its methods, or
a datatype exported with some of its constructors.
| EModuleContents ModuleName | module M:
re-export a module.
|
| Instances | |
|
|
data ImportDecl |
Import declaration.
| Constructors | ImportDecl | | importLoc :: SrcLoc | position of the import keyword.
| importModule :: ModuleName | name of the module imported.
| importQualified :: Bool | imported qualified?
| importSrc :: Bool | imported with {--}
| importAs :: Maybe ModuleName | optional alias name in an
as clause.
| importSpecs :: Maybe (Bool, [ImportSpec]) | optional list of import specifications.
The Bool is True if the names are excluded
by hiding.
|
|
| Instances | |
|
|
data ImportSpec |
Import specification.
| Constructors | IVar Name | variable
| IAbs Name | T:
the name of a class, datatype or type synonym.
| IThingAll Name | T(..):
a class imported with all of its methods, or
a datatype imported with all of its constructors.
| IThingWith Name [CName] | T(C_1,...,C_n):
a class imported with some of its methods, or
a datatype imported with some of its constructors.
|
| Instances | |
|
|
data Assoc |
Associativity of an operator.
| Constructors | AssocNone | non-associative operator (declared with infix)
| AssocLeft | left-associative operator (declared with infixl).
| AssocRight | right-associative operator (declared with infixr)
|
| Instances | |
|
|
Declarations
|
|
data Decl |
Constructors | | Instances | |
|
|
data Binds |
Constructors | | Instances | |
|
|
data IPBind |
Constructors | | Instances | |
|
|
data ClassDecl |
Declarations inside a class declaration
| Constructors | | Instances | |
|
|
data InstDecl |
Declarations inside an instance declaration
| Constructors | | Instances | |
|
|
type Deriving = (QName, [QName]) |
|
data GadtDecl |
Constructors | | Instances | |
|
|
data ConDecl |
Declaration of a data constructor.
| Constructors | | Instances | |
|
|
data QualConDecl |
Constructors | | Instances | |
|
|
data BangType |
The type of a constructor argument or field, optionally including
a strictness annotation.
| Constructors | BangedTy Type | strict component, marked with "!"
| UnBangedTy Type | non-strict component
| UnpackedTy Type | unboxed component
|
| Instances | |
|
|
data Match |
Clauses of a function binding.
| Constructors | | Instances | |
|
|
data Rhs |
The right hand side of a function or pattern binding.
| Constructors | UnGuardedRhs Exp | unguarded right hand side (exp)
| GuardedRhss [GuardedRhs] | guarded right hand side (gdrhs)
|
| Instances | |
|
|
data GuardedRhs |
A guarded right hand side | exp = exp.
The first expression will be Boolean-valued.
| Constructors | | Instances | |
|
|
data DataOrNew |
Constructors | | Instances | |
|
|
Class Assertions and Contexts
|
|
type Context = [Asst] |
|
data FunDep |
A functional dependency, given on the form
l1 l2 ... ln -> r2 r3 .. rn
| Constructors | | Instances | |
|
|
data Asst |
Class assertions.
In Haskell 98, the argument would be a tyvar, but this definition
allows multiple parameters, and allows them to be types.
Also extended with support for implicit parameters and equality constraints.
| Constructors | | Instances | |
|
|
Types
|
|
data Type |
A type qualified with a context.
An unqualified type has an empty context.
| Constructors | | Instances | |
|
|
data Boxed |
Constructors | | Instances | |
|
|
data Kind |
Constructors | | Instances | |
|
|
data TyVarBind |
Constructors | | Instances | |
|
|
Expressions
|
|
data Exp |
Haskell expressions.
Notes:
- Because it is difficult for parsers to distinguish patterns from
expressions, they typically parse them in the same way and then check
that they have the appropriate form. Hence the expression type
includes some forms that are found only in patterns. After these
checks, these constructors should not be used.
- The parser does not take precedence and associativity into account,
so it will leave InfixApps associated to the left.
- The Language.Haskell.Exts.Pretty.Pretty instance for Exp does not
add parentheses in printing.
| Constructors | | Instances | |
|
|
data Stmt |
This type represents both stmt in a do-expression,
and qual in a list comprehension, as well as stmt
in a pattern guard.
| Constructors | Generator SrcLoc Pat Exp | a generator pat <- exp
| Qualifier Exp | an exp by itself: in a do-expression,
an action whose result is discarded;
in a list comprehension, a guard expression
| LetStmt Binds | local bindings
|
| Instances | |
|
|
data FieldUpdate |
An fbind in a labeled construction or update.
| Constructors | | Instances | |
|
|
data Alt |
An alt in a case expression.
| Constructors | | Instances | |
|
|
data GuardedAlts |
Constructors | | Instances | |
|
|
data GuardedAlt |
A guarded alternative | stmt, ... , stmt -> exp.
| Constructors | | Instances | |
|
|
Patterns
|
|
data Pat |
A pattern, to be matched against a value.
| Constructors | PVar Name | variable
| PLit Literal | literal constant
| PNeg Pat | negated pattern
| PNPlusK Name Integer | n+k pattern
| PInfixApp Pat QName Pat | pattern with infix data constructor
| PApp QName [Pat] | data constructor and argument
patterns
| PTuple [Pat] | tuple pattern
| PList [Pat] | list pattern
| PParen Pat | parenthesized pattern
| PRec QName [PatField] | labelled pattern
| PAsPat Name Pat | @-pattern
| PWildCard | wildcard pattern (_)
| PIrrPat Pat | irrefutable pattern (~)
| PatTypeSig SrcLoc Pat Type | pattern type signature
| PViewPat Exp Pat | view patterns of the form (e -> p)
HaRP
| PRPat [RPat] | regular pattern (HaRP)
Hsx
| PXTag SrcLoc XName [PXAttr] (Maybe Pat) [Pat] | XML tag pattern
| PXETag SrcLoc XName [PXAttr] (Maybe Pat) | XML singleton tag pattern
| PXPcdata String | XML PCDATA pattern
| PXPatTag Pat | XML embedded pattern
| PXRPats [RPat] | XML regular list pattern
|
| Instances | |
|
|
data PatField |
An fpat in a labeled record pattern.
| Constructors | | Instances | |
|
|
Literals
|
|
data Literal |
literal
Values of this type hold the abstract value of the literal, not the
precise string representation used. For example, 10, 0o12 and 0xa
have the same representation.
| Constructors | Char Char | character literal
| String String | string literal
| Int Integer | integer literal
| Frac Rational | floating point literal
| PrimInt Integer | GHC unboxed integer literal
| PrimWord Integer | GHC unboxed word literal
| PrimFloat Rational | GHC unboxed float literal
| PrimDouble Rational | GHC unboxed double literal
| PrimChar Char | GHC unboxed character literal
| PrimString String | GHC unboxed string literal
|
| Instances | |
|
|
Variables, Constructors and Operators
|
|
newtype ModuleName |
The name of a Haskell module.
| Constructors | | Instances | |
|
|
data QName |
This type is used to represent qualified variables, and also
qualified constructors.
| Constructors | Qual ModuleName Name | name qualified with a module name
| UnQual Name | unqualified name
| Special SpecialCon | built-in constructor with special syntax
|
| Instances | |
|
|
data Name |
This type is used to represent variables, and also constructors.
| Constructors | | Instances | |
|
|
data QOp |
Possibly qualified infix operators (qop), appearing in expressions.
| Constructors | QVarOp QName | variable operator (qvarop)
| QConOp QName | constructor operator (qconop)
|
| Instances | |
|
|
data Op |
Operators, appearing in infix declarations.
| Constructors | VarOp Name | variable operator (varop)
| ConOp Name | constructor operator (conop)
|
| Instances | |
|
|
data SpecialCon |
Constructors with special syntax.
These names are never qualified, and always refer to builtin type or
data constructors.
| Constructors | UnitCon | unit type and data constructor ()
| ListCon | list type constructor []
| FunCon | function type constructor ->
| TupleCon Int | n-ary tuple type and data
constructors (,) etc
| Cons | list data constructor (:)
|
| Instances | |
|
|
data CName |
A name (cname) of a component of a class or data type in an import
or export specification.
| Constructors | VarName Name | name of a method or field
| ConName Name | name of a data constructor
|
| Instances | |
|
|
data IPName |
This type is used to represent implicit parameter names.
| Constructors | | Instances | |
|
|
Template Haskell
|
|
data Bracket |
Constructors | | Instances | |
|
|
data Splice |
Constructors | | Instances | |
|
|
HaRP
|
|
data RPat |
An entity in a regular pattern (HaRP)
| Constructors | | Instances | |
|
|
data RPatOp |
A regular pattern operator (HaRP)
| Constructors | RPStar | | RPStarG | | RPPlus | | RPPlusG | | RPOpt | | RPOptG | |
| Instances | |
|
|
Hsx
|
|
data XAttr |
Constructors | | Instances | |
|
|
data XName |
Constructors | | Instances | |
|
|
data PXAttr |
An XML attribute in an XML tag pattern
| Constructors | | Instances | |
|
|
FFI
|
|
data Safety |
Constructors | | Instances | |
|
|
data CallConv |
Constructors | | Instances | |
|
|
Pragmas
|
|
data OptionPragma |
Constructors | | Instances | |
|
|
data Tool |
Constructors | GHC | | HUGS | | NHC98 | | YHC | | HADDOCK | | UnknownTool String | |
| Instances | |
|
|
data WarningText |
Constructors | | Instances | |
|
|
data Rule |
Constructors | | Instances | |
|
|
data RuleVar |
Constructors | | Instances | |
|
|
data Activation |
Constructors | AlwaysActive | | ActiveFrom Int | | ActiveUntil Int | |
| Instances | |
|
|
Builtin names
|
|
Modules
|
|
main_mod :: ModuleName |
|
Main function of a program
|
|
main_name :: Name |
|
Constructors
|
|
unit_con_name :: QName |
|
tuple_con_name :: Int -> QName |
|
list_cons_name :: QName |
|
unit_con :: Exp |
|
tuple_con :: Int -> Exp |
|
Special identifiers
|
|
qualified_name :: Name |
|
safe_name :: Name |
|
Type constructors
|
|
fun_tycon_name :: QName |
|
tuple_tycon_name :: Int -> QName |
|
fun_tycon :: Type |
|
tuple_tycon :: Int -> Type |
|
Source coordinates
|
|
data SrcLoc |
A position in the source.
| Constructors | | Instances | |
|
|
Produced by Haddock version 2.3.0 |