| haskell-src-exts-1.9.0: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer | Source code | Contents | Index

Language.Haskell.Exts.Syntax

Portability | portable
Stability | stable
Maintainer | Niklas Broberg, d00nibro@chalmers.se

Contents

Modules
Declarations
  Type classes and instances
  Data type declarations
  Function bindings
Class Assertions and Contexts
Types
Expressions
Patterns
Literals
Variables, Constructors and Operators
Template Haskell
FFI
Pragmas
Builtin names
  Modules
  Main function of a program
  Constructors
  Special identifiers
  Type constructors
Source coordinates

Description

A suite of datatypes describing the 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)

Synopsis

data Module = Module SrcLoc ModuleName [ModulePragma] (Maybe WarningText) (Maybe [ExportSpec]) [ImportDecl] [Decl]

data WarningText

= DeprText String
| WarnText String

data ExportSpec

= EVar QName
| EAbs QName
| EThingAll QName
| EThingWith QName [CName]
| EModuleContents ModuleName

data ImportDecl = ImportDecl {

importLoc :: SrcLoc
importModule :: ModuleName
importQualified :: Bool
importSrc :: Bool
importPkg :: Maybe String
importAs :: Maybe ModuleName
importSpecs :: Maybe (Bool, [ImportSpec])

}

data ImportSpec

= IVar Name
| IAbs Name
| IThingAll Name
| IThingWith Name [CName]

data Assoc

= AssocNone
| AssocLeft
| AssocRight

data Decl

= TypeDecl SrcLoc Name [TyVarBind] Type
| TypeFamDecl SrcLoc Name [TyVarBind] (Maybe Kind)
| DataDecl SrcLoc DataOrNew Context Name [TyVarBind] [QualConDecl] [Deriving]
| GDataDecl SrcLoc DataOrNew Context Name [TyVarBind] (Maybe Kind) [GadtDecl] [Deriving]
| DataFamDecl SrcLoc Context Name [TyVarBind] (Maybe Kind)
| TypeInsDecl SrcLoc Type Type
| DataInsDecl SrcLoc DataOrNew Type [QualConDecl] [Deriving]
| GDataInsDecl SrcLoc DataOrNew Type (Maybe Kind) [GadtDecl] [Deriving]
| ClassDecl SrcLoc Context Name [TyVarBind] [FunDep] [ClassDecl]
| InstDecl SrcLoc Context QName [Type] [InstDecl]
| DerivDecl SrcLoc Context QName [Type]
| InfixDecl SrcLoc Assoc Int [Op]
| DefaultDecl SrcLoc [Type]
| SpliceDecl SrcLoc Exp
| TypeSig SrcLoc [Name] Type
| FunBind [Match]
| PatBind SrcLoc Pat (Maybe Type) Rhs Binds
| ForImp SrcLoc CallConv Safety String Name Type
| ForExp SrcLoc CallConv String Name Type
| RulePragmaDecl SrcLoc [Rule]
| DeprPragmaDecl SrcLoc [([Name], String)]
| WarnPragmaDecl SrcLoc [([Name], String)]
| InlineSig SrcLoc Bool Activation QName
| InlineConlikeSig SrcLoc Activation QName
| SpecSig SrcLoc QName [Type]
| SpecInlineSig SrcLoc Bool Activation QName [Type]
| InstSig SrcLoc Context QName [Type]
| AnnPragma SrcLoc Annotation

data Binds

= BDecls [Decl]
| IPBinds [IPBind]

data IPBind = IPBind SrcLoc IPName Exp

data ClassDecl

= ClsDecl Decl
| ClsDataFam SrcLoc Context Name [TyVarBind] (Maybe Kind)
| ClsTyFam SrcLoc Name [TyVarBind] (Maybe Kind)
| ClsTyDef SrcLoc Type Type

data InstDecl

= InsDecl Decl
| InsType SrcLoc Type Type
| InsData SrcLoc DataOrNew Type [QualConDecl] [Deriving]
| InsGData SrcLoc DataOrNew Type (Maybe Kind) [GadtDecl] [Deriving]

type Deriving = (QName, [Type])

data DataOrNew

= DataType
| NewType

data ConDecl

= ConDecl Name [BangType]
| InfixConDecl BangType Name BangType
| RecDecl Name [([Name], BangType)]

data QualConDecl = QualConDecl SrcLoc [TyVarBind] Context ConDecl
data GadtDecl = GadtDecl SrcLoc Name Type

data BangType

= BangedTy Type
| UnBangedTy Type
| UnpackedTy Type

data Match = Match SrcLoc Name [Pat] (Maybe Type) Rhs Binds

data Rhs

= UnGuardedRhs Exp
| GuardedRhss [GuardedRhs]

data GuardedRhs = GuardedRhs SrcLoc [Stmt] Exp
type Context = [Asst]
data FunDep = FunDep [Name] [Name]

data Asst

= ClassA QName [Type]
| InfixA Type QName Type
| IParam IPName Type
| EqualP Type Type

