haskell-src-exts-1.17.1: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Copyright | (c) Niklas Broberg 2004-2009, (c) The GHC Team, 1997-2000
License | BSD-style (see the file LICENSE.txt)
Maintainer | Niklas Broberg, d00nibro@chalmers.se
Stability | stable
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Language.Haskell.Exts.Annotated.Syntax

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
- Annotated trees

Description

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.

Synopsis

- 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
  - = DeprText l String
  - | WarnText l String
- data ExportSpecList l = ExportSpecList l [ExportSpec l]
- data ExportSpec l
  - = EVar l (QName l)
  - | EAbs l (Namespace 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
  - importSafe :: Bool
  - importPkg :: Maybe String
  - importAs :: Maybe (ModuleName l)
  - importSpecs :: Maybe (ImportSpecList l)
  }
- data ImportSpecList l = ImportSpecList l Bool [ImportSpec l]
- data ImportSpec l
  - = IVar l (Name l)
  - | IAbs l (Namespace l) (Name l)
  - | IThingAll l (Name l)
  - | IThingWith l (Name l) [CName l]
- data Assoc l
  - = AssocNone l
  - | AssocLeft l
  - | AssocRight l
- data Namespace l
  - = NoNamespace l
  - | TypeNamespace l
  - | PatternNamespace l
- data Decl l
  - = TypeDecl l (DeclHead l) (Type l)
  - | TypeFamDecl l (DeclHead l) (Maybe (Kind l))
  - | ClosedTypeFamDecl l (DeclHead l) (Maybe (Kind l)) [TypeEqn 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 (Overlap l)) (InstRule l) (Maybe [InstDecl l])
  - | DerivDecl l (Maybe (Overlap l)) (InstRule l)
  - | InfixDecl l (Assoc l) (Maybe Int) [Op l]
  - | DefaultDecl l [Type l]
  - | SpliceDecl l (Exp l)
  - | TypeSig l [Name l] (Type l)
  - | PatSynSig l (Name l) (Maybe [TyVarBind l]) (Maybe (Context l)) (Maybe (Context l)) (Type l)
  - | FunBind l [Match l]
  - | PatBind l (Pat l) (Rhs l) (Maybe (Binds l))
  - | PatSyn l (Pat l) (Pat l) (PatternSynDirection 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 (Maybe (Activation l)) (QName l) [Type l]
  - | SpecInlineSig l Bool (Maybe (Activation l)) (QName l) [Type l]
  - | InstSig l (InstRule l)
  - | AnnPragma l (Annotation l)
  - | MinimalPragma l (Maybe (BooleanFormula l))
  - | RoleAnnotDecl l (QName l) [Role l]
- data DeclHead l
  - = DHead l (Name l)
  - | DHInfix l (TyVarBind l) (Name l)
  - | DHParen l (DeclHead l)
  - | DHApp l (DeclHead l) (TyVarBind l)
- data InstRule l
  - = IRule l (Maybe [TyVarBind l]) (Maybe (Context l)) (InstHead l)
  - | IParen l (InstRule l)
- data InstHead l
  - = IHCon l (QName l)
  - | IHInfix l (Type l) (QName l)
  - | IHParen l (InstHead l)
  - | IHApp l (InstHead l) (Type l)
- data Binds l
  - = BDecls l [Decl l]
  - | IPBinds l [IPBind l]
- data IPBind l = IPBind l (IPName l) (Exp l)
- data PatternSynDirection l
  - = Unidirectional
  - | ImplicitBidirectional
  - | ExplicitBidirectional l [Decl l]
- data ClassDecl l
  - = ClsDecl l (Decl l)
  - | ClsDataFam l (Maybe (Context l)) (DeclHead l) (Maybe (Kind l))
  - | ClsTyFam l (DeclHead l) (Maybe (Kind l))
  - | ClsTyDef l (Type l) (Type l)
  - | ClsDefSig l (Name l) (Type l)
- data InstDecl l
  - = InsDecl l (Decl l)
  - | InsType l (Type l) (Type l)
  - | InsData l (DataOrNew l) (Type l) [QualConDecl l] (Maybe (Deriving l))
  - | InsGData l (DataOrNew l) (Type l) (Maybe (Kind l)) [GadtDecl l] (Maybe (Deriving l))
- data Deriving l = Deriving l [InstRule l]
- data DataOrNew l
  - = DataType l
  - | NewType l
- data ConDecl l
  - = ConDecl l (Name l) [Type l]
  - | InfixConDecl l (Type l) (Name l) (Type l)
  - | RecDecl l (Name l) [FieldDecl l]
- data FieldDecl l = FieldDecl l [Name l] (Type l)
- data QualConDecl l = QualConDecl l (Maybe [TyVarBind l]) (Maybe (Context l)) (ConDecl l)
- data GadtDecl l = GadtDecl l (Name l) (Maybe [FieldDecl l]) (Type l)
- data BangType l
  - = BangedTy l
  - | UnpackedTy l
- data Match l
  - = Match l (Name l) [Pat l] (Rhs l) (Maybe (Binds l))
  - | InfixMatch l (Pat l) (Name l) [Pat l] (Rhs l) (Maybe (Binds l))
- data Rhs l
  - = UnGuardedRhs l (Exp l)
  - | GuardedRhss l [GuardedRhs l]
- data GuardedRhs l = GuardedRhs l [Stmt l] (Exp l)
- data Context l
  - = CxSingle l (Asst l)
  - | CxTuple l [Asst l]
  - | CxEmpty l
- data FunDep l = FunDep l [Name l] [Name l]
- data Asst l
  - = ClassA l (QName l) [Type l]
  - | AppA l (Name l) [Type l]
  - | InfixA l (Type l) (QName l) (Type l)
  - | IParam l (IPName l) (Type l)
  - | EqualP l (Type l) (Type l)
  - | ParenA l (Asst l)
  - | WildCardA l (Maybe (Name l))
- data Type l
  - = TyForall l (Maybe [TyVarBind l]) (Maybe (Context l)) (Type l)
  - | TyFun l (Type l) (Type l)
  - | TyTuple l Boxed [Type l]
  - | TyList l (Type l)
  - | TyParArray l (Type l)
  - | TyApp l (Type l) (Type l)
  - | TyVar l (Name l)
  - | TyCon l (QName l)
  - | TyParen l (Type l)
  - | TyInfix l (Type l) (QName l) (Type l)
  - | TyKind l (Type l) (Kind l)
  - | TyPromoted l (Promoted l)
  - | TyEquals l (Type l) (Type l)
  - | TySplice l (Splice l)
  - | TyBang l (BangType l) (Type l)
  - | TyWildCard l (Maybe (Name l))
- data Boxed
  - = Boxed
  - | Unboxed
- data Kind l
  - = KindStar l
  - | KindFn l (Kind l) (Kind l)
  - | KindParen l (Kind l)
  - | KindVar l (QName l)
  - | KindApp l (Kind l) (Kind l)
  - | KindTuple l [Kind l]
  - | KindList l (Kind l)
- data TyVarBind l
  - = KindedVar l (Name l) (Kind l)
  - | UnkindedVar l (Name l)
- data Promoted l
  - = PromotedInteger l Integer String
  - | PromotedString l String String
  - | PromotedCon l Bool (QName l)
  - | PromotedList l Bool [Type l]
  - | PromotedTuple l [Type l]
  - | PromotedUnit l
- data TypeEqn l = TypeEqn l (Type l) (Type 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)
  - | MultiIf l [GuardedRhs l]
  - | Case l (Exp l) [Alt l]
  - | Do l [Stmt l]
  - | MDo l [Stmt l]
  - | Tuple l Boxed [Exp l]
  - | TupleSection l Boxed [Maybe (Exp l)]
  - | List l [Exp l]
  - | ParArray 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)
  - | ParArrayFromTo l (Exp l) (Exp l)
  - | ParArrayFromThenTo l (Exp l) (Exp l) (Exp l)
  - | ListComp l (Exp l) [QualStmt l]
  - | ParComp l (Exp l) [[QualStmt l]]
  - | ParArrayComp 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)
  - | XChildTag 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)
  - | LCase l [Alt l]
  - | ExprHole l
