HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehaskell-src-exts-1.23.1Haskell98

Language.Haskell.Exts.Parser

Annotated parser for Haskell with extensions.

  • 7 types
  • 1 class
  • 25 values

General parsing

5 declarations
classclass Parseable ast where
#

Class providing function for parsing at many different types.

Note that for convenience of implementation, the default methods have definitions equivalent to undefined. The minimal definition is all of the visible methods.

Methods

Instances11Parseable, …
datadata ParseMode
#

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.

Constructors

Default parameters for a parse. The default is an unknown filename, no extensions (i.e. Haskell 98), don't ignore LANGUAGE pragmas, do ignore LINE pragmas, and be aware of fixities from the Prelude.

datadata ParseResult a
#

The result of a parse.

Constructors

Instances9Monad, Functor, MonadFail, Applicative, Eq, Ord, …
valuefromParseResult :: ParseResult a -> a
#

Retrieve the result of a successful parse, throwing an error if the parse is actually not successful.

Parsing of specific AST elements

0 declarations

Modules

Expressions

Statements

Patterns

Declarations

Types

Imports

Non-greedy parsers

3 declarations
newtypenewtype NonGreedy a
#

Instances of Parseable for NonGreedy a will only consume the input until a is fully parsed. This means that parse errors that come later in the input will be ignored. It's also more efficient, as it's fully lazy in the remainder of the input:

Example1 expression
parse (unlines ("module A where" : "main =" : repeat "blah")) :: ParseResult PragmasAndModuleHeadParseOk (NonGreedy {unNonGreedy = PragmasAndModuleHead [] (ModuleName "A",Nothing,Nothing)})

(this example uses the simplified AST)

Constructors

Instances9Functor, Eq, Data, Ord, Show, Parseable, …
datadata ListOf a
#

ListOf a stores lists of the AST type a, along with a SrcSpanInfo, in order to provide Parseable instances for lists. These instances are provided when the type is used as a list in the syntax, and the same delimiters are used in all of its usages. Some exceptions are made:

Constructors

Instances6Functor, Eq, Data, Ord, Show, Parseable
  • Functor ListOfDefined in haskell-src-exts-1.23.1 · Language.Haskell.Exts.Parser
  • Eq a => Eq (ListOf a)Defined in haskell-src-exts-1.23.1 · Language.Haskell.Exts.Parser
  • Data a => Data (ListOf a)Defined in haskell-src-exts-1.23.1 · Language.Haskell.Exts.Parser
  • Ord a => Ord (ListOf a)Defined in haskell-src-exts-1.23.1 · Language.Haskell.Exts.Parser
  • Show a => Show (ListOf a)Defined in haskell-src-exts-1.23.1 · Language.Haskell.Exts.Parser
  • Parseable (NonGreedy (ListOf (ModulePragma SrcSpanInfo)))Defined in haskell-src-exts-1.23.1 · Language.Haskell.Exts.Parser

Module head parsers

datadata PragmasAndModuleName l
#

Type intended to be used with Parseable, with instances that implement a non-greedy parse of the module name, including top-level pragmas. This means that a parse error that comes after the module header won't be returned. If the Maybe value is Nothing, then this means that there was no module header.

Instances5Eq, Data, Ord, Show, Parseable
datadata PragmasAndModuleHead l
#
Instances5Eq, Data, Ord, Show, Parseable
datadata ModuleHeadAndImports l
#
Instances5Eq, Data, Ord, Show, Parseable

Orphan instances

7 instances