data Type

= TyForall (Maybe [TyVarBind]) Context Type
| TyFun Type Type
| TyTuple Boxed [Type]
| TyList Type
| TyApp Type Type
| TyVar Name
| TyCon QName
| TyParen Type
| TyInfix Type QName Type
| TyKind Type Kind

data Boxed

= Boxed
| Unboxed

data Kind

= KindStar
| KindBang
| KindFn Kind Kind
| KindParen Kind
| KindVar Name

data TyVarBind

= KindedVar Name Kind
| UnkindedVar Name

data Exp

= Var QName
| IPVar IPName
| Con QName
| Lit Literal
| InfixApp Exp QOp Exp
| App Exp Exp
| NegApp Exp
| Lambda SrcLoc [Pat] Exp
| Let Binds Exp
| If Exp Exp Exp
| Case Exp [Alt]
| Do [Stmt]
| MDo [Stmt]
| Tuple [Exp]
| TupleSection [Maybe Exp]
| List [Exp]
| Paren Exp
| LeftSection Exp QOp
| RightSection QOp Exp
| RecConstr QName [FieldUpdate]
| RecUpdate Exp [FieldUpdate]
| EnumFrom Exp
| EnumFromTo Exp Exp
| EnumFromThen Exp Exp
| EnumFromThenTo Exp Exp Exp
| ListComp Exp [QualStmt]
| ParComp Exp [[QualStmt]]
| ExpTypeSig SrcLoc Exp Type
| VarQuote QName
| TypQuote QName
| BracketExp Bracket
| SpliceExp Splice
| QuasiQuote String String
| XTag SrcLoc XName [XAttr] (Maybe Exp) [Exp]
| XETag SrcLoc XName [XAttr] (Maybe Exp)
| XPcdata String
| XExpTag Exp
| CorePragma String Exp
| SCCPragma String Exp
| GenPragma String (Int, Int) (Int, Int) Exp
| Proc SrcLoc Pat Exp
| LeftArrApp Exp Exp
| RightArrApp Exp Exp
| LeftArrHighApp Exp Exp
| RightArrHighApp Exp Exp

data Stmt

= Generator SrcLoc Pat Exp
| Qualifier Exp
| LetStmt Binds
| RecStmt [Stmt]

data QualStmt

= QualStmt Stmt
| ThenTrans Exp
| ThenBy Exp Exp
| GroupBy Exp
| GroupUsing Exp
| GroupByUsing Exp Exp

data FieldUpdate

= FieldUpdate QName Exp
| FieldPun Name
| FieldWildcard

data Alt = Alt SrcLoc Pat GuardedAlts Binds

data GuardedAlts

= UnGuardedAlt Exp
| GuardedAlts [GuardedAlt]

data GuardedAlt = GuardedAlt SrcLoc [Stmt] Exp
data XAttr = XAttr XName Exp

data Pat

= PVar Name
| PLit Literal
| PNeg Pat
| PNPlusK Name Integer
| PInfixApp Pat QName Pat
| PApp QName [Pat]
| PTuple [Pat]
| PList [Pat]
| PParen Pat
| PRec QName [PatField]
| PAsPat Name Pat
| PWildCard
| PIrrPat Pat
| PatTypeSig SrcLoc Pat Type
| PViewPat Exp Pat
| PRPat [RPat]
| PXTag SrcLoc XName [PXAttr] (Maybe Pat) [Pat]
| PXETag SrcLoc XName [PXAttr] (Maybe Pat)
| PXPcdata String
| PXPatTag Pat
| PXRPats [RPat]
| PExplTypeArg QName Type
| PQuasiQuote String String
| PBangPat Pat

data PatField

= PFieldPat QName Pat
| PFieldPun Name
| PFieldWildcard

data PXAttr = PXAttr XName Pat

data RPat

= RPOp RPat RPatOp
| RPEither RPat RPat
| RPSeq [RPat]
| RPGuard Pat [Stmt]
| RPCAs Name RPat
| RPAs Name RPat
| RPParen RPat
| RPPat Pat

data RPatOp

= RPStar
| RPStarG
| RPPlus
| RPPlusG
| RPOpt
| RPOptG

data Literal

= Char Char
| String String
| Int Integer
| Frac Rational
| PrimInt Integer
| PrimWord Integer
| PrimFloat Rational
| PrimDouble Rational
| PrimChar Char
| PrimString String

newtype ModuleName = ModuleName String

data QName

= Qual ModuleName Name
| UnQual Name
| Special SpecialCon

data Name

= Ident String
| Symbol String

data QOp

= QVarOp QName
| QConOp QName

data Op

= VarOp Name
| ConOp Name

data SpecialCon

= UnitCon
| ListCon
| FunCon
| TupleCon Boxed Int
| Cons
| UnboxedSingleCon

data CName

= VarName Name
| ConName Name

data IPName

= IPDup String
| IPLin String

data XName

= XName String
| XDomName String String