- data Stmt l
  - = Generator l (Pat l) (Exp l)
  - | Qualifier l (Exp l)
  - | LetStmt l (Binds l)
  - | RecStmt l [Stmt l]
- data QualStmt l
  - = QualStmt l (Stmt l)
  - | ThenTrans l (Exp l)
  - | ThenBy l (Exp l) (Exp l)
  - | GroupBy l (Exp l)
  - | GroupUsing l (Exp l)
  - | GroupByUsing l (Exp l) (Exp l)
- data FieldUpdate l
  - = FieldUpdate l (QName l) (Exp l)
  - | FieldPun l (QName l)
  - | FieldWildcard l
- data Alt l = Alt l (Pat l) (Rhs l) (Maybe (Binds l))
- data XAttr l = XAttr l (XName l) (Exp l)
- data Pat l
  - = PVar l (Name l)
  - | PLit l (Sign l) (Literal l)
  - | PNPlusK l (Name l) Integer
  - | PInfixApp l (Pat l) (QName l) (Pat l)
  - | PApp l (QName l) [Pat l]
  - | PTuple l Boxed [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]
  - | PQuasiQuote l String String
  - | PBangPat l (Pat l)
- data PatField l
  - = PFieldPat l (QName l) (Pat l)
  - | PFieldPun l (QName l)
  - | PFieldWildcard l
- data PXAttr l = PXAttr l (XName l) (Pat l)
- data RPat l
  - = RPOp l (RPat l) (RPatOp l)
  - | RPEither l (RPat l) (RPat l)
  - | RPSeq l [RPat l]
  - | RPGuard l (Pat l) [Stmt l]
  - | RPCAs l (Name l) (RPat l)
  - | RPAs l (Name l) (RPat l)
  - | RPParen l (RPat l)
  - | RPPat l (Pat l)
- data RPatOp l
  - = RPStar l
  - | RPStarG l
  - | RPPlus l
  - | RPPlusG l
  - | RPOpt l
  - | RPOptG l
- data Literal l
  - = Char l Char String
  - | String l String String
  - | Int l Integer String
  - | Frac l Rational String
  - | PrimInt l Integer String
  - | PrimWord l Integer String
  - | PrimFloat l Rational String
  - | PrimDouble l Rational String
  - | PrimChar l Char String
  - | PrimString l String String
- data Sign l
  - = Signless l
  - | Negative 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
  - = Ident l String
  - | Symbol l String
- data QOp l
  - = QVarOp l (QName l)
  - | QConOp l (QName l)
- data Op l
  - = VarOp l (Name l)
  - | ConOp l (Name l)
- data SpecialCon l
  - = UnitCon l
  - | ListCon l
  - | FunCon l
  - | TupleCon l Boxed Int
  - | Cons l
  - | UnboxedSingleCon l
- data CName l
  - = VarName l (Name l)
  - | ConName l (Name l)
- data IPName l
  - = IPDup l String
  - | IPLin l String
- data XName l
  - = XName l String
  - | XDomName l String String
- data Role l
  - = Nominal l
  - | Representational l
  - | Phantom l
  - | RoleWildcard 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
  - = PlayRisky l
  - | PlaySafe l Bool
  - | PlayInterruptible l
- data CallConv l
  - = StdCall l
  - | CCall l
  - | CPlusPlus l
  - | DotNet l
  - | Jvm l
  - | Js l
  - | JavaScript l
  - | CApi l
- data ModulePragma l
  - = LanguagePragma l [Name l]
  - | OptionsPragma l (Maybe Tool) String
  - | AnnModulePragma l (Annotation l)
- data Tool
  - = GHC
  - | HUGS
  - | NHC98
  - | YHC
  - | HADDOCK
  - | UnknownTool String
- data Overlap l
  - = NoOverlap l
  - | Overlap l
  - | Incoherent l
- 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
  - = Ann l (Name l) (Exp l)
  - | TypeAnn l (Name l) (Exp l)
  - | ModuleAnn l (Exp l)
- data BooleanFormula l
  - = VarFormula l (Name l)
  - | AndFormula l [BooleanFormula l]
  - | OrFormula l [BooleanFormula l]
  - | ParenFormula l (BooleanFormula 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
- interruptible_name :: l -> Name l
- threadsafe_name :: l -> Name l
- stdcall_name :: l -> Name l
- ccall_name :: l -> Name l
- cplusplus_name :: l -> Name l
- dotnet_name :: l -> Name l
- jvm_name :: l -> Name l
- js_name :: l -> Name l
- javascript_name :: l -> Name l
- capi_name :: l -> Name l
- forall_name :: l -> Name l
- family_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
  - ann :: ast l -> l
  - amap :: (l -> l) -> ast l -> ast l
- (=~=) :: (Annotated a, Eq (a ())) => a l1 -> a l2 -> Bool

# Modules

data Module l

A complete Haskell source module.

Constructors

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

Instances

Functor Module |
Foldable Module |
Traversable Module |
Annotated Module |
ExactP Module |
AppFixity Module |
Eq l => Eq (Module l) |
Data l => Data (Module l) |
Ord l => Ord (Module l) |
Show l => Show (Module l) |
Generic (Module l) |
SrcInfo pos => Pretty (Module pos) |
type Rep (Module l) |

data ModuleHead l

The head of a module, including the name and export specification.

Constructors

ModuleHead l (ModuleName l) (Maybe (WarningText l)) (Maybe (ExportSpecList l)) |

Instances

Functor ModuleHead |
Foldable ModuleHead |
Traversable 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) |
Generic (ModuleHead l) |
Pretty (ModuleHead l) |
type Rep (ModuleHead l) |

data WarningText l

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

Constructors

DeprText l String |
WarnText l String |

Instances

Functor WarningText |
Foldable WarningText |
Traversable 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) |
Generic (WarningText l) |
Pretty (WarningText l) |
type Rep (WarningText l) |

data ExportSpecList l

An explicit export specification.

Constructors

ExportSpecList l [ExportSpec l] |

Instances

Functor ExportSpecList |
Foldable ExportSpecList |
Traversable 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) |
Generic (ExportSpecList l) |
Pretty (ExportSpecList l) |
type Rep (ExportSpecList l) |

data ExportSpec l

An item in a module's export specification.

Constructors

EVar l (QName l) | variable.
EAbs l (Namespace l) (QName l) | `T`: a class or datatype exported abstractly, or a type synonym.
EThingAll l (QName l) | `T(..)`: a class exported with all of its methods, or a datatype exported with all of its constructors.
EThingWith l (QName l) [CName l] | `T(C_1,...,C_n)`: a class exported with some of its methods, or a datatype exported with some of its constructors.
EModuleContents l (ModuleName l) | `module M`: re-export a module.

Instances

Functor ExportSpec |
Foldable ExportSpec |
Traversable 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) |
Generic (ExportSpec l) |
Pretty (ExportSpec l) |
type Rep (ExportSpec l) |

data ImportDecl l

An import declaration.

Constructors

