comparse-0.2.0.0: A highly generic parser combinators library.
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Parser

Synopsis

Documentation

newtype ParserT s m a Source #

Parser monad transformer.

Constructors

ParserT 

Fields

Instances

Instances details
(Stream s, MonadState s' m) => MonadState s' (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

get :: ParserT s m s' #

put :: s' -> ParserT s m () #

state :: (s' -> (a, s')) -> ParserT s m a #

(Stream s, MonadReader r m) => MonadReader r (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

ask :: ParserT s m r #

local :: (r -> r) -> ParserT s m a -> ParserT s m a #

reader :: (r -> a) -> ParserT s m a #

(Stream s, MonadError e m) => MonadError e (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

throwError :: e -> ParserT s m a #

catchError :: ParserT s m a -> (e -> ParserT s m a) -> ParserT s m a #

Stream s => MonadTrans (ParserT s) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

lift :: Monad m => m a -> ParserT s m a #

(Stream s, Monad m) => Monad (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

(>>=) :: ParserT s m a -> (a -> ParserT s m b) -> ParserT s m b #

(>>) :: ParserT s m a -> ParserT s m b -> ParserT s m b #

return :: a -> ParserT s m a #

Functor m => Functor (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

fmap :: (a -> b) -> ParserT s m a -> ParserT s m b #

(<$) :: a -> ParserT s m b -> ParserT s m a #

(Applicative m, Monad m, Stream s) => MonadFail (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

fail :: String -> ParserT s m a #

(Stream s, Applicative m, Monad m) => Applicative (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

pure :: a -> ParserT s m a #

(<*>) :: ParserT s m (a -> b) -> ParserT s m a -> ParserT s m b #

liftA2 :: (a -> b -> c) -> ParserT s m a -> ParserT s m b -> ParserT s m c #

(*>) :: ParserT s m a -> ParserT s m b -> ParserT s m b #

(<*) :: ParserT s m a -> ParserT s m b -> ParserT s m a #

(Stream s, MonadIO m) => MonadIO (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

liftIO :: IO a -> ParserT s m a #

(Stream s, MonadCont m) => MonadCont (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

callCC :: ((a -> ParserT s m b) -> ParserT s m a) -> ParserT s m a #

(Monad m, Stream s) => MonadParser (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Associated Types

type Input (ParserT s m) Source #

Methods

parseStream :: ParserT s m (Input (ParserT s m)) Source #

setParseStream :: Input (ParserT s m) -> ParserT s m () Source #

noParse :: ParserT s m a Source #

item :: ParserT s m (Item (Input (ParserT s m))) Source #

followedBy :: ParserT s m a -> ParserT s m () Source #

notFollowedBy :: ParserT s m a -> ParserT s m () Source #

try :: ParserT s m a -> ParserT s m a Source #

(<|>) :: ParserT s m a -> ParserT s m a -> ParserT s m a Source #

(<?>) :: ParserT s m a -> String -> ParserT s m a Source #

type Input (ParserT s m) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

type Input (ParserT s m) = s

data ParseResult v s Source #

Constructors

Parsed v s (ParseError (Pos s)) 
NoParse (ParseError (Pos s)) 

Instances

Instances details
(Show v, Show (Pos s)) => Show (ParseResult v s) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

Methods

showsPrec :: Int -> ParseResult v s -> ShowS #

show :: ParseResult v s -> String #

showList :: [ParseResult v s] -> ShowS #

data ParseError p Source #

Constructors

ParseError p [ErrorDesc] 

Instances

Instances details
Show p => Show (ParseError p) Source # 
Instance details

Defined in Control.Monad.Trans.Parser

data ErrorDesc Source #

Constructors

Expected String 
Note String 

Instances

Instances details
Eq ErrorDesc Source # 
Instance details

Defined in Control.Monad.Trans.Parser

type Parser s a = ParserT s Identity a Source #

type ParserOf i p = (MonadParser p, Item (Input p) ~ i) Source #

runParser :: Parser s a -> s -> ParseResult a s Source #