data Bracket

= ExpBracket Exp
| PatBracket Pat
| TypeBracket Type
| DeclBracket [Decl]

data Splice

= IdSplice String
| ParenSplice Exp

data Safety

= PlayRisky
| PlaySafe Bool

data CallConv

= StdCall
| CCall

data ModulePragma

= LanguagePragma SrcLoc [Name]
| OptionsPragma SrcLoc (Maybe Tool) String
| AnnModulePragma SrcLoc Annotation

data Tool

= GHC
| HUGS
| NHC98
| YHC
| HADDOCK
| UnknownTool String

data Rule = Rule String Activation (Maybe [RuleVar]) Exp Exp

data RuleVar

= RuleVar Name
| TypedRuleVar Name Type

data Activation

= AlwaysActive
| ActiveFrom Int
| ActiveUntil Int

data Annotation

= Ann Name Exp
| TypeAnn Name Exp
| ModuleAnn Exp

prelude_mod :: ModuleName
main_mod :: ModuleName
main_name :: Name
unit_con_name :: QName
tuple_con_name :: Boxed -> Int -> QName
list_cons_name :: QName
unboxed_singleton_con_name :: QName
unit_con :: Exp
tuple_con :: Boxed -> Int -> Exp
unboxed_singleton_con :: Exp
as_name :: Name
qualified_name :: Name
hiding_name :: Name
minus_name :: Name
bang_name :: Name
dot_name :: Name
star_name :: Name
export_name :: Name
safe_name :: Name
unsafe_name :: Name
threadsafe_name :: Name
stdcall_name :: Name
ccall_name :: Name
unit_tycon_name :: QName
fun_tycon_name :: QName
list_tycon_name :: QName
tuple_tycon_name :: Boxed -> Int -> QName
unboxed_singleton_tycon_name :: QName
unit_tycon :: Type
fun_tycon :: Type
list_tycon :: Type
tuple_tycon :: Boxed -> Int -> Type
unboxed_singleton_tycon :: Type

data SrcLoc = SrcLoc {

srcFilename :: String
srcLine :: Int
srcColumn :: Int

}

Modules

data Module | Source

A complete Haskell source module.
Constructors

Module SrcLoc ModuleName [ModulePragma] (Maybe WarningText) (Maybe [ExportSpec]) [ImportDecl] [Decl] |

Instances

Eq Module
Data Module
Ord Module
Show Module
Typeable Module
AppFixity Module
Pretty Module
Parseable Module

data WarningText | Source

Warning text to optionally use in the module header of e.g. a deprecated module.
Constructors

DeprText String |
WarnText String |

Instances

Eq WarningText
Data WarningText
Ord WarningText
Show WarningText
Typeable WarningText

data ExportSpec | Source

An item in a module's 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

Eq ExportSpec
Data ExportSpec
Ord ExportSpec
Show ExportSpec
Typeable ExportSpec
Pretty ExportSpec

data ImportDecl | Source

An 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 `{-# SOURCE #-}`?
importPkg :: Maybe String | imported with explicit package name
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

Eq ImportDecl
Data ImportDecl
Ord ImportDecl
Show ImportDecl
Typeable ImportDecl
Pretty ImportDecl

data ImportSpec | Source

An import specification, representing a single explicit item imported (or hidden) from a module.
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

Eq ImportSpec
Data ImportSpec
Ord ImportSpec
Show ImportSpec
Typeable ImportSpec
Pretty ImportSpec

data Assoc | Source

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

Eq Assoc
Data Assoc
Ord Assoc
Show Assoc
Typeable Assoc
Pretty Assoc

Declarations

data Decl | Source

A top-level declaration.
Constructors

TypeDecl SrcLoc Name [TyVarBind] Type | A type declaration
TypeFamDecl SrcLoc Name [TyVarBind] (Maybe Kind) | A type family declaration
DataDecl SrcLoc DataOrNew Context Name [TyVarBind] [QualConDecl] [Deriving] | A data OR newtype declaration
GDataDecl SrcLoc DataOrNew Context Name [TyVarBind] (Maybe Kind) [GadtDecl] [Deriving] | A data OR newtype declaration, GADT style
DataFamDecl SrcLoc Context Name [TyVarBind] (Maybe Kind) | A data family declaration
TypeInsDecl SrcLoc Type Type | A type family instance declaration
DataInsDecl SrcLoc DataOrNew Type [QualConDecl] [Deriving] | A data family instance declaration
GDataInsDecl SrcLoc DataOrNew Type (Maybe Kind) [GadtDecl] [Deriving] | A data family instance declaration, GADT style
ClassDecl SrcLoc Context Name [TyVarBind] [FunDep] [ClassDecl] | A declaration of a type class
InstDecl SrcLoc Context QName [Type] [InstDecl] | An declaration of a type class instance
DerivDecl SrcLoc Context QName [Type] | A standalone deriving declaration
InfixDecl SrcLoc Assoc Int [Op] | A declaration of operator fixity
DefaultDecl SrcLoc [Type] | A declaration of default types
SpliceDecl SrcLoc Exp | A Template Haskell splicing declaration
TypeSig SrcLoc [Name] Type | A type signature declaration
FunBind [Match] | A set of function binding clauses
PatBind SrcLoc Pat (Maybe Type) Rhs Binds | A pattern binding
ForImp SrcLoc CallConv Safety String Name Type | A foreign import declaration
ForExp SrcLoc CallConv String Name Type | A foreign export declaration
RulePragmaDecl SrcLoc [Rule] | A RULES pragma
DeprPragmaDecl SrcLoc [([Name], String)] | A DEPRECATED pragma
WarnPragmaDecl SrcLoc [([Name], String)] | A WARNING pragma
InlineSig SrcLoc Bool Activation QName | An INLINE pragma
InlineConlikeSig SrcLoc Activation QName | An INLINE CONLIKE pragma
SpecSig SrcLoc QName [Type] | A SPECIALISE pragma
SpecInlineSig SrcLoc Bool Activation QName [Type] | A SPECIALISE INLINE pragma
InstSig SrcLoc Context QName [Type] | A SPECIALISE instance pragma
AnnPragma SrcLoc Annotation | An ANN pragma