ImportDecl |
Fields importAnn :: l annotation, used by parser for position of the `import` keyword. importModule :: ModuleName l name of the module imported. importQualified :: Bool imported `qualified`? importSrc :: Bool imported with `{-# SOURCE #-}`? importSafe :: Bool Import `safe`? importPkg :: Maybe String imported with explicit package name importAs :: Maybe (ModuleName l) optional alias name in an `as` clause. importSpecs :: Maybe (ImportSpecList l) optional list of import specifications.

Instances

Functor ImportDecl |
Foldable ImportDecl |
Traversable 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) |
Generic (ImportDecl l) |
SrcInfo pos => Pretty (ImportDecl pos) |
type Rep (ImportDecl l) |

data ImportSpecList l

An explicit import specification list.

Constructors

ImportSpecList l Bool [ImportSpec l] |

Instances

Functor ImportSpecList |
Foldable ImportSpecList |
Traversable 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) |
Generic (ImportSpecList l) |
Pretty (ImportSpecList l) |
type Rep (ImportSpecList l) |

data ImportSpec l

An import specification, representing a single explicit item imported (or hidden) from a module.

Constructors

IVar l (Name l) | variable
IAbs l (Namespace l) (Name l) | `T`: the name of a class, datatype or type synonym.
IThingAll l (Name l) | `T(..)`: a class imported with all of its methods, or a datatype imported with all of its constructors.
IThingWith l (Name l) [CName l] | `T(C_1,...,C_n)`: a class imported with some of its methods, or a datatype imported with some of its constructors.

Instances

Functor ImportSpec |
Foldable ImportSpec |
Traversable 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) |
Generic (ImportSpec l) |
Pretty (ImportSpec l) |
type Rep (ImportSpec l) |

data Assoc l

Associativity of an operator.

Constructors

AssocNone l | non-associative operator (declared with `infix`)
AssocLeft l | left-associative operator (declared with `infixl`).
AssocRight l | right-associative operator (declared with `infixr`)

Instances

Functor Assoc |
Foldable Assoc |
Traversable Assoc |
Annotated Assoc |
ExactP Assoc |
Eq l => Eq (Assoc l) |
Data l => Data (Assoc l) |
Ord l => Ord (Assoc l) |
Show l => Show (Assoc l) |
Generic (Assoc l) |
Pretty (Assoc l) |
type Rep (Assoc l) |

data Namespace l

Namespaces for imports/exports.

Constructors

NoNamespace l |
TypeNamespace l |
PatternNamespace l |

Instances

Functor Namespace |
Foldable Namespace |
Traversable Namespace |
Annotated Namespace |
ExactP Namespace |
Eq l => Eq (Namespace l) |
Data l => Data (Namespace l) |
Ord l => Ord (Namespace l) |
Show l => Show (Namespace l) |
Generic (Namespace l) |
type Rep (Namespace l) |

# Declarations

data Decl l

A top-level declaration.

Constructors

TypeDecl l (DeclHead l) (Type l) | A type declaration
TypeFamDecl l (DeclHead l) (Maybe (Kind l)) | A type family declaration
ClosedTypeFamDecl l (DeclHead l) (Maybe (Kind l)) [TypeEqn l] | A closed 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 (Overlap l)) (InstRule l) (Maybe [InstDecl l]) | An declaration of a type class instance
DerivDecl l (Maybe (Overlap l)) (InstRule 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
PatSynSig l (Name l) (Maybe [TyVarBind l]) (Maybe (Context l)) (Maybe (Context l)) (Type l) | A pattern synonym signature declation
FunBind l [Match l] | A set of function binding clauses
PatBind l (Pat l) (Rhs l) (Maybe (Binds l)) | A pattern binding
PatSyn l (Pat l) (Pat l) (PatternSynDirection l) | A pattern synonym 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 (Maybe (Activation l)) (QName l) [Type l] | A SPECIALISE pragma
SpecInlineSig l Bool (Maybe (Activation l)) (QName l) [Type l] | A SPECIALISE INLINE pragma
InstSig l (InstRule l) | A SPECIALISE instance pragma
AnnPragma l (Annotation l) | An ANN pragma
MinimalPragma l (Maybe (BooleanFormula l)) | A MINIMAL pragma
RoleAnnotDecl l (QName l) [Role l] | A role annotation

Instances

Functor Decl |
Foldable Decl |
Traversable Decl |
Annotated Decl |
ExactP Decl |
AppFixity Decl |
Eq l => Eq (Decl l) |
Data l => Data (Decl l) |
Ord l => Ord (Decl l) |
Show l => Show (Decl l) |
Generic (Decl l) |
SrcInfo pos => Pretty (Decl pos) |
type Rep (Decl l) |

data DeclHead l

The head of a type or class declaration, which consists of the type or class name applied to some type variables

`class C a b` is represented as

    DHApp
       ()
       (DHApp
          () (DHead () (Ident () "C")) (UnkindedVar () (Ident () "a")))
       (UnkindedVar () (Ident () "b"))

(where the annotation type `l` is instantiated with `()`)

`class (a :< b) c` is represented as

    DHApp
       ()
       (DHParen
          ()
          (DHApp
             ()
             (DHInfix () (UnkindedVar () (Ident () "a")) (Symbol () ":<"))
             (UnkindedVar () (Ident () "b"))))
       (UnkindedVar () (Ident () "c"))

Constructors

DHead l (Name l) | type or class name
DHInfix l (TyVarBind l) (Name l) | infix application of the type/class name to the left operand
DHParen l (DeclHead l) | parenthesized declaration head
DHApp l (DeclHead l) (TyVarBind l) | application to one more type variable

Instances

Functor DeclHead |
Foldable DeclHead |
Traversable DeclHead |
Annotated DeclHead |
ExactP DeclHead |
Eq l => Eq (DeclHead l) |
Data l => Data (DeclHead l) |
Ord l => Ord (DeclHead l) |
Show l => Show (DeclHead l) |
Generic (DeclHead l) |
Pretty (DeclHead l) |
type Rep (DeclHead l) |

data InstRule l

The instance declaration rule, which is, roughly, the part of the instance declaration before the `where` keyword.

Example: `instance Ord a => Ord (Maybe a)` is represented as

    IRule
       ()
       Nothing
       (Just
          (CxSingle
             ()
             (ClassA
                () (UnQual () (Ident () "Ord")) [ TyVar () (Ident () "a") ])))
       (IHApp
          ()
          (IHCon () (UnQual () (Ident () "Ord")))
          (TyParen
             ()
             (TyApp
                ()
                (TyCon () (UnQual () (Ident () "Maybe")))
                (TyVar () (Ident () "a")))))

An optional explicit forall after `instance` is supported: `instance forall a . Ord a => Ord (Maybe a) where` becomes

    IRule
       ()
       (Just [ UnkindedVar () (Ident () "a") ])
       ...

Constructors

IRule l (Maybe [TyVarBind l]) (Maybe (Context l)) (InstHead l) |
IParen l (InstRule l) |

Instances

Functor InstRule |
Foldable InstRule |
Traversable InstRule |
Annotated InstRule |
ExactP InstRule |
Eq l => Eq (InstRule l) |
Data l => Data (InstRule l) |
Ord l => Ord (InstRule l) |
Show l => Show (InstRule l) |
Generic (InstRule l) |
SrcInfo l => Pretty (InstRule l) |
type Rep (InstRule l) |

data InstHead l

The instance head. The split between rule/head allow us to represent `instance (Bounded a => Bounded [a]) where` faithfully.

The structure of `InstHead` follows one of `DeclHead`.

For example, `instance C (Maybe a) Int where` is represented as

    IHApp
       ()
       (IHApp
          ()
          (IHCon () (UnQual () (Ident () "C")))
          (TyParen
             ()
             (TyApp
                ()
                (TyCon () (UnQual () (Ident () "Maybe")))
                (TyVar () (Ident () "a")))))
       (TyCon () (UnQual () (Ident () "Int")))))

