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

Copyright(c) The GHC Team, 1997-2000
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

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 a Source

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 :: ParseMode Source

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

Lexing

data Lex r a Source

Instances

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

setBOL :: Lex a () Source