Instances

Eq Decl
Data Decl
Ord Decl
Show Decl
Typeable Decl
AppFixity Decl
Pretty Decl
Parseable Decl

data Binds | Source

A binding group inside a `let` or `where` clause.
Constructors

BDecls [Decl] | An ordinary binding group
IPBinds [IPBind] | A binding group for implicit parameters

Instances

Eq Binds
Data Binds
Ord Binds
Show Binds
Typeable Binds
AppFixity Binds

data IPBind | Source

A binding of an implicit parameter.
Constructors

IPBind SrcLoc IPName Exp |

Instances

Eq IPBind
Data IPBind
Ord IPBind
Show IPBind
Typeable IPBind
AppFixity IPBind
Pretty IPBind

Type classes and instances

data ClassDecl | Source

Declarations inside a class declaration.
Constructors

ClsDecl Decl | ordinary declaration
ClsDataFam SrcLoc Context Name [TyVarBind] (Maybe Kind) | declaration of an associated data type
ClsTyFam SrcLoc Name [TyVarBind] (Maybe Kind) | declaration of an associated type synonym
ClsTyDef SrcLoc Type Type | default choice for an associated type synonym

Instances

Eq ClassDecl
Data ClassDecl
Ord ClassDecl
Show ClassDecl
Typeable ClassDecl
AppFixity ClassDecl
Pretty ClassDecl

data InstDecl | Source

Declarations inside an instance declaration.
Constructors

InsDecl Decl | ordinary declaration
InsType SrcLoc Type Type | an associated type definition
InsData SrcLoc DataOrNew Type [QualConDecl] [Deriving] | an associated data type implementation
InsGData SrcLoc DataOrNew Type (Maybe Kind) [GadtDecl] [Deriving] | an associated data type implemented using GADT style

Instances

Eq InstDecl
Data InstDecl
Ord InstDecl
Show InstDecl
Typeable InstDecl
AppFixity InstDecl
Pretty InstDecl

type Deriving = (QName, [Type]) | Source

A single derived instance, which may have arguments since it may be a MPTC.
Data type declarations

data DataOrNew | Source

A flag stating whether a declaration is a data or newtype declaration.
Constructors

DataType |
NewType |

Instances

Eq DataOrNew
Data DataOrNew
Ord DataOrNew
Show DataOrNew
Typeable DataOrNew
Pretty DataOrNew

data ConDecl | Source

Declaration of an ordinary data constructor.
Constructors

ConDecl Name [BangType] | ordinary data constructor
InfixConDecl BangType Name BangType | infix data constructor
RecDecl Name [([Name], BangType)] | record constructor

Instances

Eq ConDecl
Data ConDecl
Ord ConDecl
Show ConDecl
Typeable ConDecl
Pretty ConDecl

data QualConDecl | Source

A single constructor declaration within a data type declaration, which may have an existential quantification binding.
Constructors

QualConDecl SrcLoc [TyVarBind] Context ConDecl |

Instances

Eq QualConDecl
Data QualConDecl
Ord QualConDecl
Show QualConDecl
Typeable QualConDecl
Pretty QualConDecl

data GadtDecl | Source

A single constructor declaration in a GADT data type declaration.
Constructors

GadtDecl SrcLoc Name Type |

Instances

Eq GadtDecl
Data GadtDecl
Ord GadtDecl
Show GadtDecl
Typeable GadtDecl
Pretty GadtDecl

data BangType | Source

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, marked with an UNPACK pragma

Instances

Eq BangType
Data BangType
Ord BangType
Show BangType
Typeable BangType
Pretty BangType

Function bindings

data Match | Source

Clauses of a function binding.
Constructors

Match SrcLoc Name [Pat] (Maybe Type) Rhs Binds |