Constructors

IHCon l (QName l) | type or class name
IHInfix l (Type l) (QName l) | infix application of the type/class name to the left operand
IHParen l (InstHead l) | parenthesized instance head
IHApp l (InstHead l) (Type l) | application to one more type

Instances

Functor InstHead |
Foldable InstHead |
Traversable InstHead |
Annotated InstHead |
ExactP InstHead |
Eq l => Eq (InstHead l) |
Data l => Data (InstHead l) |
Ord l => Ord (InstHead l) |
Show l => Show (InstHead l) |
Generic (InstHead l) |
SrcInfo l => Pretty (InstHead l) |
type Rep (InstHead l) |

data Binds l

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

Constructors

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

Instances

Functor Binds |
Foldable Binds |
Traversable Binds |
Annotated Binds |
ExactP Binds |
AppFixity Binds |
Eq l => Eq (Binds l) |
Data l => Data (Binds l) |
Ord l => Ord (Binds l) |
Show l => Show (Binds l) |
Generic (Binds l) |
type Rep (Binds l) |

data IPBind l

A binding of an implicit parameter.

Constructors

IPBind l (IPName l) (Exp l) |

Instances

Functor IPBind |
Foldable IPBind |
Traversable IPBind |
Annotated IPBind |
ExactP IPBind |
AppFixity IPBind |
Eq l => Eq (IPBind l) |
Data l => Data (IPBind l) |
Ord l => Ord (IPBind l) |
Show l => Show (IPBind l) |
Generic (IPBind l) |
SrcInfo loc => Pretty (IPBind loc) |
type Rep (IPBind l) |

data PatternSynDirection l

Constructors

Unidirectional | A unidirectional pattern synonym with "<-"
ImplicitBidirectional | A bidirectional pattern synonym with "="
ExplicitBidirectional l [Decl l] | A birectional pattern synonym with the construction specified.

Instances

Functor PatternSynDirection |
Foldable PatternSynDirection |
Traversable PatternSynDirection |
Eq l => Eq (PatternSynDirection l) |
Data l => Data (PatternSynDirection l) |
Ord l => Ord (PatternSynDirection l) |
Show l => Show (PatternSynDirection l) |
Generic (PatternSynDirection l) |
type Rep (PatternSynDirection l) |

## Type classes and instances

data ClassDecl l

Declarations inside a class declaration.

Constructors

ClsDecl l (Decl l) | ordinary declaration
ClsDataFam l (Maybe (Context l)) (DeclHead l) (Maybe (Kind l)) | declaration of an associated data type
ClsTyFam l (DeclHead l) (Maybe (Kind l)) | declaration of an associated type synonym
ClsTyDef l (Type l) (Type l) | default choice for an associated type synonym
ClsDefSig l (Name l) (Type l) | default signature

Instances

Functor ClassDecl |
Foldable ClassDecl |
Traversable ClassDecl |
Annotated ClassDecl |
ExactP ClassDecl |
AppFixity ClassDecl |
Eq l => Eq (ClassDecl l) |
Data l => Data (ClassDecl l) |
Ord l => Ord (ClassDecl l) |
Show l => Show (ClassDecl l) |
Generic (ClassDecl l) |
SrcInfo loc => Pretty (ClassDecl loc) |
type Rep (ClassDecl l) |

data InstDecl l

Declarations inside an instance declaration.

Constructors

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

Instances

Functor InstDecl |
Foldable InstDecl |
Traversable InstDecl |
Annotated InstDecl |
ExactP InstDecl |
AppFixity InstDecl |
Eq l => Eq (InstDecl l) |
Data l => Data (InstDecl l) |
Ord l => Ord (InstDecl l) |
Show l => Show (InstDecl l) |
Generic (InstDecl l) |
SrcInfo loc => Pretty (InstDecl loc) |
type Rep (InstDecl l) |

data Deriving l

A deriving clause following a data type declaration.

Constructors

Deriving l [InstRule l] |

Instances

Functor Deriving |
Foldable Deriving |
Traversable Deriving |
Annotated Deriving |
ExactP Deriving |
Eq l => Eq (Deriving l) |
Data l => Data (Deriving l) |
Ord l => Ord (Deriving l) |
Show l => Show (Deriving l) |
Generic (Deriving l) |
SrcInfo l => Pretty (Deriving l) |
type Rep (Deriving l) |

## Data type declarations

data DataOrNew l

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

Constructors

DataType l |
NewType l |

Instances

Functor DataOrNew |
Foldable DataOrNew |
Traversable DataOrNew |
Annotated DataOrNew |
ExactP DataOrNew |
Eq l => Eq (DataOrNew l) |
Data l => Data (DataOrNew l) |
Ord l => Ord (DataOrNew l) |
Show l => Show (DataOrNew l) |
Generic (DataOrNew l) |
Pretty (DataOrNew l) |
type Rep (DataOrNew l) |

data ConDecl l

Declaration of an ordinary data constructor.

Constructors

ConDecl l (Name l) [Type l] | ordinary data constructor
InfixConDecl l (Type l) (Name l) (Type l) | infix data constructor
RecDecl l (Name l) [FieldDecl l] | record constructor

Instances

Functor ConDecl |
Foldable ConDecl |
Traversable ConDecl |
Annotated ConDecl |
ExactP ConDecl |
Eq l => Eq (ConDecl l) |
Data l => Data (ConDecl l) |
Ord l => Ord (ConDecl l) |
Show l => Show (ConDecl l) |
Generic (ConDecl l) |
SrcInfo l => Pretty (ConDecl l) |
type Rep (ConDecl l) |

data FieldDecl l

Declaration of a (list of) named field(s).

Constructors

FieldDecl l [Name l] (Type l) |

Instances

Functor FieldDecl |
Foldable FieldDecl |
Traversable FieldDecl |
Annotated FieldDecl |
ExactP FieldDecl |
Eq l => Eq (FieldDecl l) |
Data l => Data (FieldDecl l) |
Ord l => Ord (FieldDecl l) |
Show l => Show (FieldDecl l) |
Generic (FieldDecl l) |
SrcInfo l => Pretty (FieldDecl l) |
type Rep (FieldDecl l) |

data QualConDecl l

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

Constructors

QualConDecl l (Maybe [TyVarBind l]) (Maybe (Context l)) (ConDecl l) |

Instances

Functor QualConDecl |
Foldable QualConDecl |
Traversable 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) |
Generic (QualConDecl l) |
SrcInfo l => Pretty (QualConDecl l) |
type Rep (QualConDecl l) |

data GadtDecl l

A single constructor declaration in a GADT data type declaration.

If the GADT is declared using the record syntax, e.g.

    data Ty where
      TCon :: { field1 :: Int, field2 :: Bool } -> Ty

then the fields are stored as a list of `FieldDecl`s, and the final type (`Ty` in the above example) is stored in the last `Type` field.

If the GADT is declared using the ordinary syntax, e.g.

    data Ty where
      TCon :: Int -> Bool -> Ty

then ``Maybe` [`FieldDecl` l]` is `Nothing`, and the whole constructor's type (such as `Int -> Bool -> Ty`) is stored in the last `Type` field.

Constructors

GadtDecl l (Name l) (Maybe [FieldDecl l]) (Type l) |

Instances

Functor GadtDecl |
Foldable GadtDecl |
Traversable GadtDecl |
Annotated GadtDecl |
ExactP GadtDecl |
Eq l => Eq (GadtDecl l) |
Data l => Data (GadtDecl l) |
Ord l => Ord (GadtDecl l) |
Show l => Show (GadtDecl l) |
Generic (GadtDecl l) |
SrcInfo l => Pretty (GadtDecl l) |
type Rep (GadtDecl l) |

