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

Language.Haskell.ParseMonad

Description

Monads for the Haskell parser and lexer.

Synopsis

Parsing

data P a Source #

Monad for parsing

Instances

Instances details
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

MonadFail P Source #

Since: 1.0.3.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

fail :: String -> 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

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

Methods

(<>) :: ParseResult m -> ParseResult m -> ParseResult m

sconcat :: NonEmpty (ParseResult m) -> ParseResult m

stimes :: Integral b => b -> ParseResult m -> ParseResult m

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

Defined in Language.Haskell.ParseMonad

Methods

showsPrec :: Int -> ParseResult a -> ShowS

show :: ParseResult a -> String

showList :: [ParseResult a] -> ShowS

atSrcLoc :: P a -> SrcLoc -> P a Source #

data LexContext Source #

Constructors

NoLayout 
Layout Int 

Instances

Instances details
Show LexContext Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

showsPrec :: Int -> LexContext -> ShowS

show :: LexContext -> String

showList :: [LexContext] -> ShowS

Eq LexContext Source # 
Instance details

Defined in Language.Haskell.ParseMonad

Methods

(==) :: LexContext -> LexContext -> Bool

(/=) :: LexContext -> LexContext -> Bool

Ord LexContext Source # 
Instance details

Defined in Language.Haskell.ParseMonad

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.

runParser :: P a -> String -> ParseResult a Source #

Lexing

data Lex r a Source #

Instances

Instances details
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

MonadFail (Lex r) Source #

Since: 1.0.3.0

Instance details

Defined in Language.Haskell.ParseMonad

Methods

fail :: String -> Lex r a

getInput :: Lex r String Source #

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 String Source #

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

checkBOL :: Lex a Bool Source #

setBOL :: Lex a () Source #

getOffside :: Lex a Ordering Source #

popContextL :: String -> Lex a () Source #