Instances

Eq Match
Data Match
Ord Match
Show Match
Typeable Match
AppFixity Match
Pretty Match

data Rhs | Source

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

Eq Rhs
Data Rhs
Ord Rhs
Show Rhs
Typeable Rhs
AppFixity Rhs
Pretty Rhs

data GuardedRhs | 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.
Constructors

GuardedRhs SrcLoc [Stmt] Exp |

Instances

Eq GuardedRhs
Data GuardedRhs
Ord GuardedRhs
Show GuardedRhs
Typeable GuardedRhs
AppFixity GuardedRhs
Pretty GuardedRhs

Class Assertions and Contexts

type Context = [Asst] | Source

A context is a set of assertions

data FunDep | Source

A functional dependency, given on the form l1 l2 ... ln -> r2 r3 .. rn
Constructors

FunDep [Name] [Name] |

Instances

Eq FunDep
Data FunDep
Ord FunDep
Show FunDep
Typeable FunDep
Pretty FunDep

data Asst | Source

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

ClassA QName [Type] | ordinary class assertion
InfixA Type QName Type | class assertion where the class name is given infix
IParam IPName Type | implicit parameter assertion
EqualP Type Type | type equality constraint

Instances

Eq Asst
Data Asst
Ord Asst
Show Asst
Typeable Asst
Pretty Asst

Types

data Type | Source

A type qualified with a context. An unqualified type has an empty context.
Constructors

TyForall (Maybe [TyVarBind]) Context Type | qualified type
TyFun Type Type | function type
TyTuple Boxed [Type] | tuple type, possibly boxed
TyList Type | list syntax, e.g. [a], as opposed to [] a
TyApp Type Type | application of a type constructor
TyVar Name | type variable
TyCon QName | named type or type constructor
TyParen Type | type surrounded by parentheses
TyInfix Type QName Type | infix type constructor
TyKind Type Kind | type with explicit kind signature

Instances

Eq Type
Data Type
Ord Type
Show Type
Typeable Type
Pretty Type
Parseable Type

data Boxed | Source

Flag denoting whether a tuple is boxed or unboxed.
Constructors

Boxed |
Unboxed |

Instances

Eq Boxed
Data Boxed
Ord Boxed
Show Boxed
Typeable Boxed

data Kind | Source

An explicit kind annotation.
Constructors

KindStar | `*`, the kind of types
KindBang | `!`, the kind of unboxed types
KindFn Kind Kind | `->`, the kind of a type constructor
KindParen Kind | a kind surrounded by parentheses
KindVar Name | a kind variable (as of yet unsupported by compilers)

Instances

Eq Kind
Data Kind
Ord Kind
Show Kind
Typeable Kind
Pretty Kind

data TyVarBind | Source

A type variable declaration, optionally with an explicit kind annotation.
Constructors

KindedVar Name Kind | variable binding with kind annotation
UnkindedVar Name | ordinary variable binding

Instances

Eq TyVarBind
Data TyVarBind
Ord TyVarBind
Show TyVarBind
Typeable TyVarBind
Pretty TyVarBind

Expressions

data Exp | Source

Haskell expressions.
Constructors

Var QName | variable
IPVar IPName | implicit parameter variable
Con QName | data constructor
Lit Literal | literal constant
InfixApp Exp QOp Exp | infix application
App Exp Exp | ordinary application
NegApp Exp | negation expression `-exp` (unary minus)
Lambda SrcLoc [Pat] Exp | lambda expression
Let Binds Exp | local declarations with `let` ... `in` ...
If Exp Exp Exp | `if` exp `then` exp `else` exp
Case Exp [Alt] | `case` exp `of` alts
Do [Stmt] | `do`-expression: the last statement in the list should be an expression.
MDo [Stmt] | `mdo`-expression
Tuple [Exp] | tuple expression
TupleSection [Maybe Exp] | tuple section expression, e.g. `(,,3)`
List [Exp] | list expression
Paren Exp | parenthesised expression
LeftSection Exp QOp | left section `(`exp qop`)`
RightSection QOp Exp | right section `(`qop exp`)`
RecConstr QName [FieldUpdate] | record construction expression
RecUpdate Exp [FieldUpdate] | record update expression
EnumFrom Exp | unbounded arithmetic sequence, incrementing by 1: `[from ..]`
EnumFromTo Exp Exp | bounded arithmetic sequence, incrementing by 1 `[from .. to]`
EnumFromThen Exp Exp | unbounded arithmetic sequence, with first two elements given `[from, then ..]`
EnumFromThenTo Exp Exp Exp | bounded arithmetic sequence, with first two elements given `[from, then .. to]`
ListComp Exp [QualStmt] | ordinary list comprehension
ParComp Exp [[QualStmt]] | parallel list comprehension
ExpTypeSig SrcLoc Exp Type | expression with explicit type signature
VarQuote QName | `'x` for template haskell reifying of expressions
TypQuote QName | `''T` for template haskell reifying of types
BracketExp Bracket | template haskell bracket expression
SpliceExp Splice | template haskell splice expression
QuasiQuote String String | quasi-quotaion: `[$name| string |]`
XTag SrcLoc XName [XAttr] (Maybe Exp) [Exp] | xml element, with attributes and children
XETag SrcLoc XName [XAttr] (Maybe Exp) | empty xml element, with attributes
XPcdata String | PCDATA child element
XExpTag Exp | escaped haskell expression inside xml
CorePragma String Exp | CORE pragma
SCCPragma String Exp | SCC pragma
GenPragma String (Int, Int) (Int, Int) Exp | GENERATED pragma
Proc SrcLoc Pat Exp | arrows proc: `proc` pat `->` exp
LeftArrApp Exp Exp | arrow application (from left): exp `-<` exp
RightArrApp Exp Exp | arrow application (from right): exp `>-` exp
LeftArrHighApp Exp Exp | higher-order arrow application (from left): exp `-<<` exp
RightArrHighApp Exp Exp | higher-order arrow application (from right): exp `>>-` exp