data BangType l

The type of a constructor argument or field, optionally including a strictness annotation.

Constructors

BangedTy l | strict component, marked with "`!`"
UnpackedTy l | unboxed component, marked with an UNPACK pragma

Instances

Functor BangType |
Foldable BangType |
Traversable BangType |
Annotated BangType |
ExactP BangType |
Eq l => Eq (BangType l) |
Data l => Data (BangType l) |
Ord l => Ord (BangType l) |
Show l => Show (BangType l) |
Generic (BangType l) |
SrcInfo l => Pretty (BangType l) |
type Rep (BangType l) |

## Function bindings

data Match l

Clauses of a function binding.

Constructors

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.

Instances

Functor Match |
Foldable Match |
Traversable Match |
Annotated Match |
ExactP Match |
AppFixity Match |
Eq l => Eq (Match l) |
Data l => Data (Match l) |
Ord l => Ord (Match l) |
Show l => Show (Match l) |
Generic (Match l) |
SrcInfo pos => Pretty (Match pos) |
type Rep (Match l) |

data Rhs l

The right hand side of a function binding, pattern binding, or a case alternative.

Constructors

UnGuardedRhs l (Exp l) | unguarded right hand side (exp)
GuardedRhss l [GuardedRhs l] | guarded right hand side (gdrhs)

Instances

Functor Rhs |
Foldable Rhs |
Traversable Rhs |
Annotated Rhs |
ExactP Rhs |
AppFixity Rhs |
Eq l => Eq (Rhs l) |
Data l => Data (Rhs l) |
Ord l => Ord (Rhs l) |
Show l => Show (Rhs l) |
Generic (Rhs l) |
SrcInfo loc => Pretty (Rhs loc) |
type Rep (Rhs l) |

data GuardedRhs l

A guarded right hand side `|` stmts `=` exp, or `|` stmts `->` exp for case alternatives. The guard is a series of statements when using pattern guards, otherwise it will be a single qualifier expression.

Constructors

GuardedRhs l [Stmt l] (Exp l) |

Instances

Functor GuardedRhs |
Foldable GuardedRhs |
Traversable 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) |
Generic (GuardedRhs l) |
SrcInfo loc => Pretty (GuardedRhs loc) |
type Rep (GuardedRhs l) |

# Class Assertions and Contexts

data Context l

A context is a set of assertions

Constructors

CxSingle l (Asst l) |
CxTuple l [Asst l] |
CxEmpty l |

Instances

Functor Context |
Foldable Context |
Traversable Context |
Annotated Context |
ExactP Context |
Eq l => Eq (Context l) |
Data l => Data (Context l) |
Ord l => Ord (Context l) |
Show l => Show (Context l) |
Generic (Context l) |
SrcInfo l => Pretty (Context l) |
type Rep (Context l) |

data FunDep l

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

Constructors

FunDep l [Name l] [Name l] |

Instances

Functor FunDep |
Foldable FunDep |
Traversable FunDep |
Annotated FunDep |
ExactP FunDep |
Eq l => Eq (FunDep l) |
Data l => Data (FunDep l) |
Ord l => Ord (FunDep l) |
Show l => Show (FunDep l) |
Generic (FunDep l) |
Pretty (FunDep l) |
type Rep (FunDep l) |

data Asst l

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 l (QName l) [Type l] | ordinary class assertion
AppA l (Name l) [Type l] | constraint kind assertion, `Dict :: cxt a => Dict cxt`
InfixA l (Type l) (QName l) (Type l) | class assertion where the class name is given infix
IParam l (IPName l) (Type l) | implicit parameter assertion
EqualP l (Type l) (Type l) | type equality constraint
ParenA l (Asst l) | parenthesised class assertion
WildCardA l (Maybe (Name l)) | Context Wildcard

Instances

Functor Asst |
Foldable Asst |
Traversable Asst |
Annotated Asst |
ExactP Asst |
Eq l => Eq (Asst l) |
Data l => Data (Asst l) |
Ord l => Ord (Asst l) |
Show l => Show (Asst l) |
Generic (Asst l) |
SrcInfo l => Pretty (Asst l) |
type Rep (Asst l) |

# Types

data Type l

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

