Portability | portable |
---|---|
Stability | experimental |
Maintainer | Niklas Broberg, [email protected] |
Language.Haskell.Exts.Parser
Description
- class Parseable ast where
- parse :: String -> ParseResult ast
- parseWithMode :: ParseMode -> String -> ParseResult ast
- parseModule :: String -> ParseResult Module
- parseModuleWithMode :: ParseMode -> String -> ParseResult Module
- parseExp :: String -> ParseResult Exp
- parseExpWithMode :: ParseMode -> String -> ParseResult Exp
- parsePat :: String -> ParseResult Pat
- parsePatWithMode :: ParseMode -> String -> ParseResult Pat
- parseDecl :: String -> ParseResult Decl
- parseDeclWithMode :: ParseMode -> String -> ParseResult Decl
- parseType :: String -> ParseResult Type
- parseTypeWithMode :: ParseMode -> String -> ParseResult Type
- getTopPragmas :: String -> ParseResult [OptionPragma]
- data ParseMode = ParseMode {
- parseFilename :: String
- extensions :: [Extension]
- ignoreLanguagePragmas :: Bool
- fixities :: [Fixity]
- defaultParseMode :: ParseMode
- data ParseResult a
- = ParseOk {
- unParseOk :: a
- | ParseFailed SrcLoc String
- = ParseOk {
Documentation
class Parseable ast whereSource
Class to reuse the parse function at many different types
Methods
parse :: String -> ParseResult astSource
parseWithMode :: ParseMode -> String -> ParseResult astSource
parseModule :: String -> ParseResult ModuleSource
Parse of a string, which should contain a complete Haskell module.
parseModuleWithMode :: ParseMode -> String -> ParseResult ModuleSource
Parse of a string, which should contain a complete Haskell 98 module.
parseExp :: String -> ParseResult ExpSource
Parse of a string containing a Haskell expression.
parseExpWithMode :: ParseMode -> String -> ParseResult ExpSource
Parse of a string, which should contain a complete Haskell 98 module.
parsePat :: String -> ParseResult PatSource
Parse of a string containing a Haskell pattern.
parsePatWithMode :: ParseMode -> String -> ParseResult PatSource
Parse of a string, which should contain a complete Haskell 98 module.
parseDecl :: String -> ParseResult DeclSource
Parse of a string containing a Haskell top-level declaration.
parseDeclWithMode :: ParseMode -> String -> ParseResult DeclSource
Parse of a string, which should contain a complete Haskell 98 module.
parseType :: String -> ParseResult TypeSource
Parse of a string containing a Haskell type.
parseTypeWithMode :: ParseMode -> String -> ParseResult TypeSource
Parse of a string, which should contain a complete Haskell 98 module.
getTopPragmas :: String -> ParseResult [OptionPragma]Source
Parse of a string starting with a series of top-level option pragmas.
Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.
Constructors
ParseMode | |
Fields
|
defaultParseMode :: ParseModeSource
Default parameters for a parse, currently just a marker for an unknown filename.
data ParseResult a Source
The result of a parse.
Constructors
ParseOk | The parse succeeded, yielding a value. |
Fields
| |
ParseFailed SrcLoc String | The parse failed at the specified source location, with an error message. |
Instances
Monad ParseResult | |
Functor ParseResult | |
Applicative ParseResult | |
Show a => Show (ParseResult a) | |
Monoid m => Monoid (ParseResult m) |