picoparsec-0.1.2.3: Fast combinator parsing for bytestrings and text

CopyrightBryan O'Sullivan 2011 Mario Blažević <blamario@yahoo.com> 2014
LicenseBSD3
Maintainerblamario@yahoo.com
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe
LanguageHaskell2010

Data.Picoparsec.Zepto

Description

A tiny, highly specialized combinator parser for monoidal inputs.

While the main Picoparsec module generally performs well, this module is particularly fast for simple non-recursive loops that should not normally result in failed parses.

Warning: on more complex inputs involving recursion or failure, parsers based on this module may be as much as ten times slower than regular Picoparsec! You should only use this module when you have benchmarks that prove that its use speeds your code up.

Synopsis

Documentation

data Parser t a #

A simple parser.

This monad is strict in its state, and the monadic bind operator (>>=) evaluates each result to weak head normal form before passing it along.

Instances

Monad (Parser t) # 

Methods

(>>=) :: Parser t a -> (a -> Parser t b) -> Parser t b #

(>>) :: Parser t a -> Parser t b -> Parser t b #

return :: a -> Parser t a #

fail :: String -> Parser t a #

Functor (Parser t) # 

Methods

fmap :: (a -> b) -> Parser t a -> Parser t b #

(<$) :: a -> Parser t b -> Parser t a #

Applicative (Parser t) # 

Methods

pure :: a -> Parser t a #

(<*>) :: Parser t (a -> b) -> Parser t a -> Parser t b #

(*>) :: Parser t a -> Parser t b -> Parser t b #

(<*) :: Parser t a -> Parser t b -> Parser t a #

Alternative (Parser t) # 

Methods

empty :: Parser t a #

(<|>) :: Parser t a -> Parser t a -> Parser t a #

some :: Parser t a -> Parser t [a] #

many :: Parser t a -> Parser t [a] #

MonadPlus (Parser t) # 

Methods

mzero :: Parser t a #

mplus :: Parser t a -> Parser t a -> Parser t a #

parse :: Parser t a -> t -> Either String a #

Run a parser.

atEnd :: MonoidNull t => Parser t Bool #

Indicate whether the end of the input has been reached.

string :: LeftReductiveMonoid t => t -> Parser t () #

Match a string exactly.

take :: FactorialMonoid t => Int -> Parser t t #

Consume n prime tokens of input.

takeCharsWhile :: TextualMonoid t => (Char -> Bool) -> Parser t t #

Consume input while the predicate returns True.

takeWhile :: FactorialMonoid t => (t -> Bool) -> Parser t t #

Consume input while the predicate returns True.