Instances

Eq Exp
Data Exp
Ord Exp
Show Exp
Typeable Exp
AppFixity Exp
Pretty Exp
Parseable Exp

data Stmt | Source

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.
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 and pattern guard, a guard expression
LetStmt Binds | local bindings
RecStmt [Stmt] | a recursive binding group for arrows

Instances

Eq Stmt
Data Stmt
Ord Stmt
Show Stmt
Typeable Stmt
AppFixity Stmt
Pretty Stmt

data QualStmt | Source

A general transqual in a list comprehension, which could potentially be a transform of the kind enabled by TransformListComp.
Constructors

QualStmt Stmt | an ordinary statement
ThenTrans Exp | `then` exp
ThenBy Exp Exp | `then` exp `by` exp
GroupBy Exp | `then` `group` `by` exp
GroupUsing Exp | `then` `group` `using` exp
GroupByUsing Exp Exp | `then` `group` `by` exp `using` exp

Instances

Eq QualStmt
Data QualStmt
Ord QualStmt
Show QualStmt
Typeable QualStmt
AppFixity QualStmt
Pretty QualStmt

data FieldUpdate | Source

An fbind in a labeled construction or update expression.
Constructors

FieldUpdate QName Exp | ordinary label-expresion pair
FieldPun Name | record field pun
FieldWildcard | record field wildcard

Instances

Eq FieldUpdate
Data FieldUpdate
Ord FieldUpdate
Show FieldUpdate
Typeable FieldUpdate
AppFixity FieldUpdate
Pretty FieldUpdate

data Alt | Source

An alt alternative in a `case` expression.
Constructors

Alt SrcLoc Pat GuardedAlts Binds |

Instances

Eq Alt
Data Alt
Ord Alt
Show Alt
Typeable Alt
AppFixity Alt
Pretty Alt

data GuardedAlts | Source

The right-hand sides of a `case` alternative, which may be a single right-hand side or a set of guarded ones.
Constructors

UnGuardedAlt Exp | `->` exp
GuardedAlts [GuardedAlt] | gdpat

Instances

Eq GuardedAlts
Data GuardedAlts
Ord GuardedAlts
Show GuardedAlts
Typeable GuardedAlts
AppFixity GuardedAlts
Pretty GuardedAlts

data GuardedAlt | Source

A guarded case alternative `|` stmts `->` exp.
Constructors

GuardedAlt SrcLoc [Stmt] Exp |

Instances

Eq GuardedAlt
Data GuardedAlt
Ord GuardedAlt
Show GuardedAlt
Typeable GuardedAlt
AppFixity GuardedAlt
Pretty GuardedAlt

data XAttr | Source

An xml attribute, which is a name-expression pair.
Constructors

XAttr XName Exp |

Instances

Eq XAttr
Data XAttr
Ord XAttr
Show XAttr
Typeable XAttr
AppFixity XAttr
Pretty XAttr

Patterns

data Pat | Source

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 an 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, record style
PAsPat Name Pat | `@`-pattern
PWildCard | wildcard pattern: `_`
PIrrPat Pat | irrefutable pattern: `~pat`
PatTypeSig SrcLoc Pat Type | pattern with type signature
PViewPat Exp Pat | view patterns of the form `(exp -> pat)`
PRPat [RPat] | regular list pattern
PXTag SrcLoc XName [PXAttr] (Maybe Pat) [Pat] | XML element pattern
PXETag SrcLoc XName [PXAttr] (Maybe Pat) | XML singleton element pattern
PXPcdata String | XML PCDATA pattern
PXPatTag Pat | XML embedded pattern
PXRPats [RPat] | XML regular list pattern
PExplTypeArg QName Type | Explicit generics style type argument e.g. `f {| Int |} x = ...`
PQuasiQuote String String | quasi quote patter: `[$name| string |]`
PBangPat Pat | strict (bang) pattern: `f !x = ...`

Instances

