haskell-src-1.0.1.5: Support for manipulating Haskell source code

Portabilityportable
Stabilityexperimental
Maintainer[email protected]
Safe HaskellNone

Language.Haskell.ParseMonad

Contents

Description

Monads for the Haskell parser and lexer.

Synopsis

Parsing

data P a Source

Monad for parsing

Instances

Monad P 

data ParseResult a Source

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.

Instances

Monad ParseResult 
Functor ParseResult 
Applicative ParseResult 
Show a => Show (ParseResult a) 
Monoid m => Monoid (ParseResult m) 

atSrcLoc :: P a -> SrcLoc -> P aSource

data LexContext Source

Constructors

NoLayout 
Layout Int 

Instances

data ParseMode Source

Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.

Constructors

ParseMode 

Fields

parseFilename :: String

original name of the file being parsed

defaultParseMode :: ParseModeSource

Default parameters for a parse, currently just a marker for an unknown filename.

runParser :: P a -> String -> ParseResult aSource

Lexing

data Lex r a Source

Instances

Monad (Lex r) 

getInput :: Lex r StringSource

discard :: Int -> Lex r ()Source

Discard some input characters (these must not include tabs or newlines).

lexNewline :: Lex a ()Source

Discard the next character, which must be a newline.

lexTab :: Lex a ()Source

Discard the next character, which must be a tab.

lexWhile :: (Char -> Bool) -> Lex a StringSource

alternative :: Lex a v -> Lex a (Lex a v)Source

getOffside :: Lex a OrderingSource

popContextL :: String -> Lex a ()Source