DTC- Data To Class transformation.

Safe HaskellNone




All you need to parse a module.


From Language.Haskell.Exts.Parser

data ParseResult a

The result of a parse.


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.




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 :: Maybe [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.


parseModuleWithSrc :: FilePath -> ParseMode -> IO ModuleSource

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