haskell-src-1.0.4: Support for manipulating Haskell source code
Copyright(c) The GHC Team 1997-2000
LicenseBSD-3-Clause
MaintainerAndreas Abel
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

Language.Haskell.ParseMonad

Description

Monads for the Haskell parser and lexer.

Synopsis

Parsing

data P a Source #

Monad for parsing

Instances

Instances details
MonadFail P Source #

Since: 1.0.3.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

fail :: String -> P a #

Applicative P Source #

Since: 1.0.2.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

pure :: a -> P a #

(<*>) :: P (a -> b) -> P a -> P b #

liftA2 :: (a -> b -> c) -> P a -> P b -> P c #

(*>) :: P a -> P b -> P b #

(<*) :: P a -> P b -> P a #

Functor P Source #

Since: 1.0.2.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

fmap :: (a -> b) -> P a -> P b #

(<$) :: a -> P b -> P a #

Monad P Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

(>>=) :: P a -> (a -> P b) -> P b #

(>>) :: P a -> P b -> P b #

return :: a -> P a #

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

Instances details
Applicative ParseResult Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

pure :: a -> ParseResult a #

(<*>) :: ParseResult (a -> b) -> ParseResult a -> ParseResult b #

liftA2 :: (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c #

(*>) :: ParseResult a -> ParseResult b -> ParseResult b #

(<*) :: ParseResult a -> ParseResult b -> ParseResult a #

Functor ParseResult Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

fmap :: (a -> b) -> ParseResult a -> ParseResult b #

(<$) :: a -> ParseResult b -> ParseResult a #

Monad ParseResult Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

(>>=) :: ParseResult a -> (a -> ParseResult b) -> ParseResult b #

(>>) :: ParseResult a -> ParseResult b -> ParseResult b #

return :: a -> ParseResult a #

Monoid m => Monoid (ParseResult m) Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Monoid m => Semigroup (ParseResult m) Source #

Since: 1.0.3.0

Instance details

Defined in Language.Haskell.ParseMonad

Show a => Show (ParseResult a) Source # 
Instance details

Defined in Language.Haskell.ParseMonad

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

defaultParseMode :: ParseMode Source #

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

Lexing

data Lex r a Source #

Instances

Instances details
MonadFail (Lex r) Source #

Since: 1.0.3.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

fail :: String -> Lex r a #

Applicative (Lex r) Source #

Since: 1.0.2.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

pure :: a -> Lex r a #

(<*>) :: Lex r (a -> b) -> Lex r a -> Lex r b #

liftA2 :: (a -> b -> c) -> Lex r a -> Lex r b -> Lex r c #

(*>) :: Lex r a -> Lex r b -> Lex r b #

(<*) :: Lex r a -> Lex r b -> Lex r a #

Functor (Lex r) Source #

Since: 1.0.2.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

fmap :: (a -> b) -> Lex r a -> Lex r b #

(<$) :: a -> Lex r b -> Lex r a #

Monad (Lex r) Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

(>>=) :: Lex r a -> (a -> Lex r b) -> Lex r b #

(>>) :: Lex r a -> Lex r b -> Lex r b #

return :: a -> Lex r a #

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 #