Constructors

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
TyParArray l (Type l) | parallel array syntax, e.g. [: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
TyPromoted l (Promoted l) | `'K`, a promoted data type (-XDataKinds).
TyEquals l (Type l) (Type l) | type equality predicate enabled by ConstraintKinds
TySplice l (Splice l) | template haskell splice type
TyBang l (BangType l) (Type l) | Strict type marked with "`!`" or type marked with UNPACK pragma.
TyWildCard l (Maybe (Name l)) | Either an anonymous of named type wildcard

Instances

Functor Type |
Foldable Type |
Traversable Type |
Annotated Type |
ExactP Type |
Eq l => Eq (Type l) |
Data l => Data (Type l) |
Ord l => Ord (Type l) |
Show l => Show (Type l) |
Generic (Type l) |
SrcInfo l => Pretty (Type l) |
type Rep (Type l) |

data Boxed

Flag denoting whether a tuple is boxed or unboxed.

Constructors

Boxed |
Unboxed |

Instances

Eq Boxed |
Data Boxed |
Ord Boxed |
Show Boxed |
Generic Boxed |
type Rep Boxed |

data Kind l

An explicit kind annotation.

Constructors

KindStar l | `*`, the kind of types
KindFn l (Kind l) (Kind l) | `->`, the kind of a type constructor
KindParen l (Kind l) | a parenthesised kind
KindVar l (QName l) | `k`, a kind variable (-XPolyKinds)
KindApp l (Kind l) (Kind l) |
    k1 k2
KindTuple l [Kind l] | `'(k1,k2,k3)`, a promoted tuple
KindList l (Kind l) | `'[k1]`, a promoted list literal

Instances

Functor Kind |
Foldable Kind |
Traversable Kind |
Annotated Kind |
ExactP Kind |
Eq l => Eq (Kind l) |
Data l => Data (Kind l) |
Ord l => Ord (Kind l) |
Show l => Show (Kind l) |
Generic (Kind l) |
Pretty (Kind l) |
type Rep (Kind l) |

data TyVarBind l

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

Constructors

KindedVar l (Name l) (Kind l) | variable binding with kind annotation
UnkindedVar l (Name l) | ordinary variable binding

Instances

Functor TyVarBind |
Foldable TyVarBind |
Traversable TyVarBind |
Annotated TyVarBind |
ExactP TyVarBind |
Eq l => Eq (TyVarBind l) |
Data l => Data (TyVarBind l) |
Ord l => Ord (TyVarBind l) |
Show l => Show (TyVarBind l) |
Generic (TyVarBind l) |
Pretty (TyVarBind l) |
type Rep (TyVarBind l) |

data Promoted l

Bools here are True if there was a leading quote which may be left out. For example `'[k1,k2]` means the same thing as `[k1,k2]`.

Constructors

PromotedInteger l Integer String | parsed value and raw string
PromotedString l String String | parsed value and raw string
PromotedCon l Bool (QName l) |
PromotedList l Bool [Type l] |
PromotedTuple l [Type l] |
PromotedUnit l |

Instances

Functor Promoted |
Foldable Promoted |
Traversable Promoted |
Annotated Promoted |
ExactP Promoted |
Eq l => Eq (Promoted l) |
Data l => Data (Promoted l) |
Ord l => Ord (Promoted l) |
Show l => Show (Promoted l) |
Generic (Promoted l) |
type Rep (Promoted l) |

data TypeEqn l

A type equation as found in closed type families.

Constructors

TypeEqn l (Type l) (Type l) |

Instances

Functor TypeEqn |
Foldable TypeEqn |
Traversable TypeEqn |
Annotated TypeEqn |
ExactP TypeEqn |
Eq l => Eq (TypeEqn l) |
Data l => Data (TypeEqn l) |
Ord l => Ord (TypeEqn l) |
Show l => Show (TypeEqn l) |
Generic (TypeEqn l) |
type Rep (TypeEqn l) |

# Expressions

data Exp l

Haskell expressions.

Constructors

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 `-exp` (unary minus)
Lambda l [Pat l] (Exp l) | lambda expression
Let l (Binds l) (Exp l) | local declarations with `let` ... `in` ...
If l (Exp l) (Exp l) (Exp l) | `if` exp `then` exp `else` exp
MultiIf l [GuardedRhs l] | `if` `|` stmts `->` exp ...
Case l (Exp l) [Alt l] | `case` exp `of` alts
Do l [Stmt l] | `do`-expression: the last statement in the list should be an expression.
MDo l [Stmt l] | `mdo`-expression
Tuple l Boxed [Exp l] | tuple expression
TupleSection l Boxed [Maybe (Exp l)] | tuple section expression, e.g. `(,,3)`
List l [Exp l] | list expression
ParArray l [Exp l] | parallel array expression
Paren l (Exp l) | parenthesised expression
LeftSection l (Exp l) (QOp l) | left section `(`exp qop`)`
RightSection l (QOp l) (Exp l) | right section `(`qop exp`)`
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: `[from ..]`
EnumFromTo l (Exp l) (Exp l) | bounded arithmetic sequence, incrementing by 1 `[from .. to]`
EnumFromThen l (Exp l) (Exp l) | unbounded arithmetic sequence, with first two elements given `[from, then ..]`
EnumFromThenTo l (Exp l) (Exp l) (Exp l) | bounded arithmetic sequence, with first two elements given `[from, then .. to]`
ParArrayFromTo l (Exp l) (Exp l) | Parallel array bounded arithmetic sequence, incrementing by 1 `[:from .. to:]`
ParArrayFromThenTo l (Exp l) (Exp l) (Exp l) | bounded arithmetic sequence, with first two elements given `[:from, then .. to:]`
ListComp l (Exp l) [QualStmt l] | ordinary list comprehension
ParComp l (Exp l) [[QualStmt l]] | parallel list comprehension
ParArrayComp l (Exp l) [[QualStmt l]] | parallel array comprehension
ExpTypeSig l (Exp l) (Type l) | expression with explicit type signature
VarQuote l (QName l) | `'x` for template haskell reifying of expressions
TypQuote l (QName l) | `''T` for template haskell reifying of types
BracketExp l (Bracket l) | template haskell bracket expression
SpliceExp l (Splice l) | template haskell splice expression
QuasiQuote l String String | quasi-quotaion: `[$name| string |]`
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
XChildTag l [Exp l] | children of an xml element
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: `proc` pat `->` exp
LeftArrApp l (Exp l) (Exp l) | arrow application (from left): exp `-<` exp
RightArrApp l (Exp l) (Exp l) | arrow application (from right): exp `>-` exp
LeftArrHighApp l (Exp l) (Exp l) | higher-order arrow application (from left): exp `-<<` exp
RightArrHighApp l (Exp l) (Exp l) | higher-order arrow application (from right): exp `>>-` exp
LCase l [Alt l] | `case` alts
ExprHole l | Expression hole

Instances

Functor Exp |
Foldable Exp |
Traversable Exp |
Annotated Exp |
ExactP Exp |
AppFixity Exp |
Eq l => Eq (Exp l) |
Data l => Data (Exp l) |
Ord l => Ord (Exp l) |
Show l => Show (Exp l) |
Generic (Exp l) |
SrcInfo loc => Pretty (Exp loc) |
type Rep (Exp l) |

data Stmt l

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 l (Pat l) (Exp l) | a generator: pat `<-` exp
Qualifier l (Exp l) | 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 l (Binds l) | local bindings
RecStmt l [Stmt l] | a recursive binding group for arrows

Instances

Functor Stmt |
Foldable Stmt |
Traversable Stmt |
Annotated Stmt |
ExactP Stmt |
AppFixity Stmt |
Eq l => Eq (Stmt l) |
Data l => Data (Stmt l) |
Ord l => Ord (Stmt l) |
Show l => Show (Stmt l) |
Generic (Stmt l) |
SrcInfo loc => Pretty (Stmt loc) |
type Rep (Stmt l) |

data QualStmt l

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

Constructors

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

Instances

Functor QualStmt |
Foldable QualStmt |
Traversable QualStmt |
Annotated QualStmt |
ExactP QualStmt |
AppFixity QualStmt |
Eq l => Eq (QualStmt l) |
Data l => Data (QualStmt l) |
Ord l => Ord (QualStmt l) |
Show l => Show (QualStmt l) |
Generic (QualStmt l) |
SrcInfo loc => Pretty (QualStmt loc) |
type Rep (QualStmt l) |

data FieldUpdate l

An fbind in a labeled construction or update expression.

Constructors

FieldUpdate l (QName l) (Exp l) | ordinary label-expresion pair
FieldPun l (QName l) | record field pun
FieldWildcard l | record field wildcard

Instances

Functor FieldUpdate |
Foldable FieldUpdate |
Traversable 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) |
Generic (FieldUpdate l) |
SrcInfo loc => Pretty (FieldUpdate loc) |
type Rep (FieldUpdate l) |

data Alt l

An alt alternative in a `case` expression.

Constructors

Alt l (Pat l) (Rhs l) (Maybe (Binds l)) |

Instances

Functor Alt |
Foldable Alt |
Traversable Alt |
Annotated Alt |
ExactP Alt |
AppFixity Alt |
Eq l => Eq (Alt l) |
Data l => Data (Alt l) |
Ord l => Ord (Alt l) |
Show l => Show (Alt l) |
Generic (Alt l) |
SrcInfo loc => Pretty (Alt loc) |
type Rep (Alt l) |

data XAttr l

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

Constructors

XAttr l (XName l) (Exp l) |

Instances

Functor XAttr |
Foldable XAttr |
Traversable XAttr |
Annotated XAttr |
ExactP XAttr |
AppFixity XAttr |
Eq l => Eq (XAttr l) |
Data l => Data (XAttr l) |
Ord l => Ord (XAttr l) |
Show l => Show (XAttr l) |
Generic (XAttr l) |
SrcInfo loc => Pretty (XAttr loc) |
type Rep (XAttr l) |

# Patterns

data Pat l

A pattern, to be matched against a value.

Constructors

PVar l (Name l) | variable
PLit l (Sign l) (Literal l) | literal constant
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 Boxed [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) | `@`-pattern
PWildCard l | wildcard pattern: `_`
PIrrPat l (Pat l) | irrefutable pattern: `~pat`
PatTypeSig l (Pat l) (Type l) | pattern with type signature
PViewPat l (Exp l) (Pat l) | view patterns of the form `(exp -> pat)`
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
PQuasiQuote l String String | quasi quote pattern: `[$name| string |]`
PBangPat l (Pat l) | strict (bang) pattern: `f !x = ...`

Instances

Functor Pat |
Foldable Pat |
Traversable Pat |
Annotated Pat |
ExactP Pat |
AppFixity Pat |
Eq l => Eq (Pat l) |
Data l => Data (Pat l) |
Ord l => Ord (Pat l) |
Show l => Show (Pat l) |
Generic (Pat l) |
SrcInfo loc => Pretty (Pat loc) |
type Rep (Pat l) |

data PatField l

