Portability | portable |
---|---|
Stability | stable |
Maintainer | Niklas Broberg, d00nibro@chalmers.se |
A suite of datatypes describing the (semi-concrete) abstract syntax of Haskell 98 http://www.haskell.org/onlinereport/ plus registered extensions, including:
- multi-parameter type classes with functional dependencies (MultiParamTypeClasses, FunctionalDependencies)
- parameters of type class assertions are unrestricted (FlexibleContexts)
-
forall
types as universal and existential quantification (RankNTypes, ExistentialQuantification, etc) - pattern guards (PatternGuards)
- implicit parameters (ImplicitParameters)
- generalised algebraic data types (GADTs)
- template haskell (TemplateHaskell)
- empty data type declarations (EmptyDataDecls)
- unboxed tuples (UnboxedTuples)
- regular patterns (RegularPatterns)
- HSP-style XML expressions and patterns (XmlSyntax)
All nodes in the syntax tree are annotated with something of a user-definable data type. When parsing, this annotation will contain information about the source location that the particular node comes from.
- data Module l
- = Module l (Maybe (ModuleHead l)) [ModulePragma l] [ImportDecl l] [Decl l]
- | XmlPage l (ModuleName l) [ModulePragma l] (XName l) [XAttr l] (Maybe (Exp l)) [Exp l]
- | XmlHybrid l (Maybe (ModuleHead l)) [ModulePragma l] [ImportDecl l] [Decl l] (XName l) [XAttr l] (Maybe (Exp l)) [Exp l]
- data ModuleHead l = ModuleHead l (ModuleName l) (Maybe (WarningText l)) (Maybe (ExportSpecList l))
- data WarningText l
- data ExportSpecList l = ExportSpecList l [ExportSpec l]
- data ExportSpec l
- = EVar l (QName l)
- | EAbs l (QName l)
- | EThingAll l (QName l)
- | EThingWith l (QName l) [CName l]
- | EModuleContents l (ModuleName l)
- data ImportDecl l = ImportDecl {
- importAnn :: l
- importModule :: ModuleName l
- importQualified :: Bool
- importSrc :: Bool
- importPkg :: Maybe String
- importAs :: Maybe (ModuleName l)
- importSpecs :: Maybe (ImportSpecList l)
- data ImportSpecList l = ImportSpecList l Bool [ImportSpec l]
- data ImportSpec l
- data Assoc l
- = AssocNone l
- | AssocLeft l
- | AssocRight l
- data Decl l
- = TypeDecl l (DeclHead l) (Type l)
- | TypeFamDecl l (DeclHead l) (Maybe (Kind l))
- | DataDecl l (DataOrNew l) (Maybe (Context l)) (DeclHead l) [QualConDecl l] (Maybe (Deriving l))
- | GDataDecl l (DataOrNew l) (Maybe (Context l)) (DeclHead l) (Maybe (Kind l)) [GadtDecl l] (Maybe (Deriving l))
- | DataFamDecl l (Maybe (Context l)) (DeclHead l) (Maybe (Kind l))
- | TypeInsDecl l (Type l) (Type l)
- | DataInsDecl l (DataOrNew l) (Type l) [QualConDecl l] (Maybe (Deriving l))
- | GDataInsDecl l (DataOrNew l) (Type l) (Maybe (Kind l)) [GadtDecl l] (Maybe (Deriving l))
- | ClassDecl l (Maybe (Context l)) (DeclHead l) [FunDep l] (Maybe [ClassDecl l])
- | InstDecl l (Maybe (Context l)) (InstHead l) (Maybe [InstDecl l])
- | DerivDecl l (Maybe (Context l)) (InstHead l)
- | InfixDecl l (Assoc l) (Maybe Int) [Op l]
- | DefaultDecl l [Type l]
- | SpliceDecl l (Exp l)
- | TypeSig l [Name l] (Type l)
- | FunBind l [Match l]
- | PatBind l (Pat l) (Maybe (Type l)) (Rhs l) (Maybe (Binds l))
- | ForImp l (CallConv l) (Maybe (Safety l)) (Maybe String) (Name l) (Type l)
- | ForExp l (CallConv l) (Maybe String) (Name l) (Type l)
- | RulePragmaDecl l [Rule l]
- | DeprPragmaDecl l [([Name l], String)]
- | WarnPragmaDecl l [([Name l], String)]
- | InlineSig l Bool (Maybe (Activation l)) (QName l)
- | InlineConlikeSig l (Maybe (Activation l)) (QName l)
- | SpecSig l (QName l) [Type l]
- | SpecInlineSig l Bool (Maybe (Activation l)) (QName l) [Type l]
- | InstSig l (Maybe (Context l)) (InstHead l)
- | AnnPragma l (Annotation l)
- data DeclHead l
- data InstHead l
- data Binds l
- data IPBind l = IPBind l (IPName l) (Exp l)
- data ClassDecl l
- data InstDecl l
- data Deriving l = Deriving l [InstHead l]
- data DataOrNew l
- data ConDecl l
- data FieldDecl l = FieldDecl l [Name l] (BangType l)
- data QualConDecl l = QualConDecl l (Maybe [TyVarBind l]) (Maybe (Context l)) (ConDecl l)
- data GadtDecl l = GadtDecl l (Name l) (Type l)
- data BangType l
- = BangedTy l (Type l)
- | UnBangedTy l (Type l)
- | UnpackedTy l (Type l)
- data Match l
- data Rhs l
- = UnGuardedRhs l (Exp l)
- | GuardedRhss l [GuardedRhs l]
- data GuardedRhs l = GuardedRhs l [Stmt l] (Exp l)
- data Context l
- data FunDep l = FunDep l [Name l] [Name l]
- data Asst l
- data Type l
- data Boxed
- data Kind l
- data TyVarBind l
- = KindedVar l (Name l) (Kind l)
- | UnkindedVar l (Name l)
- data Exp l
- = Var l (QName l)
- | IPVar l (IPName l)
- | Con l (QName l)
- | Lit l (Literal l)
- | InfixApp l (Exp l) (QOp l) (Exp l)
- | App l (Exp l) (Exp l)
- | NegApp l (Exp l)
- | Lambda l [Pat l] (Exp l)
- | Let l (Binds l) (Exp l)
- | If l (Exp l) (Exp l) (Exp l)
- | Case l (Exp l) [Alt l]
- | Do l [Stmt l]
- | MDo l [Stmt l]
- | Tuple l [Exp l]
- | TupleSection l [Maybe (Exp l)]
- | List l [Exp l]
- | Paren l (Exp l)
- | LeftSection l (Exp l) (QOp l)
- | RightSection l (QOp l) (Exp l)
- | RecConstr l (QName l) [FieldUpdate l]
- | RecUpdate l (Exp l) [FieldUpdate l]
- | EnumFrom l (Exp l)
- | EnumFromTo l (Exp l) (Exp l)
- | EnumFromThen l (Exp l) (Exp l)
- | EnumFromThenTo l (Exp l) (Exp l) (Exp l)
- | ListComp l (Exp l) [QualStmt l]
- | ParComp l (Exp l) [[QualStmt l]]
- | ExpTypeSig l (Exp l) (Type l)
- | VarQuote l (QName l)
- | TypQuote l (QName l)
- | BracketExp l (Bracket l)
- | SpliceExp l (Splice l)
- | QuasiQuote l String String
- | XTag l (XName l) [XAttr l] (Maybe (Exp l)) [Exp l]
- | XETag l (XName l) [XAttr l] (Maybe (Exp l))
- | XPcdata l String
- | XExpTag l (Exp l)
- | CorePragma l String (Exp l)
- | SCCPragma l String (Exp l)
- | GenPragma l String (Int, Int) (Int, Int) (Exp l)
- | Proc l (Pat l) (Exp l)
- | LeftArrApp l (Exp l) (Exp l)
- | RightArrApp l (Exp l) (Exp l)
- | LeftArrHighApp l (Exp l) (Exp l)
- | RightArrHighApp l (Exp l) (Exp l)
- data Stmt l
- data QualStmt l
- data FieldUpdate l
- = FieldUpdate l (QName l) (Exp l)
- | FieldPun l (Name l)
- | FieldWildcard l
- data Alt l = Alt l (Pat l) (GuardedAlts l) (Maybe (Binds l))
- data GuardedAlts l
- = UnGuardedAlt l (Exp l)
- | GuardedAlts l [GuardedAlt l]
- data GuardedAlt l = GuardedAlt l [Stmt l] (Exp l)
- data XAttr l = XAttr l (XName l) (Exp l)
- data Pat l
- = PVar l (Name l)
- | PLit l (Literal l)
- | PNeg l (Pat l)
- | PNPlusK l (Name l) Integer
- | PInfixApp l (Pat l) (QName l) (Pat l)
- | PApp l (QName l) [Pat l]
- | PTuple l [Pat l]
- | PList l [Pat l]
- | PParen l (Pat l)
- | PRec l (QName l) [PatField l]
- | PAsPat l (Name l) (Pat l)
- | PWildCard l
- | PIrrPat l (Pat l)
- | PatTypeSig l (Pat l) (Type l)
- | PViewPat l (Exp l) (Pat l)
- | PRPat l [RPat l]
- | PXTag l (XName l) [PXAttr l] (Maybe (Pat l)) [Pat l]
- | PXETag l (XName l) [PXAttr l] (Maybe (Pat l))
- | PXPcdata l String
- | PXPatTag l (Pat l)
- | PXRPats l [RPat l]
- | PExplTypeArg l (QName l) (Type l)
- | PQuasiQuote l String String
- | PBangPat l (Pat l)
- data PatField l
- data PXAttr l = PXAttr l (XName l) (Pat l)
- data RPat l
- data RPatOp l
- data Literal l
- data ModuleName l = ModuleName l String
- data QName l
- = Qual l (ModuleName l) (Name l)
- | UnQual l (Name l)
- | Special l (SpecialCon l)
- data Name l
- data QOp l
- data Op l
- data SpecialCon l
- data CName l
- data IPName l
- data XName l
- data Bracket l
- = ExpBracket l (Exp l)
- | PatBracket l (Pat l)
- | TypeBracket l (Type l)
- | DeclBracket l [Decl l]
- data Splice l
- = IdSplice l String
- | ParenSplice l (Exp l)
- data Safety l
- data CallConv l
- data ModulePragma l
- = LanguagePragma l [Name l]
- | OptionsPragma l (Maybe Tool) String
- | AnnModulePragma l (Annotation l)
- data Tool
- data Rule l = Rule l String (Maybe (Activation l)) (Maybe [RuleVar l]) (Exp l) (Exp l)
- data RuleVar l
- = RuleVar l (Name l)
- | TypedRuleVar l (Name l) (Type l)
- data Activation l
- = ActiveFrom l Int
- | ActiveUntil l Int
- data Annotation l
- prelude_mod :: l -> ModuleName l
- main_mod :: l -> ModuleName l
- main_name :: l -> Name l
- unit_con_name :: l -> QName l
- tuple_con_name :: l -> Boxed -> Int -> QName l
- list_cons_name :: l -> QName l
- unboxed_singleton_con_name :: l -> QName l
- unit_con :: l -> Exp l
- tuple_con :: l -> Boxed -> Int -> Exp l
- unboxed_singleton_con :: l -> Exp l
- as_name :: l -> Name l
- qualified_name :: l -> Name l
- hiding_name :: l -> Name l
- minus_name :: l -> Name l
- bang_name :: l -> Name l
- dot_name :: l -> Name l
- star_name :: l -> Name l
- export_name :: l -> Name l
- safe_name :: l -> Name l
- unsafe_name :: l -> Name l
- threadsafe_name :: l -> Name l
- stdcall_name :: l -> Name l
- ccall_name :: l -> Name l
- unit_tycon_name :: l -> QName l
- fun_tycon_name :: l -> QName l
- list_tycon_name :: l -> QName l
- tuple_tycon_name :: l -> Boxed -> Int -> QName l
- unboxed_singleton_tycon_name :: l -> QName l
- unit_tycon :: l -> Type l
- fun_tycon :: l -> Type l
- list_tycon :: l -> Type l
- tuple_tycon :: l -> Boxed -> Int -> Type l
- unboxed_singleton_tycon :: l -> Type l
- class Functor ast => Annotated ast where
- (=~=) :: (Annotated a, Eq (a ())) => a l1 -> a l2 -> Bool
Modules
A complete Haskell source module.
Module l (Maybe (ModuleHead l)) [ModulePragma l] [ImportDecl l] [Decl l] | an ordinary Haskell module |
XmlPage l (ModuleName l) [ModulePragma l] (XName l) [XAttr l] (Maybe (Exp l)) [Exp l] | a module consisting of a single XML document. The ModuleName never appears in the source but is needed for semantic purposes, it will be the same as the file name. |
XmlHybrid l (Maybe (ModuleHead l)) [ModulePragma l] [ImportDecl l] [Decl l] (XName l) [XAttr l] (Maybe (Exp l)) [Exp l] | a hybrid module combining an XML document with an ordinary module |
data ModuleHead l Source
The head of a module, including the name and export specification.
ModuleHead l (ModuleName l) (Maybe (WarningText l)) (Maybe (ExportSpecList l)) |
Functor ModuleHead | |
Typeable1 ModuleHead | |
Annotated ModuleHead | |
ExactP ModuleHead | |
Eq l => Eq (ModuleHead l) | |
Data l => Data (ModuleHead l) | |
Ord l => Ord (ModuleHead l) | |
Show l => Show (ModuleHead l) | |
Pretty (ModuleHead l) |
data WarningText l Source
Warning text to optionally use in the module header of e.g. a deprecated module.
Functor WarningText | |
Typeable1 WarningText | |
Annotated WarningText | |
ExactP WarningText | |
Eq l => Eq (WarningText l) | |
Data l => Data (WarningText l) | |
Ord l => Ord (WarningText l) | |
Show l => Show (WarningText l) | |
Pretty (WarningText l) |
data ExportSpecList l Source
An explicit export specification.
ExportSpecList l [ExportSpec l] |
Functor ExportSpecList | |
Typeable1 ExportSpecList | |
Annotated ExportSpecList | |
ExactP ExportSpecList | |
Eq l => Eq (ExportSpecList l) | |
Data l => Data (ExportSpecList l) | |
Ord l => Ord (ExportSpecList l) | |
Show l => Show (ExportSpecList l) | |
Pretty (ExportSpecList l) |
data ExportSpec l Source
An item in a module's export specification.
EVar l (QName l) | variable |
EAbs l (QName l) |
|
EThingAll l (QName l) |
|
EThingWith l (QName l) [CName l] |
|
EModuleContents l (ModuleName l) |
|
Functor ExportSpec | |
Typeable1 ExportSpec | |
Annotated ExportSpec | |
ExactP ExportSpec | |
Eq l => Eq (ExportSpec l) | |
Data l => Data (ExportSpec l) | |
Ord l => Ord (ExportSpec l) | |
Show l => Show (ExportSpec l) | |
Pretty (ExportSpec l) |
data ImportDecl l Source
An import declaration.
ImportDecl | |
|
Functor ImportDecl | |
Typeable1 ImportDecl | |
Annotated ImportDecl | |
ExactP ImportDecl | |
Eq l => Eq (ImportDecl l) | |
Data l => Data (ImportDecl l) | |
Ord l => Ord (ImportDecl l) | |
Show l => Show (ImportDecl l) | |
SrcInfo pos => Pretty (ImportDecl pos) |
data ImportSpecList l Source
An explicit import specification list.
ImportSpecList l Bool [ImportSpec l] |
Functor ImportSpecList | |
Typeable1 ImportSpecList | |
Annotated ImportSpecList | |
ExactP ImportSpecList | |
Eq l => Eq (ImportSpecList l) | |
Data l => Data (ImportSpecList l) | |
Ord l => Ord (ImportSpecList l) | |
Show l => Show (ImportSpecList l) | |
Pretty (ImportSpecList l) |
data ImportSpec l Source
An import specification, representing a single explicit item imported (or hidden) from a module.
IVar l (Name l) | variable |
IAbs l (Name l) |
|
IThingAll l (Name l) |
|
IThingWith l (Name l) [CName l] |
|
Functor ImportSpec | |
Typeable1 ImportSpec | |
Annotated ImportSpec | |
ExactP ImportSpec | |
Eq l => Eq (ImportSpec l) | |
Data l => Data (ImportSpec l) | |
Ord l => Ord (ImportSpec l) | |
Show l => Show (ImportSpec l) | |
Pretty (ImportSpec l) |
Associativity of an operator.
AssocNone l | non-associative operator (declared with |
AssocLeft l | left-associative operator (declared with |
AssocRight l | right-associative operator (declared with |
Declarations
A top-level declaration.
TypeDecl l (DeclHead l) (Type l) | A type declaration |
TypeFamDecl l (DeclHead l) (Maybe (Kind l)) | A type family declaration |
DataDecl l (DataOrNew l) (Maybe (Context l)) (DeclHead l) [QualConDecl l] (Maybe (Deriving l)) | A data OR newtype declaration |
GDataDecl l (DataOrNew l) (Maybe (Context l)) (DeclHead l) (Maybe (Kind l)) [GadtDecl l] (Maybe (Deriving l)) | A data OR newtype declaration, GADT style |
DataFamDecl l (Maybe (Context l)) (DeclHead l) (Maybe (Kind l)) | A data family declaration |
TypeInsDecl l (Type l) (Type l) | A type family instance declaration |
DataInsDecl l (DataOrNew l) (Type l) [QualConDecl l] (Maybe (Deriving l)) | A data family instance declaration |
GDataInsDecl l (DataOrNew l) (Type l) (Maybe (Kind l)) [GadtDecl l] (Maybe (Deriving l)) | A data family instance declaration, GADT style |
ClassDecl l (Maybe (Context l)) (DeclHead l) [FunDep l] (Maybe [ClassDecl l]) | A declaration of a type class |
InstDecl l (Maybe (Context l)) (InstHead l) (Maybe [InstDecl l]) | An declaration of a type class instance |
DerivDecl l (Maybe (Context l)) (InstHead l) | A standalone deriving declaration |
InfixDecl l (Assoc l) (Maybe Int) [Op l] | A declaration of operator fixity |
DefaultDecl l [Type l] | A declaration of default types |
SpliceDecl l (Exp l) | A Template Haskell splicing declaration |
TypeSig l [Name l] (Type l) | A type signature declaration |
FunBind l [Match l] | A set of function binding clauses |
PatBind l (Pat l) (Maybe (Type l)) (Rhs l) (Maybe (Binds l)) | A pattern binding |
ForImp l (CallConv l) (Maybe (Safety l)) (Maybe String) (Name l) (Type l) | A foreign import declaration |
ForExp l (CallConv l) (Maybe String) (Name l) (Type l) | A foreign export declaration |
RulePragmaDecl l [Rule l] | A RULES pragma |
DeprPragmaDecl l [([Name l], String)] | A DEPRECATED pragma |
WarnPragmaDecl l [([Name l], String)] | A WARNING pragma |
InlineSig l Bool (Maybe (Activation l)) (QName l) | An INLINE pragma |
InlineConlikeSig l (Maybe (Activation l)) (QName l) | An INLINE CONLIKE pragma |
SpecSig l (QName l) [Type l] | A SPECIALISE pragma |
SpecInlineSig l Bool (Maybe (Activation l)) (QName l) [Type l] | A SPECIALISE INLINE pragma |
InstSig l (Maybe (Context l)) (InstHead l) | A SPECIALISE instance pragma |
AnnPragma l (Annotation l) | An ANN pragma |
The head of a type or class declaration.
The head of an instance declaration.
A binding group inside a let
or where
clause.
A binding of an implicit parameter.
Type classes and instances
Declarations inside a class declaration.
Declarations inside an instance declaration.
InsDecl l (Decl l) | ordinary declaration |
InsType l (Type l) (Type l) | an associated type definition |
InsData l (DataOrNew l) (Type l) [QualConDecl l] (Maybe (Deriving l)) | an associated data type implementation |
InsGData l (DataOrNew l) (Type l) (Maybe (Kind l)) [GadtDecl l] (Maybe (Deriving l)) | an associated data type implemented using GADT style |
A deriving clause following a data type declaration.
Data type declarations
A flag stating whether a declaration is a data or newtype declaration.
Declaration of an ordinary data constructor.
Declaration of a (list of) named field(s).
data QualConDecl l Source
A single constructor declaration within a data type declaration, which may have an existential quantification binding.
Functor QualConDecl | |
Typeable1 QualConDecl | |
Annotated QualConDecl | |
ExactP QualConDecl | |
Eq l => Eq (QualConDecl l) | |
Data l => Data (QualConDecl l) | |
Ord l => Ord (QualConDecl l) | |
Show l => Show (QualConDecl l) | |
Pretty (QualConDecl l) |
A single constructor declaration in a GADT data type declaration.
The type of a constructor argument or field, optionally including a strictness annotation.
BangedTy l (Type l) | strict component, marked with " |
UnBangedTy l (Type l) | non-strict component |
UnpackedTy l (Type l) | unboxed component, marked with an UNPACK pragma |
Function bindings
Clauses of a function binding.
Match l (Name l) [Pat l] (Rhs l) (Maybe (Binds l)) | A clause defined with prefix notation, i.e. the function name followed by its argument patterns, the right-hand side and an optional where clause. |
InfixMatch l (Pat l) (Name l) [Pat l] (Rhs l) (Maybe (Binds l)) | A clause defined with infix notation, i.e. first its first argument pattern, then the function name, then its following argument(s), the right-hand side and an optional where clause. Note that there can be more than two arguments to a function declared infix, hence the list of pattern arguments. |
The right hand side of a function or pattern binding.
UnGuardedRhs l (Exp l) | unguarded right hand side (exp) |
GuardedRhss l [GuardedRhs l] | guarded right hand side (gdrhs) |
data GuardedRhs l Source
A guarded right hand side |
stmts =
exp.
The guard is a series of statements when using pattern guards,
otherwise it will be a single qualifier expression.
GuardedRhs l [Stmt l] (Exp l) |
Functor GuardedRhs | |
Typeable1 GuardedRhs | |
Annotated GuardedRhs | |
ExactP GuardedRhs | |
AppFixity GuardedRhs | |
Eq l => Eq (GuardedRhs l) | |
Data l => Data (GuardedRhs l) | |
Ord l => Ord (GuardedRhs l) | |
Show l => Show (GuardedRhs l) | |
SrcInfo loc => Pretty (GuardedRhs loc) |
Class Assertions and Contexts
A context is a set of assertions
A functional dependency, given on the form l1 l2 ... ln -> r2 r3 .. rn
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.
Types
A type qualified with a context. An unqualified type has an empty context.
TyForall l (Maybe [TyVarBind l]) (Maybe (Context l)) (Type l) | qualified type |
TyFun l (Type l) (Type l) | function type |
TyTuple l Boxed [Type l] | tuple type, possibly boxed |
TyList l (Type l) | list syntax, e.g. [a], as opposed to [] a |
TyApp l (Type l) (Type l) | application of a type constructor |
TyVar l (Name l) | type variable |
TyCon l (QName l) | named type or type constructor |
TyParen l (Type l) | type surrounded by parentheses |
TyInfix l (Type l) (QName l) (Type l) | infix type constructor |
TyKind l (Type l) (Kind l) | type with explicit kind signature |
Flag denoting whether a tuple is boxed or unboxed.
An explicit kind annotation.
A type variable declaration, optionally with an explicit kind annotation.
KindedVar l (Name l) (Kind l) | variable binding with kind annotation |
UnkindedVar l (Name l) | ordinary variable binding |
Expressions
Haskell expressions.
Var l (QName l) | variable |
IPVar l (IPName l) | implicit parameter variable |
Con l (QName l) | data constructor |
Lit l (Literal l) | literal constant |
InfixApp l (Exp l) (QOp l) (Exp l) | infix application |
App l (Exp l) (Exp l) | ordinary application |
NegApp l (Exp l) | negation expression |
Lambda l [Pat l] (Exp l) | lambda expression |
Let l (Binds l) (Exp l) | local declarations with |
If l (Exp l) (Exp l) (Exp l) |
|
Case l (Exp l) [Alt l] |
|
Do l [Stmt l] |
|
MDo l [Stmt l] |
|
Tuple l [Exp l] | tuple expression |
TupleSection l [Maybe (Exp l)] | tuple section expression, e.g. |
List l [Exp l] | list expression |
Paren l (Exp l) | parenthesised expression |
LeftSection l (Exp l) (QOp l) | left section |
RightSection l (QOp l) (Exp l) | right section |
RecConstr l (QName l) [FieldUpdate l] | record construction expression |
RecUpdate l (Exp l) [FieldUpdate l] | record update expression |
EnumFrom l (Exp l) | unbounded arithmetic sequence,
incrementing by 1: |
EnumFromTo l (Exp l) (Exp l) | bounded arithmetic sequence,
incrementing by 1 |
EnumFromThen l (Exp l) (Exp l) | unbounded arithmetic sequence,
with first two elements given |
EnumFromThenTo l (Exp l) (Exp l) (Exp l) | bounded arithmetic sequence,
with first two elements given |
ListComp l (Exp l) [QualStmt l] | ordinary list comprehension |
ParComp l (Exp l) [[QualStmt l]] | parallel list comprehension |
ExpTypeSig l (Exp l) (Type l) | expression with explicit type signature |
VarQuote l (QName l) |
|
TypQuote l (QName l) |
|
BracketExp l (Bracket l) | template haskell bracket expression |
SpliceExp l (Splice l) | template haskell splice expression |
QuasiQuote l String String | quasi-quotaion: |
XTag l (XName l) [XAttr l] (Maybe (Exp l)) [Exp l] | xml element, with attributes and children |
XETag l (XName l) [XAttr l] (Maybe (Exp l)) | empty xml element, with attributes |
XPcdata l String | PCDATA child element |
XExpTag l (Exp l) | escaped haskell expression inside xml |
CorePragma l String (Exp l) | CORE pragma |
SCCPragma l String (Exp l) | SCC pragma |
GenPragma l String (Int, Int) (Int, Int) (Exp l) | GENERATED pragma |
Proc l (Pat l) (Exp l) | arrows proc: |
LeftArrApp l (Exp l) (Exp l) | arrow application (from left): exp |
RightArrApp l (Exp l) (Exp l) | arrow application (from right): exp |
LeftArrHighApp l (Exp l) (Exp l) | higher-order arrow application (from left): exp |
RightArrHighApp l (Exp l) (Exp l) | higher-order arrow application (from right): exp |
A statement, representing both a stmt in a do
-expression,
an ordinary qual in a list comprehension, as well as a stmt
in a pattern guard.
A general transqual in a list comprehension, which could potentially be a transform of the kind enabled by TransformListComp.
data FieldUpdate l Source
An fbind in a labeled construction or update expression.
FieldUpdate l (QName l) (Exp l) | ordinary label-expresion pair |
FieldPun l (Name l) | record field pun |
FieldWildcard l | record field wildcard |
Functor FieldUpdate | |
Typeable1 FieldUpdate | |
Annotated FieldUpdate | |
ExactP FieldUpdate | |
AppFixity FieldUpdate | |
Eq l => Eq (FieldUpdate l) | |
Data l => Data (FieldUpdate l) | |
Ord l => Ord (FieldUpdate l) | |
Show l => Show (FieldUpdate l) | |
SrcInfo loc => Pretty (FieldUpdate loc) |
An alt alternative in a case
expression.
Alt l (Pat l) (GuardedAlts l) (Maybe (Binds l)) |
data GuardedAlts l Source
The right-hand sides of a case
alternative,
which may be a single right-hand side or a
set of guarded ones.
UnGuardedAlt l (Exp l) |
|
GuardedAlts l [GuardedAlt l] | gdpat |
Functor GuardedAlts | |
Typeable1 GuardedAlts | |
Annotated GuardedAlts | |
ExactP GuardedAlts | |
AppFixity GuardedAlts | |
Eq l => Eq (GuardedAlts l) | |
Data l => Data (GuardedAlts l) | |
Ord l => Ord (GuardedAlts l) | |
Show l => Show (GuardedAlts l) | |
SrcInfo loc => Pretty (GuardedAlts loc) |
data GuardedAlt l Source
A guarded case alternative |
stmts ->
exp.
GuardedAlt l [Stmt l] (Exp l) |
Functor GuardedAlt | |
Typeable1 GuardedAlt | |
Annotated GuardedAlt | |
ExactP GuardedAlt | |
AppFixity GuardedAlt | |
Eq l => Eq (GuardedAlt l) | |
Data l => Data (GuardedAlt l) | |
Ord l => Ord (GuardedAlt l) | |
Show l => Show (GuardedAlt l) | |
SrcInfo loc => Pretty (GuardedAlt loc) |
An xml attribute, which is a name-expression pair.
Patterns
A pattern, to be matched against a value.
PVar l (Name l) | variable |
PLit l (Literal l) | literal constant |
PNeg l (Pat l) | negated pattern |
PNPlusK l (Name l) Integer | n+k pattern |
PInfixApp l (Pat l) (QName l) (Pat l) | pattern with an infix data constructor |
PApp l (QName l) [Pat l] | data constructor and argument patterns |
PTuple l [Pat l] | tuple pattern |
PList l [Pat l] | list pattern |
PParen l (Pat l) | parenthesized pattern |
PRec l (QName l) [PatField l] | labelled pattern, record style |
PAsPat l (Name l) (Pat l) |
|
PWildCard l | wildcard pattern: |
PIrrPat l (Pat l) | irrefutable pattern: |
PatTypeSig l (Pat l) (Type l) | pattern with type signature |
PViewPat l (Exp l) (Pat l) | view patterns of the form |
PRPat l [RPat l] | regular list pattern |
PXTag l (XName l) [PXAttr l] (Maybe (Pat l)) [Pat l] | XML element pattern |
PXETag l (XName l) [PXAttr l] (Maybe (Pat l)) | XML singleton element pattern |
PXPcdata l String | XML PCDATA pattern |
PXPatTag l (Pat l) | XML embedded pattern |
PXRPats l [RPat l] | XML regular list pattern |
PExplTypeArg l (QName l) (Type l) | Explicit generics style type argument e.g. |
PQuasiQuote l String String | quasi quote pattern: |
PBangPat l (Pat l) | strict (bang) pattern: |
An fpat in a labeled record pattern.
An XML attribute in a pattern.
An entity in a regular pattern.
RPOp l (RPat l) (RPatOp l) | operator pattern, e.g. pat* |
RPEither l (RPat l) (RPat l) | choice pattern, e.g. (1 | 2) |
RPSeq l [RPat l] | sequence pattern, e.g. (| 1, 2, 3 |) |
RPGuard l (Pat l) [Stmt l] | guarded pattern, e.g. (| p | p < 3 |) |
RPCAs l (Name l) (RPat l) | non-linear variable binding, e.g. (foo@:(1 | 2))* |
RPAs l (Name l) (RPat l) | linear variable binding, e.g. foo@(1 | 2) |
RPParen l (RPat l) | parenthesised pattern, e.g. (2*) |
RPPat l (Pat l) | an ordinary pattern |
A regular pattern operator.
Literals
literal
Values of this type hold the abstract value of the literal, along with the
precise string representation used. For example, 10
, 0o12
and 0xa
have the same value representation, but each carry a different string representation.
Char l Char String | character literal |
String l String String | string literal |
Int l Integer String | integer literal |
Frac l Rational String | floating point literal |
PrimInt l Integer String | unboxed integer literal |
PrimWord l Integer String | unboxed word literal |
PrimFloat l Rational String | unboxed float literal |
PrimDouble l Rational String | unboxed double literal |
PrimChar l Char String | unboxed character literal |
PrimString l String String | unboxed string literal |
Variables, Constructors and Operators
data ModuleName l Source
The name of a Haskell module.
Functor ModuleName | |
Typeable1 ModuleName | |
Annotated ModuleName | |
ExactP ModuleName | |
Eq l => Eq (ModuleName l) | |
Data l => Data (ModuleName l) | |
Ord l => Ord (ModuleName l) | |
Show l => Show (ModuleName l) | |
Pretty (ModuleName l) |
This type is used to represent qualified variables, and also qualified constructors.
Qual l (ModuleName l) (Name l) | name qualified with a module name |
UnQual l (Name l) | unqualified local name |
Special l (SpecialCon l) | built-in constructor with special syntax |
This type is used to represent variables, and also constructors.
Possibly qualified infix operators (qop), appearing in expressions.
Operators appearing in infix
declarations are never qualified.
data SpecialCon l Source
Constructors with special syntax. These names are never qualified, and always refer to builtin type or data constructors.
UnitCon l | unit type and data constructor |
ListCon l | list type constructor |
FunCon l | function type constructor |
TupleCon l Boxed Int | n-ary tuple type and data
constructors |
Cons l | list data constructor |
UnboxedSingleCon l | unboxed singleton tuple constructor |
Functor SpecialCon | |
Typeable1 SpecialCon | |
Annotated SpecialCon | |
ExactP SpecialCon | |
Eq l => Eq (SpecialCon l) | |
Data l => Data (SpecialCon l) | |
Ord l => Ord (SpecialCon l) | |
Show l => Show (SpecialCon l) |
A name (cname) of a component of a class or data type in an import
or export specification.
An implicit parameter name.
The name of an xml element or attribute, possibly qualified with a namespace.
Template Haskell
A template haskell bracket expression.
ExpBracket l (Exp l) | expression bracket: |
PatBracket l (Pat l) | pattern bracket: |
TypeBracket l (Type l) | type bracket: |
DeclBracket l [Decl l] | declaration bracket: |
A template haskell splice expression
IdSplice l String | variable splice: |
ParenSplice l (Exp l) | parenthesised expression splice: |
FFI
The safety of a foreign function call.
The calling convention of a foreign function call.
Pragmas
data ModulePragma l Source
A top level options pragma, preceding the module header.
LanguagePragma l [Name l] | LANGUAGE pragma |
OptionsPragma l (Maybe Tool) String | OPTIONS pragma, possibly qualified with a tool, e.g. OPTIONS_GHC |
AnnModulePragma l (Annotation l) | ANN pragma with module scope |
Functor ModulePragma | |
Typeable1 ModulePragma | |
Annotated ModulePragma | |
ExactP ModulePragma | |
Eq l => Eq (ModulePragma l) | |
Data l => Data (ModulePragma l) | |
Ord l => Ord (ModulePragma l) | |
Show l => Show (ModulePragma l) | |
SrcInfo loc => Pretty (ModulePragma loc) |
Recognised tools for OPTIONS pragmas.
The body of a RULES pragma.
Variables used in a RULES pragma, optionally annotated with types
RuleVar l (Name l) | |
TypedRuleVar l (Name l) (Type l) |
data Activation l Source
Activation clause of a RULES pragma.
ActiveFrom l Int | |
ActiveUntil l Int |
Functor Activation | |
Typeable1 Activation | |
Annotated Activation | |
ExactP Activation | |
Eq l => Eq (Activation l) | |
Data l => Data (Activation l) | |
Ord l => Ord (Activation l) | |
Show l => Show (Activation l) | |
Pretty (Activation l) |
data Annotation l Source
An annotation through an ANN pragma.
Ann l (Name l) (Exp l) | An annotation for a declared name. |
TypeAnn l (Name l) (Exp l) | An annotation for a declared type. |
ModuleAnn l (Exp l) | An annotation for the defining module. |
Functor Annotation | |
Typeable1 Annotation | |
Annotated Annotation | |
ExactP Annotation | |
AppFixity Annotation | |
Eq l => Eq (Annotation l) | |
Data l => Data (Annotation l) | |
Ord l => Ord (Annotation l) | |
Show l => Show (Annotation l) | |
SrcInfo loc => Pretty (Annotation loc) |
Builtin names
Modules
prelude_mod :: l -> ModuleName lSource
main_mod :: l -> ModuleName lSource
Main function of a program
Constructors
unit_con_name :: l -> QName lSource
tuple_con_name :: l -> Boxed -> Int -> QName lSource
list_cons_name :: l -> QName lSource
unboxed_singleton_con_name :: l -> QName lSource
unboxed_singleton_con :: l -> Exp lSource
Special identifiers
qualified_name :: l -> Name lSource
hiding_name :: l -> Name lSource
minus_name :: l -> Name lSource
export_name :: l -> Name lSource
unsafe_name :: l -> Name lSource
threadsafe_name :: l -> Name lSource
stdcall_name :: l -> Name lSource
ccall_name :: l -> Name lSource
Type constructors
unit_tycon_name :: l -> QName lSource
fun_tycon_name :: l -> QName lSource
list_tycon_name :: l -> QName lSource
tuple_tycon_name :: l -> Boxed -> Int -> QName lSource
unboxed_singleton_tycon_name :: l -> QName lSource
unit_tycon :: l -> Type lSource
list_tycon :: l -> Type lSource
tuple_tycon :: l -> Boxed -> Int -> Type lSource
unboxed_singleton_tycon :: l -> Type lSource
Source coordinates
Annotated trees
class Functor ast => Annotated ast whereSource
AST nodes are annotated, and this class allows manipulation of the annotations.
Retrieve the annotation of an AST node.
amap :: (l -> l) -> ast l -> ast lSource
Change the annotation of an AST node. Note that only the annotation of
the node itself is affected, and not the annotations of any child nodes.
if all nodes in the AST tree are to be affected, use fmap
.