DTC-1.1.0: Data To Class transformation.

Language.Haskell.DTC.Parser

Contents

Description

All you need to parse a module.

Synopsis

From Language.Haskell.Exts.Parser

data ParseResult a

The result of a parse.

Constructors

ParseOk a

The parse succeeded, yielding a value.

ParseFailed SrcLoc String

The parse failed at the specified source location, with an error message.

data Module

A complete Haskell source module.

data 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

ParseMode 

Fields

parseFilename :: String

original name of the file being parsed

extensions :: [Extension]

list of extensions enabled for parsing

ignoreLanguagePragmas :: Bool

if True, the parser won't care about further extensions in LANGUAGE pragmas in source files

ignoreLinePragmas :: Bool

if True, the parser won't read line position information from LINE pragmas in source files

fixities :: [Fixity]

list of fixities to be aware of

defaultParseMode :: ParseMode

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.

parseModule :: String -> ParseResult Module

Parse of a string, which should contain a complete Haskell module.

parseModuleWithMode :: ParseMode -> String -> ParseResult Module

Parse of a string containing a complete Haskell module, using an explicit mode.

Extras

parseModuleWithSrc :: FilePath -> ParseMode -> IO ModuleSource

Parse a module from a source code file. It throws an error if parsing fails.