An fpat in a labeled record pattern.

Constructors

PFieldPat l (QName l) (Pat l) | ordinary label-pattern pair
PFieldPun l (QName l) | record field pun
PFieldWildcard l | record field wildcard

Instances

Functor PatField |
Foldable PatField |
Traversable PatField |
Annotated PatField |
ExactP PatField |
AppFixity PatField |
Eq l => Eq (PatField l) |
Data l => Data (PatField l) |
Ord l => Ord (PatField l) |
Show l => Show (PatField l) |
Generic (PatField l) |
SrcInfo loc => Pretty (PatField loc) |
type Rep (PatField l) |

data PXAttr l

An XML attribute in a pattern.

Constructors

PXAttr l (XName l) (Pat l) |

Instances

Functor PXAttr |
Foldable PXAttr |
Traversable PXAttr |
Annotated PXAttr |
ExactP PXAttr |
AppFixity PXAttr |
Eq l => Eq (PXAttr l) |
Data l => Data (PXAttr l) |
Ord l => Ord (PXAttr l) |
Show l => Show (PXAttr l) |
Generic (PXAttr l) |
SrcInfo loc => Pretty (PXAttr loc) |
type Rep (PXAttr l) |

data RPat l

An entity in a regular pattern.

Constructors

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

Instances

Functor RPat |
Foldable RPat |
Traversable RPat |
Annotated RPat |
ExactP RPat |
AppFixity RPat |
Eq l => Eq (RPat l) |
Data l => Data (RPat l) |
Ord l => Ord (RPat l) |
Show l => Show (RPat l) |
Generic (RPat l) |
SrcInfo loc => Pretty (RPat loc) |
type Rep (RPat l) |

data RPatOp l

A regular pattern operator.

Constructors

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

Instances

Functor RPatOp |
Foldable RPatOp |
Traversable RPatOp |
Annotated RPatOp |
ExactP RPatOp |
Eq l => Eq (RPatOp l) |
Data l => Data (RPatOp l) |
Ord l => Ord (RPatOp l) |
Show l => Show (RPatOp l) |
Generic (RPatOp l) |
Pretty (RPatOp l) |
type Rep (RPatOp l) |

# Literals

data Literal l

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.

Constructors

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

Instances

Functor Literal |
Foldable Literal |
Traversable Literal |
Annotated Literal |
ExactP Literal |
Eq l => Eq (Literal l) |
Data l => Data (Literal l) |
Ord l => Ord (Literal l) |
Show l => Show (Literal l) |
Generic (Literal l) |
Pretty (Literal l) |
type Rep (Literal l) |

data Sign l

An indication whether a literal pattern has been negated or not.

Constructors

Signless l |
Negative l |

Instances

Functor Sign |
Foldable Sign |
Traversable Sign |
Annotated Sign |
ExactP Sign |
Eq l => Eq (Sign l) |
Data l => Data (Sign l) |
Ord l => Ord (Sign l) |
Show l => Show (Sign l) |
Generic (Sign l) |
type Rep (Sign l) |

# Variables, Constructors and Operators

data ModuleName l

The name of a Haskell module.

Constructors

ModuleName l String |

Instances

Functor ModuleName |
Foldable ModuleName |
Traversable 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) |
Generic (ModuleName l) |
Pretty (ModuleName l) |
type Rep (ModuleName l) |

data QName l

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

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

Instances

Functor QName |
Foldable QName |
Traversable QName |
Annotated QName |
ExactP QName |
Eq l => Eq (QName l) |
Data l => Data (QName l) |
Ord l => Ord (QName l) |
Show l => Show (QName l) |
Generic (QName l) |
Pretty (QName l) |
type Rep (QName l) |

data Name l

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

Constructors

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

Instances

Functor Name |
Foldable Name |
Traversable Name |
Annotated Name |
ExactP Name |
Eq l => Eq (Name l) |
Data l => Data (Name l) |
Ord l => Ord (Name l) |
Show l => Show (Name l) |
Generic (Name l) |
Pretty (Name l) |
type Rep (Name l) |

data QOp l

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

Constructors

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

Instances

Functor QOp |
Foldable QOp |
Traversable QOp |
Annotated QOp |
ExactP QOp |
Eq l => Eq (QOp l) |
Data l => Data (QOp l) |
Ord l => Ord (QOp l) |
Show l => Show (QOp l) |
Generic (QOp l) |
Pretty (QOp l) |
type Rep (QOp l) |

data Op l

Operators appearing in `infix` declarations are never qualified.

Constructors

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

Instances

Functor Op |
Foldable Op |
Traversable Op |
Annotated Op |
ExactP Op |
Eq l => Eq (Op l) |
Data l => Data (Op l) |
Ord l => Ord (Op l) |
Show l => Show (Op l) |
Generic (Op l) |
Pretty (Op l) |
type Rep (Op l) |

data SpecialCon l

Constructors with special syntax. These names are never qualified, and always refer to builtin type or data constructors.

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 `(,)` etc, possibly boxed `(#,#)`
Cons l | list data constructor `(:)`
UnboxedSingleCon l | unboxed singleton tuple constructor `(# #)`

Instances

Functor SpecialCon |
Foldable SpecialCon |
Traversable 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) |
Generic (SpecialCon l) |
type Rep (SpecialCon l) |

data CName l

A name (cname) of a component of a class or data type in an `import` or export specification.

Constructors

VarName l (Name l) | name of a method or field
ConName l (Name l) | name of a data constructor

Instances

Functor CName |
Foldable CName |
Traversable CName |
Annotated CName |
ExactP CName |
Eq l => Eq (CName l) |
Data l => Data (CName l) |
Ord l => Ord (CName l) |
Show l => Show (CName l) |
Generic (CName l) |
Pretty (CName l) |
type Rep (CName l) |

data IPName l

An implicit parameter name.

Constructors

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

Instances

Functor IPName |
Foldable IPName |
Traversable IPName |
Annotated IPName |
ExactP IPName |
Eq l => Eq (IPName l) |
Data l => Data (IPName l) |
Ord l => Ord (IPName l) |
Show l => Show (IPName l) |
Generic (IPName l) |
Pretty (IPName l) |
type Rep (IPName l) |

data XName l

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

Constructors

XName l String |
XDomName l String String |

Instances

Functor XName |
Foldable XName |
Traversable XName |
Annotated XName |
ExactP XName |
Eq l => Eq (XName l) |
Data l => Data (XName l) |
Ord l => Ord (XName l) |
Show l => Show (XName l) |
Generic (XName l) |
Pretty (XName l) |
type Rep (XName l) |

data Role l

Constructors

Nominal l |
Representational l |
Phantom l |
RoleWildcard l |

Instances

Functor Role |
Foldable Role |
Traversable Role |
Annotated Role |
ExactP Role |
Eq l => Eq (Role l) |
Data l => Data (Role l) |
Ord l => Ord (Role l) |
Show l => Show (Role l) |
Generic (Role l) |
type Rep (Role l) |

# Template Haskell

data Bracket l

A template haskell bracket expression.

Constructors

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

Instances

Functor Bracket |
Foldable Bracket |
Traversable Bracket |
Annotated Bracket |
ExactP Bracket |
AppFixity Bracket |
Eq l => Eq (Bracket l) |
Data l => Data (Bracket l) |
Ord l => Ord (Bracket l) |
Show l => Show (Bracket l) |
Generic (Bracket l) |
SrcInfo loc => Pretty (Bracket loc) |
type Rep (Bracket l) |

data Splice l

A template haskell splice expression

Constructors

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

Instances

