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

Portabilityportable
Stabilityexperimental
Maintainerlibraries@haskell.org
Safe HaskellNone

Language.Haskell.ParseMonad

Contents

Description

Monads for the Haskell parser and lexer.

Synopsis

Parsing

data P a Source

Monad for parsing

Instances

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.

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

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.

Lexing

data Lex r a Source

Instances

Monad (Lex r) 

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.

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