Module

Text.Parsing.Parser

Package
purescript-parsing
Repository
purescript-contrib/purescript-parsing

#ParseError Source

data ParseError

A parsing error, consisting of a message and position information.

Constructors

Instances

#ParseState Source

data ParseState s

Contains the remaining input and current position.

Constructors

Instances

#ParserT Source

newtype ParserT s m a

The Parser monad transformer.

The first type argument is the stream type. Typically, this is either String, or some sort of token stream.

Constructors

Instances

#Parser Source

type Parser s = ParserT s Identity

The Parser monad is a synonym for the parser monad transformer applied to the Identity monad.

#runParser Source

runParser :: forall a s. s -> Parser s a -> Either ParseError a

Apply a parser, keeping only the parsed result.

#runParserT Source

runParserT :: forall a s m. Monad m => s -> ParserT s m a -> m (Either ParseError a)

Apply a parser, keeping only the parsed result.

#hoistParserT Source

hoistParserT :: forall a n m s. (m ~> n) -> ParserT s m a -> ParserT s n a

#mapParserT Source

mapParserT :: forall m a s n b. (m (Tuple (Either ParseError a) (ParseState s)) -> n (Tuple (Either ParseError b) (ParseState s))) -> ParserT s m a -> ParserT s n b

Change the underlying monad action and data type in a ParserT monad action.

#consume Source

consume :: forall m s. Monad m => ParserT s m Unit

Set the consumed flag.

#position Source

position :: forall m s. Monad m => ParserT s m Position

Returns the current position in the stream.

#fail Source

fail :: forall a s m. Monad m => String -> ParserT s m a

Fail with a message.

#failWithPosition Source

failWithPosition :: forall a s m. Monad m => String -> Position -> ParserT s m a

Fail with a message and a position.