Functor Splice |
Foldable Splice |
Traversable Splice |
Annotated Splice |
ExactP Splice |
AppFixity Splice |
Eq l => Eq (Splice l) |
Data l => Data (Splice l) |
Ord l => Ord (Splice l) |
Show l => Show (Splice l) |
Generic (Splice l) |
SrcInfo loc => Pretty (Splice loc) |
type Rep (Splice l) |

# FFI

data Safety l

The safety of a foreign function call.

Constructors

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

Instances

Functor Safety |
Foldable Safety |
Traversable Safety |
Annotated Safety |
ExactP Safety |
Eq l => Eq (Safety l) |
Data l => Data (Safety l) |
Ord l => Ord (Safety l) |
Show l => Show (Safety l) |
Generic (Safety l) |
Pretty (Safety l) |
type Rep (Safety l) |

data CallConv l

The calling convention of a foreign function call.

Constructors

StdCall l |
CCall l |
CPlusPlus l |
DotNet l |
Jvm l |
Js l |
JavaScript l |
CApi l |

Instances

Functor CallConv |
Foldable CallConv |
Traversable CallConv |
Annotated CallConv |
ExactP CallConv |
Eq l => Eq (CallConv l) |
Data l => Data (CallConv l) |
Ord l => Ord (CallConv l) |
Show l => Show (CallConv l) |
Generic (CallConv l) |
Pretty (CallConv l) |
type Rep (CallConv l) |

# Pragmas

data ModulePragma l

A top level options pragma, preceding the module header.

Constructors

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

Instances

Functor ModulePragma |
Foldable ModulePragma |
Traversable 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) |
Generic (ModulePragma l) |
Parseable (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) |
SrcInfo loc => Pretty (ModulePragma loc) |
type Rep (ModulePragma l) |

data Tool

Recognised tools for OPTIONS pragmas.

Constructors

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

Instances

Eq Tool |
Data Tool |
Ord Tool |
Show Tool |
Generic Tool |
Pretty Tool |
type Rep Tool |

data Overlap l

Recognised overlaps for overlap pragmas.

Constructors

NoOverlap l | NO_OVERLAP pragma
Overlap l | OVERLAP pragma
Incoherent l | INCOHERENT pragma

Instances

Functor Overlap |
Foldable Overlap |
Traversable Overlap |
Annotated Overlap |
ExactP Overlap |
Eq l => Eq (Overlap l) |
Data l => Data (Overlap l) |
Ord l => Ord (Overlap l) |
Show l => Show (Overlap l) |
Generic (Overlap l) |
type Rep (Overlap l) |

data Rule l

The body of a RULES pragma.

Constructors

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

Instances

Functor Rule |
Foldable Rule |
Traversable Rule |
Annotated Rule |
ExactP Rule |
Eq l => Eq (Rule l) |
Data l => Data (Rule l) |
Ord l => Ord (Rule l) |
Show l => Show (Rule l) |
Generic (Rule l) |
SrcInfo loc => Pretty (Rule loc) |
type Rep (Rule l) |

data RuleVar l

Variables used in a RULES pragma, optionally annotated with types

Constructors

RuleVar l (Name l) |
TypedRuleVar l (Name l) (Type l) |

Instances

Functor RuleVar |
Foldable RuleVar |
Traversable RuleVar |
Annotated RuleVar |
ExactP RuleVar |
Eq l => Eq (RuleVar l) |
Data l => Data (RuleVar l) |
Ord l => Ord (RuleVar l) |
Show l => Show (RuleVar l) |
Generic (RuleVar l) |
SrcInfo l => Pretty (RuleVar l) |
type Rep (RuleVar l) |

data Activation l

Activation clause of a RULES pragma.

Constructors

ActiveFrom l Int |
ActiveUntil l Int |

Instances

Functor Activation |
Foldable Activation |
Traversable 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) |
Generic (Activation l) |
Pretty (Activation l) |
type Rep (Activation l) |

data Annotation l

An annotation through an ANN pragma.

Constructors

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.

Instances

Functor Annotation |
Foldable Annotation |
Traversable 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) |
Generic (Annotation l) |
SrcInfo loc => Pretty (Annotation loc) |
type Rep (Annotation l) |

data BooleanFormula l

A boolean formula for MINIMAL pragmas.

Constructors

VarFormula l (Name l) | A variable.
AndFormula l [BooleanFormula l] | And boolean formulas.
OrFormula l [BooleanFormula l] | Or boolean formulas.
ParenFormula l (BooleanFormula l) | Parenthesized boolean formulas.

Instances

Functor BooleanFormula |
Foldable BooleanFormula |
Traversable BooleanFormula |
Annotated BooleanFormula |
ExactP BooleanFormula |
Eq l => Eq (BooleanFormula l) |
Data l => Data (BooleanFormula l) |
Ord l => Ord (BooleanFormula l) |
Show l => Show (BooleanFormula l) |
Generic (BooleanFormula l) |
type Rep (BooleanFormula l) |

# Builtin names

## Modules

prelude_mod :: l -> ModuleName l

main_mod :: l -> ModuleName l

## Main function of a program

main_name :: l -> Name l

## Constructors

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

## Special identifiers

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

interruptible_name :: l -> Name l

threadsafe_name :: l -> Name l

stdcall_name :: l -> Name l

ccall_name :: l -> Name l

cplusplus_name :: l -> Name l

dotnet_name :: l -> Name l

jvm_name :: l -> Name l

js_name :: l -> Name l

javascript_name :: l -> Name l

capi_name :: l -> Name l

forall_name :: l -> Name l

family_name :: l -> Name l

## Type constructors

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

# Source coordinates

# Annotated trees

class Functor ast => Annotated ast where

AST nodes are annotated, and this class allows manipulation of the annotations.

Methods

ann :: ast l -> l

Retrieve the annotation of an AST node.

amap :: (l -> l) -> ast l -> ast l

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`.

Instances

Annotated Alt |
Annotated FieldUpdate |
Annotated QualStmt |
Annotated Stmt |
Annotated PatField |
Annotated RPat |
Annotated RPatOp |
Annotated PXAttr |
Annotated Pat |
Annotated WarningText |
Annotated RuleVar |
Annotated Rule |
Annotated Activation |
Annotated Overlap |
Annotated ModulePragma |
Annotated CallConv |
Annotated Safety |
Annotated Splice |
Annotated Bracket |
Annotated XAttr |
Annotated XName |
Annotated Exp |
Annotated Sign |
Annotated Literal |
Annotated Asst |
Annotated Context |
Annotated FunDep |
Annotated Kind |
Annotated TyVarBind |
Annotated Promoted |
Annotated Type |
Annotated GuardedRhs |
Annotated Rhs |
Annotated BangType |
Annotated InstDecl |
Annotated ClassDecl |
Annotated GadtDecl |
Annotated FieldDecl |
Annotated ConDecl |
Annotated QualConDecl |
Annotated Match |
Annotated IPBind |
Annotated Binds |
Annotated Deriving |
Annotated InstHead |
Annotated InstRule |
Annotated DeclHead |
Annotated DataOrNew |
Annotated Role |
Annotated BooleanFormula |
Annotated Annotation |
Annotated TypeEqn |
Annotated Decl |
Annotated Assoc |
Annotated ImportSpec |
Annotated ImportSpecList |
Annotated ImportDecl |
Annotated Namespace |
Annotated ExportSpec |
Annotated ExportSpecList |
Annotated ModuleHead |
Annotated Module |
Annotated CName |
Annotated Op |
Annotated QOp |
Annotated IPName |
Annotated Name |
Annotated QName |
Annotated SpecialCon |
Annotated ModuleName |

(=~=) :: (Annotated a, Eq (a ())) => a l1 -> a l2 -> Bool

Test if two AST elements are equal modulo annotations.