Eq Pat
Data Pat
Ord Pat
Show Pat
Typeable Pat
AppFixity Pat
Pretty Pat
Parseable Pat

data PatField | Source

An fpat in a labeled record pattern.
Constructors

PFieldPat QName Pat | ordinary label-pattern pair
PFieldPun Name | record field pun
PFieldWildcard | record field wildcard

Instances

Eq PatField
Data PatField
Ord PatField
Show PatField
Typeable PatField
AppFixity PatField
Pretty PatField

data PXAttr | Source

An XML attribute in a pattern.
Constructors

PXAttr XName Pat |

Instances

Eq PXAttr
Data PXAttr
Ord PXAttr
Show PXAttr
Typeable PXAttr
AppFixity PXAttr
Pretty PXAttr

data RPat | Source

An entity in a regular pattern.
Constructors

RPOp RPat RPatOp | operator pattern, e.g. pat*
RPEither RPat RPat | choice pattern, e.g. (1 | 2)
RPSeq [RPat] | sequence pattern, e.g. (| 1, 2, 3 |)
RPGuard Pat [Stmt] | guarded pattern, e.g. (| p | p < 3 |)
RPCAs Name RPat | non-linear variable binding, e.g. (foo@:(1 | 2))*
RPAs Name RPat | linear variable binding, e.g. foo@(1 | 2)
RPParen RPat | parenthesised pattern, e.g. (2*)
RPPat Pat | an ordinary pattern

Instances

Eq RPat
Data RPat
Ord RPat
Show RPat
Typeable RPat
AppFixity RPat
Pretty RPat

data RPatOp | Source

A regular pattern operator.
Constructors

RPStar | `*` = 0 or more
RPStarG | `*!` = 0 or more, greedy
RPPlus | `+` = 1 or more
RPPlusG | `+!` = 1 or more, greedy
RPOpt | `?` = 0 or 1
RPOptG | `?!` = 0 or 1, greedy

Instances

Eq RPatOp
Data RPatOp
Ord RPatOp
Show RPatOp
Typeable RPatOp
Pretty RPatOp

Literals

data Literal | Source

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 | unboxed integer literal
PrimWord Integer | unboxed word literal
PrimFloat Rational | unboxed float literal
PrimDouble Rational | unboxed double literal
PrimChar Char | unboxed character literal
PrimString String | unboxed string literal

Instances

Eq Literal
Data Literal
Ord Literal
Show Literal
Typeable Literal
Pretty Literal

Variables, Constructors and Operators

newtype ModuleName | Source

The name of a Haskell module.
Constructors

ModuleName String |

Instances

Eq ModuleName
Data ModuleName
Ord ModuleName
Show ModuleName
Typeable ModuleName
Pretty ModuleName

data QName | Source

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 local name
Special SpecialCon | built-in constructor with special syntax

Instances

Eq QName
Data QName
Ord QName
Show QName
Typeable QName
Pretty QName

data Name | Source

This type is used to represent variables, and also constructors.
Constructors

Ident String | varid or conid.
Symbol String | varsym or consym

Instances

Eq Name
Data Name
Ord Name
Show Name
Typeable Name
Pretty Name

data QOp | Source

Possibly qualified infix operators (qop), appearing in expressions.
Constructors

QVarOp QName | variable operator (qvarop)
QConOp QName | constructor operator (qconop)

Instances

Eq QOp
Data QOp
Ord QOp
Show QOp
Typeable QOp
Pretty QOp

data Op | Source

Operators appearing in `infix` declarations are never qualified.
Constructors

VarOp Name | variable operator (varop)
ConOp Name | constructor operator (conop)

Instances

Eq Op
Data Op
Ord Op
Show Op
Typeable Op
Pretty Op

data SpecialCon | Source

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 Boxed Int | n-ary tuple type and data constructors `(,)` etc, possibly boxed `(#,#)`
Cons | list data constructor `(:)`
UnboxedSingleCon | unboxed singleton tuple constructor `(# #)`

Instances

Eq SpecialCon
Data SpecialCon
Ord SpecialCon
Show SpecialCon
Typeable SpecialCon
Pretty SpecialCon

data CName | Source

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

Eq CName
Data CName
Ord CName
Show CName
Typeable CName
Pretty CName

data IPName | Source

An implicit parameter name.
Constructors

IPDup String | ?ident, non-linear implicit parameter
IPLin String | %ident, linear implicit parameter

Instances

Eq IPName
Data IPName
Ord IPName
Show IPName
Typeable IPName
Pretty IPName

data XName | Source

The name of an xml element or attribute, possibly qualified with a namespace.
Constructors

XName String |
XDomName String String |

Instances

Eq XName
Data XName
Ord XName
Show XName
Typeable XName
Pretty XName

Template Haskell

data Bracket | Source

A template haskell bracket expression.
Constructors

ExpBracket Exp | expression bracket: `[| ... |]`
PatBracket Pat | pattern bracket: `[p| ... |]`
TypeBracket Type | type bracket: `[t| ... |]`
DeclBracket [Decl] | declaration bracket: `[d| ... |]`

