-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer
--
-- Haskell-Source with Extensions (HSE, haskell-src-exts) is an extension
-- of the standard haskell-src package, and handles most registered
-- syntactic extensions to Haskell, including:
--
--
-- - Multi-parameter type classes with functional dependencies
-- - Indexed type families (including associated types)
-- - Empty data declarations
-- - GADTs
-- - Implicit parameters
-- - Template Haskell
--
--
-- and a few more. All extensions implemented in GHC are supported. Apart
-- from these standard extensions, it also handles regular patterns as
-- per the HaRP extension as well as HSX-style embedded XML syntax.
--
-- For details on usage, please see the website.
@package haskell-src-exts
@version 1.1.1
-- | This entire module should be replaced with Language.Haskell.Extension
-- from cabal, but we must wait for a release of cabal that includes the
-- XmlSyntax and RegularPatterns extensions.
module Language.Haskell.Exts.Extension
-- | This datatype is a copy of the one in Cabal's
-- Language.Haskell.Extension module. The intention is to eventually
-- import it from Cabal, but we need to wait for the next release of
-- Cabal which includes XmlSyntax and RegularPatterns.
data Extension
OverlappingInstances :: Extension
UndecidableInstances :: Extension
IncoherentInstances :: Extension
RecursiveDo :: Extension
ParallelListComp :: Extension
MultiParamTypeClasses :: Extension
NoMonomorphismRestriction :: Extension
FunctionalDependencies :: Extension
ExplicitForall :: Extension
Rank2Types :: Extension
RankNTypes :: Extension
PolymorphicComponents :: Extension
ExistentialQuantification :: Extension
ScopedTypeVariables :: Extension
ImplicitParams :: Extension
FlexibleContexts :: Extension
FlexibleInstances :: Extension
EmptyDataDecls :: Extension
CPP :: Extension
KindSignatures :: Extension
BangPatterns :: Extension
TypeSynonymInstances :: Extension
TemplateHaskell :: Extension
ForeignFunctionInterface :: Extension
Arrows :: Extension
Generics :: Extension
NoImplicitPrelude :: Extension
NamedFieldPuns :: Extension
PatternGuards :: Extension
GeneralizedNewtypeDeriving :: Extension
ExtensibleRecords :: Extension
RestrictedTypeSynonyms :: Extension
HereDocuments :: Extension
MagicHash :: Extension
TypeFamilies :: Extension
StandaloneDeriving :: Extension
UnicodeSyntax :: Extension
PatternSignatures :: Extension
UnliftedFFITypes :: Extension
LiberalTypeSynonyms :: Extension
TypeOperators :: Extension
RecordWildCards :: Extension
RecordPuns :: Extension
DisambiguateRecordFields :: Extension
OverloadedStrings :: Extension
GADTs :: Extension
MonoPatBinds :: Extension
NoMonoPatBinds :: Extension
RelaxedPolyRec :: Extension
ExtendedDefaultRules :: Extension
UnboxedTuples :: Extension
DeriveDataTypeable :: Extension
ConstrainedClassMethods :: Extension
PackageImports :: Extension
ImpredicativeTypes :: Extension
NewQualifiedOperators :: Extension
PostfixOperators :: Extension
QuasiQuotes :: Extension
TransformListComp :: Extension
ViewPatterns :: Extension
XmlSyntax :: Extension
RegularPatterns :: Extension
TupleSections :: Extension
UnknownExtension :: String -> Extension
-- | A clever version of read that returns an UnknownExtension if
-- the string is not recognised.
classifyExtension :: String -> Extension
-- | Certain extensions imply other extensions, and this function makes the
-- implication explicit. This also handles deprecated extensions, which
-- imply their replacements. The returned valued is the transitive
-- closure of implied extensions.
impliesExts :: [Extension] -> [Extension]
-- | The list of extensions enabled by GHC's portmanteau -fglasgow-exts
-- flag.
glasgowExts :: [Extension]
instance Eq Extension
instance Ord Extension
instance Show Extension
instance Read Extension
-- | 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)
--
module Language.Haskell.Exts.Syntax
-- | A complete Haskell source module.
data Module
Module :: SrcLoc -> ModuleName -> [OptionPragma] -> (Maybe WarningText) -> (Maybe [ExportSpec]) -> [ImportDecl] -> [Decl] -> Module
-- | Warning text to optionally use in the module header of e.g. a
-- deprecated module.
data WarningText
DeprText :: String -> WarningText
WarnText :: String -> WarningText
-- | An item in a module's export specification.
data ExportSpec
-- | variable
EVar :: QName -> ExportSpec
-- | T: a class or datatype exported abstractly, or a type
-- synonym.
EAbs :: QName -> ExportSpec
-- | T(..): a class exported with all of its methods, or a
-- datatype exported with all of its constructors.
EThingAll :: QName -> ExportSpec
-- | T(C_1,...,C_n): a class exported with some of its methods, or
-- a datatype exported with some of its constructors.
EThingWith :: QName -> [CName] -> ExportSpec
-- | module M: re-export a module.
EModuleContents :: ModuleName -> ExportSpec
-- | An import declaration.
data ImportDecl
ImportDecl :: SrcLoc -> ModuleName -> Bool -> Bool -> Maybe String -> Maybe ModuleName -> Maybe (Bool, [ImportSpec]) -> ImportDecl
-- | position of the import keyword.
importLoc :: ImportDecl -> SrcLoc
-- | name of the module imported.
importModule :: ImportDecl -> ModuleName
-- | imported qualified?
importQualified :: ImportDecl -> Bool
-- | imported with {-# SOURCE #-}?
importSrc :: ImportDecl -> Bool
-- | imported with explicit package name
importPkg :: ImportDecl -> Maybe String
-- | optional alias name in an as clause.
importAs :: ImportDecl -> Maybe ModuleName
-- | optional list of import specifications. The Bool is True
-- if the names are excluded by hiding.
importSpecs :: ImportDecl -> Maybe (Bool, [ImportSpec])
-- | An import specification, representing a single explicit item imported
-- (or hidden) from a module.
data ImportSpec
-- | variable
IVar :: Name -> ImportSpec
-- | T: the name of a class, datatype or type synonym.
IAbs :: Name -> ImportSpec
-- | T(..): a class imported with all of its methods, or a
-- datatype imported with all of its constructors.
IThingAll :: Name -> ImportSpec
-- | T(C_1,...,C_n): a class imported with some of its methods, or
-- a datatype imported with some of its constructors.
IThingWith :: Name -> [CName] -> ImportSpec
-- | Associativity of an operator.
data Assoc
-- | non-associative operator (declared with infix)
AssocNone :: Assoc
-- | left-associative operator (declared with infixl).
AssocLeft :: Assoc
-- | right-associative operator (declared with infixr)
AssocRight :: Assoc
-- | A top-level declaration.
data Decl
-- | A type declaration
TypeDecl :: SrcLoc -> Name -> [TyVarBind] -> Type -> Decl
-- | A type family declaration
TypeFamDecl :: SrcLoc -> Name -> [TyVarBind] -> (Maybe Kind) -> Decl
-- | A data OR newtype declaration
DataDecl :: SrcLoc -> DataOrNew -> Context -> Name -> [TyVarBind] -> [QualConDecl] -> [Deriving] -> Decl
-- | A data OR newtype declaration, GADT style
GDataDecl :: SrcLoc -> DataOrNew -> Context -> Name -> [TyVarBind] -> (Maybe Kind) -> [GadtDecl] -> [Deriving] -> Decl
-- | A data family declaration
DataFamDecl :: SrcLoc -> Context -> Name -> [TyVarBind] -> (Maybe Kind) -> Decl
-- | A type family instance declaration
TypeInsDecl :: SrcLoc -> Type -> Type -> Decl
-- | A data family instance declaration
DataInsDecl :: SrcLoc -> DataOrNew -> Type -> [QualConDecl] -> [Deriving] -> Decl
-- | A data family instance declaration, GADT style
GDataInsDecl :: SrcLoc -> DataOrNew -> Type -> (Maybe Kind) -> [GadtDecl] -> [Deriving] -> Decl
-- | A declaration of a type class
ClassDecl :: SrcLoc -> Context -> Name -> [TyVarBind] -> [FunDep] -> [ClassDecl] -> Decl
-- | An declaration of a type class instance
InstDecl :: SrcLoc -> Context -> QName -> [Type] -> [InstDecl] -> Decl
-- | A standalone deriving declaration
DerivDecl :: SrcLoc -> Context -> QName -> [Type] -> Decl
-- | A declaration of operator fixity
InfixDecl :: SrcLoc -> Assoc -> Int -> [Op] -> Decl
-- | A declaration of default types
DefaultDecl :: SrcLoc -> [Type] -> Decl
-- | A Template Haskell splicing declaration
SpliceDecl :: SrcLoc -> Splice -> Decl
-- | A type signature declaration
TypeSig :: SrcLoc -> [Name] -> Type -> Decl
-- | A set of function binding clauses
FunBind :: [Match] -> Decl
-- | A pattern binding
PatBind :: SrcLoc -> Pat -> (Maybe Type) -> Rhs -> Binds -> Decl
-- | A foreign import declaration
ForImp :: SrcLoc -> CallConv -> Safety -> String -> Name -> Type -> Decl
-- | A foreign export declaration
ForExp :: SrcLoc -> CallConv -> String -> Name -> Type -> Decl
-- | A RULES pragma
RulePragmaDecl :: SrcLoc -> [Rule] -> Decl
-- | A DEPRECATED pragma
DeprPragmaDecl :: SrcLoc -> [([Name], String)] -> Decl
-- | A WARNING pragma
WarnPragmaDecl :: SrcLoc -> [([Name], String)] -> Decl
-- | An INLINE pragma
InlineSig :: SrcLoc -> Bool -> Activation -> QName -> Decl
-- | A SPECIALISE pragma
SpecSig :: SrcLoc -> QName -> [Type] -> Decl
-- | A SPECIALISE INLINE pragma
SpecInlineSig :: SrcLoc -> Bool -> Activation -> QName -> [Type] -> Decl
-- | A SPECIALISE instance pragma
InstSig :: SrcLoc -> Context -> QName -> [Type] -> Decl
-- | A binding group inside a let or where clause.
data Binds
-- | An ordinary binding group
BDecls :: [Decl] -> Binds
-- | A binding group for implicit parameters
IPBinds :: [IPBind] -> Binds
-- | A binding of an implicit parameter.
data IPBind
IPBind :: SrcLoc -> IPName -> Exp -> IPBind
-- | Declarations inside a class declaration.
data ClassDecl
-- | ordinary declaration
ClsDecl :: Decl -> ClassDecl
-- | declaration of an associated data type
ClsDataFam :: SrcLoc -> Context -> Name -> [TyVarBind] -> (Maybe Kind) -> ClassDecl
-- | declaration of an associated type synonym
ClsTyFam :: SrcLoc -> Name -> [TyVarBind] -> (Maybe Kind) -> ClassDecl
-- | default choice for an associated type synonym
ClsTyDef :: SrcLoc -> Type -> Type -> ClassDecl
-- | Declarations inside an instance declaration.
data InstDecl
-- | ordinary declaration
InsDecl :: Decl -> InstDecl
-- | an associated type definition
InsType :: SrcLoc -> Type -> Type -> InstDecl
-- | an associated data type implementation
InsData :: SrcLoc -> DataOrNew -> Type -> [QualConDecl] -> [Deriving] -> InstDecl
-- | an associated data type implemented using GADT style
InsGData :: SrcLoc -> DataOrNew -> Type -> (Maybe Kind) -> [GadtDecl] -> [Deriving] -> InstDecl
-- | an INLINE pragma
InsInline :: SrcLoc -> Bool -> Activation -> QName -> InstDecl
-- | A single derived instance, which may have arguments since it may be a
-- MPTC.
type Deriving = (QName, [Type])
-- | A flag stating whether a declaration is a data or newtype declaration.
data DataOrNew
DataType :: DataOrNew
NewType :: DataOrNew
-- | Declaration of an ordinary data constructor.
data ConDecl
-- | ordinary data constructor
ConDecl :: Name -> [BangType] -> ConDecl
-- | infix data constructor
InfixConDecl :: BangType -> Name -> BangType -> ConDecl
-- | record constructor
RecDecl :: Name -> [([Name], BangType)] -> ConDecl
-- | A single constructor declaration within a data type declaration, which
-- may have an existential quantification binding.
data QualConDecl
QualConDecl :: SrcLoc -> [TyVarBind] -> Context -> ConDecl -> QualConDecl
-- | A single constructor declaration in a GADT data type declaration.
data GadtDecl
GadtDecl :: SrcLoc -> Name -> Type -> GadtDecl
-- | The type of a constructor argument or field, optionally including a
-- strictness annotation.
data BangType
-- | strict component, marked with "!"
BangedTy :: Type -> BangType
-- | non-strict component
UnBangedTy :: Type -> BangType
-- | unboxed component, marked with an UNPACK pragma
UnpackedTy :: Type -> BangType
-- | Clauses of a function binding.
data Match
Match :: SrcLoc -> Name -> [Pat] -> (Maybe Type) -> Rhs -> Binds -> Match
-- | The right hand side of a function or pattern binding.
data Rhs
-- | unguarded right hand side (exp)
UnGuardedRhs :: Exp -> Rhs
-- | guarded right hand side (gdrhs)
GuardedRhss :: [GuardedRhs] -> Rhs
-- | 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.
data GuardedRhs
GuardedRhs :: SrcLoc -> [Stmt] -> Exp -> GuardedRhs
-- | A context is a set of assertions
type Context = [Asst]
-- | A functional dependency, given on the form l1 l2 ... ln -> r2 r3 ..
-- rn
data FunDep
FunDep :: [Name] -> [Name] -> FunDep
-- | 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.
data Asst
-- | ordinary class assertion
ClassA :: QName -> [Type] -> Asst
-- | class assertion where the class name is given infix
InfixA :: Type -> QName -> Type -> Asst
-- | implicit parameter assertion
IParam :: IPName -> Type -> Asst
-- | type equality constraint
EqualP :: Type -> Type -> Asst
-- | A type qualified with a context. An unqualified type has an empty
-- context.
data Type
-- | qualified type
TyForall :: (Maybe [TyVarBind]) -> Context -> Type -> Type
-- | function type
TyFun :: Type -> Type -> Type
-- | tuple type, possibly boxed
TyTuple :: Boxed -> [Type] -> Type
-- | list syntax, e.g. [a], as opposed to [] a
TyList :: Type -> Type
-- | application of a type constructor
TyApp :: Type -> Type -> Type
-- | type variable
TyVar :: Name -> Type
-- | named type or type constructor
TyCon :: QName -> Type
-- | type surrounded by parentheses
TyParen :: Type -> Type
-- | infix type constructor
TyInfix :: Type -> QName -> Type -> Type
-- | type with explicit kind signature
TyKind :: Type -> Kind -> Type
-- | Flag denoting whether a tuple is boxed or unboxed.
data Boxed
Boxed :: Boxed
Unboxed :: Boxed
-- | An explicit kind annotation.
data Kind
-- | *, the kind of types
KindStar :: Kind
-- | !, the kind of unboxed types
KindBang :: Kind
-- | ->, the kind of a type constructor
KindFn :: Kind -> Kind -> Kind
-- | A type variable declaration, optionally with an explicit kind
-- annotation.
data TyVarBind
-- | variable binding with kind annotation
KindedVar :: Name -> Kind -> TyVarBind
-- | ordinary variable binding
UnkindedVar :: Name -> TyVarBind
-- | Haskell expressions.
data Exp
-- | variable
Var :: QName -> Exp
-- | implicit parameter variable
IPVar :: IPName -> Exp
-- | data constructor
Con :: QName -> Exp
-- | literal constant
Lit :: Literal -> Exp
-- | infix application
InfixApp :: Exp -> QOp -> Exp -> Exp
-- | ordinary application
App :: Exp -> Exp -> Exp
-- | negation expression -exp (unary minus)
NegApp :: Exp -> Exp
-- | lambda expression
Lambda :: SrcLoc -> [Pat] -> Exp -> Exp
-- | local declarations with let ... in ...
Let :: Binds -> Exp -> Exp
-- | if exp then exp else
-- exp
If :: Exp -> Exp -> Exp -> Exp
-- | case exp of alts
Case :: Exp -> [Alt] -> Exp
-- | do-expression: the last statement in the list should be an
-- expression.
Do :: [Stmt] -> Exp
-- | mdo-expression
MDo :: [Stmt] -> Exp
-- | tuple expression
Tuple :: [Exp] -> Exp
-- | tuple section expression, e.g. (,,3)
TupleSection :: [Maybe Exp] -> Exp
-- | list expression
List :: [Exp] -> Exp
-- | parenthesised expression
Paren :: Exp -> Exp
-- | left section (exp qop)
LeftSection :: Exp -> QOp -> Exp
-- | right section (qop exp)
RightSection :: QOp -> Exp -> Exp
-- | record construction expression
RecConstr :: QName -> [FieldUpdate] -> Exp
-- | record update expression
RecUpdate :: Exp -> [FieldUpdate] -> Exp
-- | unbounded arithmetic sequence, incrementing by 1: [from ..]
EnumFrom :: Exp -> Exp
-- | bounded arithmetic sequence, incrementing by 1 [from .. to]
EnumFromTo :: Exp -> Exp -> Exp
-- | unbounded arithmetic sequence, with first two elements given
-- [from, then ..]
EnumFromThen :: Exp -> Exp -> Exp
-- | bounded arithmetic sequence, with first two elements given [from,
-- then .. to]
EnumFromThenTo :: Exp -> Exp -> Exp -> Exp
-- | ordinary list comprehension
ListComp :: Exp -> [QualStmt] -> Exp
-- | parallel list comprehension
ParComp :: Exp -> [[QualStmt]] -> Exp
-- | expression with explicit type signature
ExpTypeSig :: SrcLoc -> Exp -> Type -> Exp
-- | 'x for template haskell reifying of expressions
VarQuote :: QName -> Exp
-- | ''T for template haskell reifying of types
TypQuote :: QName -> Exp
-- | template haskell bracket expression
BracketExp :: Bracket -> Exp
-- | template haskell splice expression
SpliceExp :: Splice -> Exp
-- | quasi-quotaion: [$name| string |]
QuasiQuote :: String -> String -> Exp
-- | xml element, with attributes and children
XTag :: SrcLoc -> XName -> [XAttr] -> (Maybe Exp) -> [Exp] -> Exp
-- | empty xml element, with attributes
XETag :: SrcLoc -> XName -> [XAttr] -> (Maybe Exp) -> Exp
-- | PCDATA child element
XPcdata :: String -> Exp
-- | escaped haskell expression inside xml
XExpTag :: Exp -> Exp
-- | CORE pragma
CorePragma :: String -> Exp -> Exp
-- | SCC pragma
SCCPragma :: String -> Exp -> Exp
-- | GENERATED pragma
GenPragma :: String -> (Int, Int) -> (Int, Int) -> Exp -> Exp
-- | arrows proc: proc pat -> exp
Proc :: Pat -> Exp -> Exp
-- | arrow application (from left): exp -< exp
LeftArrApp :: Exp -> Exp -> Exp
-- | arrow application (from right): exp >- exp
RightArrApp :: Exp -> Exp -> Exp
-- | higher-order arrow application (from left): exp
-- -<< exp
LeftArrHighApp :: Exp -> Exp -> Exp
-- | higher-order arrow application (from right): exp
-- >>- exp
RightArrHighApp :: Exp -> Exp -> Exp
-- | A statement, representing both a stmt in a
-- do-expression, an ordinary qual in a list
-- comprehension, as well as a stmt in a pattern guard.
data Stmt
-- | a generator: pat <- exp
Generator :: SrcLoc -> Pat -> Exp -> Stmt
-- | an exp by itself: in a do-expression, an action whose
-- result is discarded; in a list comprehension and pattern guard, a
-- guard expression
Qualifier :: Exp -> Stmt
-- | local bindings
LetStmt :: Binds -> Stmt
-- | a recursive binding group for arrows
RecStmt :: [Stmt] -> Stmt
-- | A general transqual in a list comprehension, which could
-- potentially be a transform of the kind enabled by TransformListComp.
data QualStmt
-- | an ordinary statement
QualStmt :: Stmt -> QualStmt
-- | then exp
ThenTrans :: Exp -> QualStmt
-- | then exp by exp
ThenBy :: Exp -> Exp -> QualStmt
-- | then group by exp
GroupBy :: Exp -> QualStmt
-- | then group using exp
GroupUsing :: Exp -> QualStmt
-- | then group by exp using
-- exp
GroupByUsing :: Exp -> Exp -> QualStmt
-- | An fbind in a labeled construction or update expression.
data FieldUpdate
-- | ordinary label-expresion pair
FieldUpdate :: QName -> Exp -> FieldUpdate
-- | record field pun
FieldPun :: Name -> FieldUpdate
-- | record field wildcard
FieldWildcard :: FieldUpdate
-- | An alt alternative in a case expression.
data Alt
Alt :: SrcLoc -> Pat -> GuardedAlts -> Binds -> Alt
-- | The right-hand sides of a case alternative, which may be a
-- single right-hand side or a set of guarded ones.
data GuardedAlts
-- | -> exp
UnGuardedAlt :: Exp -> GuardedAlts
-- | gdpat
GuardedAlts :: [GuardedAlt] -> GuardedAlts
-- | A guarded case alternative | stmts ->
-- exp.
data GuardedAlt
GuardedAlt :: SrcLoc -> [Stmt] -> Exp -> GuardedAlt
-- | An xml attribute, which is a name-expression pair.
data XAttr
XAttr :: XName -> Exp -> XAttr
-- | A pattern, to be matched against a value.
data Pat
-- | variable
PVar :: Name -> Pat
-- | literal constant
PLit :: Literal -> Pat
-- | negated pattern
PNeg :: Pat -> Pat
-- | n+k pattern
PNPlusK :: Name -> Integer -> Pat
-- | pattern with an infix data constructor
PInfixApp :: Pat -> QName -> Pat -> Pat
-- | data constructor and argument patterns
PApp :: QName -> [Pat] -> Pat
-- | tuple pattern
PTuple :: [Pat] -> Pat
-- | list pattern
PList :: [Pat] -> Pat
-- | parenthesized pattern
PParen :: Pat -> Pat
-- | labelled pattern, record style
PRec :: QName -> [PatField] -> Pat
-- | @-pattern
PAsPat :: Name -> Pat -> Pat
-- | wildcard pattern: _
PWildCard :: Pat
-- | irrefutable pattern: ~pat
PIrrPat :: Pat -> Pat
-- | pattern with type signature
PatTypeSig :: SrcLoc -> Pat -> Type -> Pat
-- | view patterns of the form (exp -> pat)
PViewPat :: Exp -> Pat -> Pat
-- | regular list pattern
PRPat :: [RPat] -> Pat
-- | XML element pattern
PXTag :: SrcLoc -> XName -> [PXAttr] -> (Maybe Pat) -> [Pat] -> Pat
-- | XML singleton element pattern
PXETag :: SrcLoc -> XName -> [PXAttr] -> (Maybe Pat) -> Pat
-- | XML PCDATA pattern
PXPcdata :: String -> Pat
-- | XML embedded pattern
PXPatTag :: Pat -> Pat
-- | XML regular list pattern
PXRPats :: [RPat] -> Pat
-- | Explicit generics style type argument e.g. f {| Int |} x =
-- ...
PExplTypeArg :: QName -> Type -> Pat
-- | quasi quote patter: [$name| string |]
PQuasiQuote :: String -> String -> Pat
-- | strict (bang) pattern: f !x = ...
PBangPat :: Pat -> Pat
-- | An fpat in a labeled record pattern.
data PatField
-- | ordinary label-pattern pair
PFieldPat :: QName -> Pat -> PatField
-- | record field pun
PFieldPun :: Name -> PatField
-- | record field wildcard
PFieldWildcard :: PatField
-- | An XML attribute in a pattern.
data PXAttr
PXAttr :: XName -> Pat -> PXAttr
-- | An entity in a regular pattern.
data RPat
RPOp :: RPat -> RPatOp -> RPat
RPEither :: RPat -> RPat -> RPat
RPSeq :: [RPat] -> RPat
RPGuard :: Pat -> [Stmt] -> RPat
RPCAs :: Name -> RPat -> RPat
RPAs :: Name -> RPat -> RPat
RPParen :: RPat -> RPat
RPPat :: Pat -> RPat
-- | A regular pattern operator.
data RPatOp
-- | * = 0 or more
RPStar :: RPatOp
-- | *! = 0 or more, greedy
RPStarG :: RPatOp
-- | + = 1 or more
RPPlus :: RPatOp
-- | +! = 1 or more, greedy
RPPlusG :: RPatOp
-- | ? = 0 or 1
RPOpt :: RPatOp
-- | ?! = 0 or 1, greedy
RPOptG :: RPatOp
-- | 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.
data Literal
-- | character literal
Char :: Char -> Literal
-- | string literal
String :: String -> Literal
-- | integer literal
Int :: Integer -> Literal
-- | floating point literal
Frac :: Rational -> Literal
-- | unboxed integer literal
PrimInt :: Integer -> Literal
-- | unboxed word literal
PrimWord :: Integer -> Literal
-- | unboxed float literal
PrimFloat :: Rational -> Literal
-- | unboxed double literal
PrimDouble :: Rational -> Literal
-- | unboxed character literal
PrimChar :: Char -> Literal
-- | unboxed string literal
PrimString :: String -> Literal
-- | The name of a Haskell module.
newtype ModuleName
ModuleName :: String -> ModuleName
-- | This type is used to represent qualified variables, and also qualified
-- constructors.
data QName
-- | name qualified with a module name
Qual :: ModuleName -> Name -> QName
-- | unqualified local name
UnQual :: Name -> QName
-- | built-in constructor with special syntax
Special :: SpecialCon -> QName
-- | This type is used to represent variables, and also constructors.
data Name
-- | varid or conid.
Ident :: String -> Name
-- | varsym or consym
Symbol :: String -> Name
-- | Possibly qualified infix operators (qop), appearing in
-- expressions.
data QOp
-- | variable operator (qvarop)
QVarOp :: QName -> QOp
-- | constructor operator (qconop)
QConOp :: QName -> QOp
-- | Operators appearing in infix declarations are never
-- qualified.
data Op
-- | variable operator (varop)
VarOp :: Name -> Op
-- | constructor operator (conop)
ConOp :: Name -> Op
-- | Constructors with special syntax. These names are never qualified, and
-- always refer to builtin type or data constructors.
data SpecialCon
-- | unit type and data constructor ()
UnitCon :: SpecialCon
-- | list type constructor []
ListCon :: SpecialCon
-- | function type constructor ->
FunCon :: SpecialCon
-- | n-ary tuple type and data constructors (,) etc,
-- possibly boxed (#,#)
TupleCon :: Boxed -> Int -> SpecialCon
-- | list data constructor (:)
Cons :: SpecialCon
-- | unboxed singleton tuple constructor (# #)
UnboxedSingleCon :: SpecialCon
-- | A name (cname) of a component of a class or data type in an
-- import or export specification.
data CName
-- | name of a method or field
VarName :: Name -> CName
-- | name of a data constructor
ConName :: Name -> CName
-- | An implicit parameter name.
data IPName
-- | ?ident, non-linear implicit parameter
IPDup :: String -> IPName
-- | %ident, linear implicit parameter
IPLin :: String -> IPName
-- | The name of an xml element or attribute, possibly qualified with a
-- namespace.
data XName
XName :: String -> XName
XDomName :: String -> String -> XName
-- | A template haskell bracket expression.
data Bracket
-- | expression bracket: [| ... |]
ExpBracket :: Exp -> Bracket
-- | pattern bracket: [p| ... |]
PatBracket :: Pat -> Bracket
-- | type bracket: [t| ... |]
TypeBracket :: Type -> Bracket
-- | declaration bracket: [d| ... |]
DeclBracket :: [Decl] -> Bracket
-- | A template haskell splice expression
data Splice
-- | variable splice: $var
IdSplice :: String -> Splice
-- | parenthesised expression splice: $(exp)
ParenSplice :: Exp -> Splice
-- | The safety of a foreign function call.
data Safety
-- | unsafe
PlayRisky :: Safety
-- | safe (False) or threadsafe (True)
PlaySafe :: Bool -> Safety
-- | The calling convention of a foreign function call.
data CallConv
StdCall :: CallConv
CCall :: CallConv
-- | A top level options pragma, preceding the module header.
data OptionPragma
-- | LANGUAGE pragma
LanguagePragma :: SrcLoc -> [Name] -> OptionPragma
-- | INCLUDE pragma
IncludePragma :: SrcLoc -> String -> OptionPragma
-- | CFILES pragma
CFilesPragma :: SrcLoc -> String -> OptionPragma
-- | OPTIONS pragma, possibly qualified with a tool, e.g. OPTIONS_GHC
OptionsPragma :: SrcLoc -> (Maybe Tool) -> String -> OptionPragma
-- | Recognised tools for OPTIONS pragmas.
data Tool
GHC :: Tool
HUGS :: Tool
NHC98 :: Tool
YHC :: Tool
HADDOCK :: Tool
UnknownTool :: String -> Tool
-- | The body of a RULES pragma.
data Rule
Rule :: String -> Activation -> (Maybe [RuleVar]) -> Exp -> Exp -> Rule
-- | Variables used in a RULES pragma, optionally annotated with types
data RuleVar
RuleVar :: Name -> RuleVar
TypedRuleVar :: Name -> Type -> RuleVar
-- | Activation clause of a RULES pragma.
data Activation
AlwaysActive :: Activation
ActiveFrom :: Int -> Activation
ActiveUntil :: Int -> Activation
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
-- | A position in the source.
data SrcLoc
SrcLoc :: String -> Int -> Int -> SrcLoc
srcFilename :: SrcLoc -> String
srcLine :: SrcLoc -> Int
srcColumn :: SrcLoc -> Int
instance Typeable GuardedAlt
instance Typeable GuardedAlts
instance Typeable Alt
instance Typeable FieldUpdate
instance Typeable QualStmt
instance Typeable Stmt
instance Typeable PatField
instance Typeable RPat
instance Typeable RPatOp
instance Typeable PXAttr
instance Typeable Pat
instance Typeable WarningText
instance Typeable RuleVar
instance Typeable Rule
instance Typeable Activation
instance Typeable Tool
instance Typeable OptionPragma
instance Typeable CallConv
instance Typeable Safety
instance Typeable Splice
instance Typeable Bracket
instance Typeable XAttr
instance Typeable XName
instance Typeable Exp
instance Typeable Literal
instance Typeable Asst
instance Typeable FunDep
instance Typeable Kind
instance Typeable TyVarBind
instance Typeable Boxed
instance Typeable Type
instance Typeable GuardedRhs
instance Typeable Rhs
instance Typeable BangType
instance Typeable InstDecl
instance Typeable ClassDecl
instance Typeable GadtDecl
instance Typeable ConDecl
instance Typeable QualConDecl
instance Typeable Match
instance Typeable IPBind
instance Typeable Binds
instance Typeable DataOrNew
instance Typeable Decl
instance Typeable Assoc
instance Typeable ImportSpec
instance Typeable ImportDecl
instance Typeable ExportSpec
instance Typeable Module
instance Typeable CName
instance Typeable Op
instance Typeable QOp
instance Typeable IPName
instance Typeable Name
instance Typeable QName
instance Typeable SpecialCon
instance Typeable ModuleName
instance Typeable SrcLoc
instance Eq GuardedAlt
instance Show GuardedAlt
instance Data GuardedAlt
instance Eq GuardedAlts
instance Show GuardedAlts
instance Data GuardedAlts
instance Eq Alt
instance Show Alt
instance Data Alt
instance Eq FieldUpdate
instance Show FieldUpdate
instance Data FieldUpdate
instance Eq QualStmt
instance Show QualStmt
instance Data QualStmt
instance Eq Stmt
instance Show Stmt
instance Data Stmt
instance Eq PatField
instance Show PatField
instance Data PatField
instance Eq RPat
instance Show RPat
instance Data RPat
instance Eq RPatOp
instance Show RPatOp
instance Data RPatOp
instance Eq PXAttr
instance Show PXAttr
instance Data PXAttr
instance Eq Pat
instance Show Pat
instance Data Pat
instance Eq WarningText
instance Show WarningText
instance Data WarningText
instance Eq RuleVar
instance Show RuleVar
instance Data RuleVar
instance Eq Rule
instance Show Rule
instance Data Rule
instance Eq Activation
instance Show Activation
instance Data Activation
instance Eq Tool
instance Show Tool
instance Data Tool
instance Eq OptionPragma
instance Show OptionPragma
instance Data OptionPragma
instance Eq CallConv
instance Show CallConv
instance Data CallConv
instance Eq Safety
instance Show Safety
instance Data Safety
instance Eq Splice
instance Show Splice
instance Data Splice
instance Eq Bracket
instance Show Bracket
instance Data Bracket
instance Eq XAttr
instance Show XAttr
instance Data XAttr
instance Eq XName
instance Show XName
instance Data XName
instance Eq Exp
instance Show Exp
instance Data Exp
instance Eq Literal
instance Show Literal
instance Data Literal
instance Eq Asst
instance Show Asst
instance Data Asst
instance Eq FunDep
instance Show FunDep
instance Data FunDep
instance Eq Kind
instance Show Kind
instance Data Kind
instance Eq TyVarBind
instance Show TyVarBind
instance Data TyVarBind
instance Eq Boxed
instance Ord Boxed
instance Show Boxed
instance Data Boxed
instance Eq Type
instance Show Type
instance Data Type
instance Eq GuardedRhs
instance Show GuardedRhs
instance Data GuardedRhs
instance Eq Rhs
instance Show Rhs
instance Data Rhs
instance Eq BangType
instance Show BangType
instance Data BangType
instance Eq InstDecl
instance Show InstDecl
instance Data InstDecl
instance Eq ClassDecl
instance Show ClassDecl
instance Data ClassDecl
instance Eq GadtDecl
instance Show GadtDecl
instance Data GadtDecl
instance Eq ConDecl
instance Show ConDecl
instance Data ConDecl
instance Eq QualConDecl
instance Show QualConDecl
instance Data QualConDecl
instance Eq Match
instance Show Match
instance Data Match
instance Eq IPBind
instance Show IPBind
instance Data IPBind
instance Eq Binds
instance Show Binds
instance Data Binds
instance Eq DataOrNew
instance Show DataOrNew
instance Data DataOrNew
instance Eq Decl
instance Show Decl
instance Data Decl
instance Eq Assoc
instance Show Assoc
instance Data Assoc
instance Eq ImportSpec
instance Show ImportSpec
instance Data ImportSpec
instance Eq ImportDecl
instance Show ImportDecl
instance Data ImportDecl
instance Eq ExportSpec
instance Show ExportSpec
instance Data ExportSpec
instance Show Module
instance Data Module
instance Eq CName
instance Ord CName
instance Show CName
instance Data CName
instance Eq Op
instance Ord Op
instance Show Op
instance Data Op
instance Eq QOp
instance Ord QOp
instance Show QOp
instance Data QOp
instance Eq IPName
instance Ord IPName
instance Show IPName
instance Data IPName
instance Eq Name
instance Ord Name
instance Show Name
instance Data Name
instance Eq QName
instance Ord QName
instance Show QName
instance Data QName
instance Eq SpecialCon
instance Ord SpecialCon
instance Show SpecialCon
instance Data SpecialCon
instance Eq ModuleName
instance Ord ModuleName
instance Show ModuleName
instance Data ModuleName
instance Eq SrcLoc
instance Ord SrcLoc
instance Show SrcLoc
instance Data SrcLoc
-- | This module contains combinators to use when building Haskell source
-- trees programmatically, as opposed to parsing them from a string. The
-- contents here are quite experimental and will likely receive a lot of
-- attention when the rest has stabilised.
module Language.Haskell.Exts.Build
-- | An identifier with the given string as its name. The string should be
-- a valid Haskell identifier.
name :: String -> Name
-- | A symbol identifier. The string should be a valid Haskell symbol
-- identifier.
sym :: String -> Name
-- | A local variable as expression.
var :: Name -> Exp
-- | Use the given identifier as an operator.
op :: Name -> QOp
-- | A qualified variable as expression.
qvar :: ModuleName -> Name -> Exp
-- | A pattern variable.
pvar :: Name -> Pat
-- | Application of expressions by juxtaposition.
app :: Exp -> Exp -> Exp
-- | Apply an operator infix.
infixApp :: Exp -> QOp -> Exp -> Exp
-- | Apply a function to a list of arguments.
appFun :: Exp -> [Exp] -> Exp
-- | A constructor pattern, with argument patterns.
pApp :: Name -> [Pat] -> Pat
-- | A tuple expression.
tuple :: [Exp] -> Exp
-- | A tuple pattern.
pTuple :: [Pat] -> Pat
-- | A tuple expression consisting of variables only.
varTuple :: [Name] -> Exp
-- | A tuple pattern consisting of variables only.
pvarTuple :: [Name] -> Pat
-- | A function with a given name.
function :: String -> Exp
-- | A literal string expression.
strE :: String -> Exp
-- | A literal character expression.
charE :: Char -> Exp
-- | A literal integer expression.
intE :: Integer -> Exp
-- | A literal string pattern.
strP :: String -> Pat
-- | A literal character pattern.
charP :: Char -> Pat
-- | A literal integer pattern.
intP :: Integer -> Pat
-- | A do block formed by the given statements. The last statement in the
-- list should be a Qualifier expression.
doE :: [Stmt] -> Exp
-- | Lambda abstraction, given a list of argument patterns and an
-- expression body.
lamE :: SrcLoc -> [Pat] -> Exp -> Exp
-- | A let ... in block.
letE :: [Decl] -> Exp -> Exp
-- | A case expression.
caseE :: Exp -> [Alt] -> Exp
-- | An unguarded alternative in a case expression.
alt :: SrcLoc -> Pat -> Exp -> Alt
-- | An alternative with a single guard in a case expression.
altGW :: SrcLoc -> Pat -> [Stmt] -> Exp -> Binds -> Alt
-- | A list expression.
listE :: [Exp] -> Exp
-- | The empty list expression.
eList :: Exp
-- | The empty list pattern.
peList :: Pat
-- | Put parentheses around an expression.
paren :: Exp -> Exp
-- | Put parentheses around a pattern.
pParen :: Pat -> Pat
-- | A qualifier expression statement.
qualStmt :: Exp -> Stmt
-- | A generator statement: pat <- exp
genStmt :: SrcLoc -> Pat -> Exp -> Stmt
-- | A let binding group as a statement.
letStmt :: [Decl] -> Stmt
-- | Hoist a set of declarations to a binding group.
binds :: [Decl] -> Binds
-- | An empty binding group.
noBinds :: Binds
-- | The wildcard pattern: _
wildcard :: Pat
-- | Generate k names by appending numbers 1 through k to a given string.
genNames :: String -> Int -> [Name]
-- | A function with a single clause
sfun :: SrcLoc -> Name -> [Name] -> Rhs -> Binds -> Decl
-- | A function with a single clause, a single argument, no guards and no
-- where declarations
simpleFun :: SrcLoc -> Name -> Name -> Exp -> Decl
-- | A pattern bind where the pattern is a variable, and where there are no
-- guards and no 'where' clause.
patBind :: SrcLoc -> Pat -> Exp -> Decl
-- | A pattern bind where the pattern is a variable, and where there are no
-- guards, but with a 'where' clause.
patBindWhere :: SrcLoc -> Pat -> Exp -> [Decl] -> Decl
-- | Bind an identifier to an expression.
nameBind :: SrcLoc -> Name -> Exp -> Decl
-- | Apply function of a given name to a list of arguments.
metaFunction :: String -> [Exp] -> Exp
-- | Apply a constructor of a given name to a list of pattern arguments,
-- forming a constructor pattern.
metaConPat :: String -> [Pat] -> Pat
-- | Pretty printer for Haskell with extensions.
module Language.Haskell.Exts.Pretty
-- | Things that can be pretty-printed, including all the syntactic objects
-- in Language.Haskell.Exts.Syntax.
class Pretty a
-- | pretty-print with a given style and mode.
prettyPrintStyleMode :: (Pretty a) => Style -> PPHsMode -> a -> String
-- | pretty-print with the default style and a given mode.
prettyPrintWithMode :: (Pretty a) => PPHsMode -> a -> String
-- | pretty-print with the default style and defaultMode.
prettyPrint :: (Pretty a) => a -> String
-- | A rendering style.
data Style :: *
Style :: Mode -> Int -> Float -> Style
-- | The rendering mode
mode :: Style -> Mode
-- | Length of line, in chars
lineLength :: Style -> Int
-- | Ratio of ribbon length to line length
ribbonsPerLine :: Style -> Float
-- | The default style (mode=PageMode, lineLength=100,
-- ribbonsPerLine=1.5).
style :: Style
-- | Rendering mode.
data Mode :: *
-- | Normal
PageMode :: Mode
-- | With zig-zag cuts
ZigZagMode :: Mode
-- | No indentation, infinitely long lines
LeftMode :: Mode
-- | All on one line
OneLineMode :: Mode
-- | Pretty-printing parameters.
--
-- Note: the onsideIndent must be positive and less than
-- all other indents.
data PPHsMode
PPHsMode :: Indent -> Indent -> Indent -> Indent -> Indent -> Indent -> Bool -> PPLayout -> Bool -> PPHsMode
-- | indentation of a class or instance
classIndent :: PPHsMode -> Indent
-- | indentation of a do-expression
doIndent :: PPHsMode -> Indent
-- | indentation of the body of a case expression
caseIndent :: PPHsMode -> Indent
-- | indentation of the declarations in a let expression
letIndent :: PPHsMode -> Indent
-- | indentation of the declarations in a where clause
whereIndent :: PPHsMode -> Indent
-- | indentation added for continuation lines that would otherwise be
-- offside
onsideIndent :: PPHsMode -> Indent
-- | blank lines between statements?
spacing :: PPHsMode -> Bool
-- | Pretty-printing style to use
layout :: PPHsMode -> PPLayout
-- | add GHC-style LINE pragmas to output?
linePragmas :: PPHsMode -> Bool
type Indent = Int
-- | Varieties of layout we can use.
data PPLayout
-- | classical layout
PPOffsideRule :: PPLayout
-- | classical layout made explicit
PPSemiColon :: PPLayout
-- | inline decls, with newlines between them
PPInLine :: PPLayout
-- | everything on a single line
PPNoLayout :: PPLayout
-- | The default mode: pretty-print using the offside rule and sensible
-- defaults.
defaultMode :: PPHsMode
instance Eq PPLayout
instance Pretty SrcLoc
instance Pretty Asst
instance Pretty CName
instance Pretty IPBind
instance Pretty IPName
instance Pretty Name
instance Pretty Op
instance Pretty QName
instance Pretty QOp
instance Pretty FieldUpdate
instance Pretty QualStmt
instance Pretty Stmt
instance Pretty GuardedAlt
instance Pretty GuardedAlts
instance Pretty Alt
instance Pretty RPatOp
instance Pretty RPat
instance Pretty PatField
instance Pretty PXAttr
instance Pretty Pat
instance Pretty Splice
instance Pretty Bracket
instance Pretty XName
instance Pretty XAttr
instance Pretty Exp
instance Pretty Literal
instance Pretty GuardedRhs
instance Pretty Rhs
instance Pretty FunDep
instance Pretty Kind
instance Pretty TyVarBind
instance Pretty Type
instance Pretty BangType
instance Pretty ConDecl
instance Pretty GadtDecl
instance Pretty QualConDecl
instance Pretty Tool
instance Pretty OptionPragma
instance Pretty RuleVar
instance Pretty Activation
instance Pretty Rule
instance Pretty CallConv
instance Pretty Safety
instance Pretty InstDecl
instance Pretty ClassDecl
instance Pretty Match
instance Pretty Assoc
instance Pretty DataOrNew
instance Pretty Decl
instance Pretty ImportSpec
instance Pretty ImportDecl
instance Pretty ExportSpec
instance Pretty ModuleName
instance Pretty Module
instance Monad (DocM s)
instance Functor (DocM s)
-- | Fixity information to give the parser so that infix operators can be
-- parsed properly.
module Language.Haskell.Exts.Fixity
-- | Operator fixities are represented by their associativity (left, right
-- or none) and their precedence (0-9).
data Fixity
Fixity :: Assoc -> Int -> Op -> Fixity
infix_ :: Int -> [String] -> [Fixity]
infixl_ :: Int -> [String] -> [Fixity]
infixr_ :: Int -> [String] -> [Fixity]
-- | All fixities defined in the Prelude.
preludeFixities :: [Fixity]
-- | All fixities defined in the base package.
--
-- Note that the +++ operator appears in both Control.Arrows and
-- Text.ParserCombinators.ReadP. The listed precedence for +++
-- in this list is that of Control.Arrows.
baseFixities :: [Fixity]
-- | All AST elements that may include expressions which in turn may need
-- fixity tweaking will be instances of this class.
class AppFixity ast
applyFixities :: (AppFixity ast) => [Fixity] -> ast -> ast
instance AppFixity XAttr
instance AppFixity Splice
instance AppFixity Bracket
instance AppFixity QualStmt
instance AppFixity GuardedAlt
instance AppFixity GuardedAlts
instance AppFixity Alt
instance AppFixity FieldUpdate
instance AppFixity IPBind
instance AppFixity Binds
instance AppFixity Stmt
instance AppFixity PXAttr
instance AppFixity RPat
instance AppFixity PatField
instance AppFixity Pat
instance AppFixity GuardedRhs
instance AppFixity Rhs
instance AppFixity Match
instance AppFixity InstDecl
instance AppFixity ClassDecl
instance AppFixity Decl
instance AppFixity Module
instance AppFixity Exp
module Language.Haskell.Exts.Comments
data Comment
SingleLine :: SrcLoc -> String -> Comment
MultiLine :: SrcLoc -> String -> Comment
instance Typeable Comment
instance Eq Comment
instance Show Comment
instance Data Comment
module Language.Haskell.Exts.Parser
-- | Class to reuse the parse function at many different types.
class Parseable ast
parse :: (Parseable ast) => String -> ParseResult ast
parseWithMode :: (Parseable ast) => ParseMode -> String -> ParseResult ast
parseWithComments :: (Parseable ast) => ParseMode -> String -> ParseResult (ast, [Comment])
-- | Static parameters governing a parse. Note that the various parse
-- functions in Language.Haskell.Exts.Parser never look at
-- LANGUAGE pragmas, regardless of what the
-- ignoreLanguagePragmas flag is set to. Only the various
-- parseFile functions in Language.Haskell.Exts will act
-- on it, when set to False.
data ParseMode
ParseMode :: String -> [Extension] -> Bool -> [Fixity] -> ParseMode
-- | original name of the file being parsed
parseFilename :: ParseMode -> String
-- | list of extensions enabled for parsing
extensions :: ParseMode -> [Extension]
-- | if True, the parser won't care about further extensions in
-- LANGUAGE pragmas in source files
ignoreLanguagePragmas :: ParseMode -> Bool
-- | list of fixities to be aware of
fixities :: ParseMode -> [Fixity]
-- | Default parameters for a parse. The default is an unknown filename, no
-- extensions (i.e. Haskell 98), don't ignore LANGUAGE pragmas, and be
-- aware of fixities from the Prelude.
defaultParseMode :: ParseMode
-- | The result of a parse.
data ParseResult a
-- | The parse succeeded, yielding a value.
ParseOk :: a -> ParseResult a
-- | The parse failed at the specified source location, with an error
-- message.
ParseFailed :: SrcLoc -> String -> ParseResult a
-- | Retrieve the result of a successful parse, throwing an error if the
-- parse is actually not successful.
fromParseResult :: ParseResult a -> a
-- | Parse of a string, which should contain a complete Haskell module.
parseModule :: String -> ParseResult Module
-- | Parse of a string containing a complete Haskell module, using an
-- explicit mode.
parseModuleWithMode :: ParseMode -> String -> ParseResult Module
-- | Parse of a string containing a complete Haskell module, using an
-- explicit mode, retaining comments.
parseModuleWithComments :: ParseMode -> String -> ParseResult (Module, [Comment])
-- | Parse of a string containing a Haskell expression.
parseExp :: String -> ParseResult Exp
-- | Parse of a string containing a Haskell expression, using an explicit
-- mode.
parseExpWithMode :: ParseMode -> String -> ParseResult Exp
-- | Parse of a string containing a complete Haskell module, using an
-- explicit mode, retaining comments.
parseExpWithComments :: ParseMode -> String -> ParseResult (Exp, [Comment])
-- | Parse of a string containing a Haskell pattern.
parsePat :: String -> ParseResult Pat
-- | Parse of a string containing a Haskell pattern, using an explicit
-- mode.
parsePatWithMode :: ParseMode -> String -> ParseResult Pat
-- | Parse of a string containing a complete Haskell module, using an
-- explicit mode, retaining comments.
parsePatWithComments :: ParseMode -> String -> ParseResult (Pat, [Comment])
-- | Parse of a string containing a Haskell top-level declaration.
parseDecl :: String -> ParseResult Decl
-- | Parse of a string containing a Haskell top-level declaration, using an
-- explicit mode.
parseDeclWithMode :: ParseMode -> String -> ParseResult Decl
-- | Parse of a string containing a complete Haskell module, using an
-- explicit mode, retaining comments.
parseDeclWithComments :: ParseMode -> String -> ParseResult (Decl, [Comment])
-- | Parse of a string containing a Haskell type.
parseType :: String -> ParseResult Type
-- | Parse of a string containing a Haskell type, using an explicit mode.
parseTypeWithMode :: ParseMode -> String -> ParseResult Type
-- | Parse of a string containing a complete Haskell module, using an
-- explicit mode, retaining comments.
parseTypeWithComments :: ParseMode -> String -> ParseResult (Type, [Comment])
-- | Partial parse of a string starting with a series of top-level option
-- pragmas.
getTopPragmas :: String -> ParseResult [OptionPragma]
instance Parseable Type
instance Parseable Decl
instance Parseable Pat
instance Parseable Exp
instance Parseable Module
-- | An umbrella module for the various functionality of the package. Also
-- provides some convenient functionality for dealing directly with
-- source files.
module Language.Haskell.Exts
-- | Parse a source file on disk, using the default parse mode.
parseFile :: FilePath -> IO (ParseResult Module)
-- | Parse a source file on disk, supplying a custom parse mode.
parseFileWithMode :: ParseMode -> FilePath -> IO (ParseResult Module)
-- | Parse a source file on disk, with an extra set of extensions to know
-- about on top of what the file itself declares.
parseFileWithExts :: [Extension] -> FilePath -> IO (ParseResult Module)
-- | Parse a source file from a string using the default parse mode.
parseFileContents :: String -> ParseResult Module
-- | Parse a source file from a string using a custom parse mode.
parseFileContentsWithMode :: ParseMode -> String -> ParseResult Module
-- | Gather the extensions declared in LANGUAGE pragmas at the top of the
-- file. Returns Nothing if the parse of the pragmas fails.
readExtensions :: String -> Maybe [Extension]