Instances

Eq Bracket
Data Bracket
Ord Bracket
Show Bracket
Typeable Bracket
AppFixity Bracket
Pretty Bracket

data Splice | Source

A template haskell splice expression
Constructors

IdSplice String | variable splice: `$var`
ParenSplice Exp | parenthesised expression splice: `$(exp)`

Instances

Eq Splice
Data Splice
Ord Splice
Show Splice
Typeable Splice
AppFixity Splice
Pretty Splice

FFI

data Safety | Source

The safety of a foreign function call.
Constructors

PlayRisky | unsafe
PlaySafe Bool | safe (`False`) or threadsafe (`True`)

Instances

Eq Safety
Data Safety
Ord Safety
Show Safety
Typeable Safety
Pretty Safety

data CallConv | Source

The calling convention of a foreign function call.
Constructors

StdCall |
CCall |

Instances

Eq CallConv
Data CallConv
Ord CallConv
Show CallConv
Typeable CallConv
Pretty CallConv

Pragmas

data ModulePragma | Source

A top level options pragma, preceding the module header.
Constructors

LanguagePragma SrcLoc [Name] | LANGUAGE pragma
OptionsPragma SrcLoc (Maybe Tool) String | OPTIONS pragma, possibly qualified with a tool, e.g. OPTIONS_GHC
AnnModulePragma SrcLoc Annotation | ANN pragma with module scope

Instances

Eq ModulePragma
Data ModulePragma
Ord ModulePragma
Show ModulePragma
Typeable ModulePragma
Pretty ModulePragma

data Tool | Source

Recognised tools for OPTIONS pragmas.
Constructors

GHC |
HUGS |
NHC98 |
YHC |
HADDOCK |
UnknownTool String |

Instances

Eq Tool
Data Tool
Ord Tool
Show Tool
Typeable Tool
Pretty Tool

data Rule | Source

The body of a RULES pragma.
Constructors

Rule String Activation (Maybe [RuleVar]) Exp Exp |

Instances

Eq Rule
Data Rule
Ord Rule
Show Rule
Typeable Rule
Pretty Rule

data RuleVar | Source

Variables used in a RULES pragma, optionally annotated with types
Constructors

RuleVar Name |
TypedRuleVar Name Type |

Instances

Eq RuleVar
Data RuleVar
Ord RuleVar
Show RuleVar
Typeable RuleVar
Pretty RuleVar

data Activation | Source

Activation clause of a RULES pragma.
Constructors

AlwaysActive |
ActiveFrom Int |
ActiveUntil Int |

Instances

Eq Activation
Data Activation
Ord Activation
Show Activation
Typeable Activation
Pretty Activation

data Annotation | Source

An annotation through an ANN pragma.
Constructors

Ann Name Exp | An annotation for a declared name.
TypeAnn Name Exp | An annotation for a declared type.
ModuleAnn Exp | An annotation for the defining module.

Instances

Eq Annotation
Data Annotation
Ord Annotation
Show Annotation
Typeable Annotation
AppFixity Annotation
Pretty Annotation

Builtin names
Modules

prelude_mod :: ModuleName | Source

main_mod :: ModuleName | Source

Main function of a program

main_name :: Name | Source

Constructors

unit_con_name :: QName | Source

tuple_con_name :: Boxed -> Int -> QName | Source

list_cons_name :: QName | Source

unboxed_singleton_con_name :: QName | Source

unit_con :: Exp | Source

tuple_con :: Boxed -> Int -> Exp | Source

unboxed_singleton_con :: Exp | Source

Special identifiers

as_name :: Name | Source

qualified_name :: Name | Source

hiding_name :: Name | Source

minus_name :: Name | Source

bang_name :: Name | Source

dot_name :: Name | Source

star_name :: Name | Source

export_name :: Name | Source

safe_name :: Name | Source

unsafe_name :: Name | Source

threadsafe_name :: Name | Source

stdcall_name :: Name | Source

ccall_name :: Name | Source

Type constructors

unit_tycon_name :: QName | Source

fun_tycon_name :: QName | Source

list_tycon_name :: QName | Source

tuple_tycon_name :: Boxed -> Int -> QName | Source

unboxed_singleton_tycon_name :: QName | Source

unit_tycon :: Type | Source

fun_tycon :: Type | Source

list_tycon :: Type | Source

tuple_tycon :: Boxed -> Int -> Type | Source

unboxed_singleton_tycon :: Type | Source

Source coordinates

data SrcLoc | Source

A single position in the source.
Constructors

SrcLoc |

srcFilename :: String |
srcLine :: Int |
srcColumn :: Int |

Instances

Eq SrcLoc
Data SrcLoc
Ord SrcLoc
Show SrcLoc
Typeable SrcLoc
SrcInfo SrcLoc
Pretty SrcLoc

Produced by Haddock version 2.4.2