attoparsec- Fast combinator parsing for bytestrings and text

CopyrightBryan O'Sullivan 2007-2015
Safe HaskellTrustworthy



A tiny, highly specialized combinator parser for ByteString strings.

While the main attoparsec 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 attoparsec! You should only use this module when you have benchmarks that prove that its use speeds your code up.



data ZeptoT m a Source

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.


Monad m => Alternative (ZeptoT m) 
Monad m => Monad (ZeptoT m) 
Monad m => Functor (ZeptoT m) 
Monad m => MonadPlus (ZeptoT m) 
Monad m => Applicative (ZeptoT m) 
MonadIO m => MonadIO (ZeptoT m) 
Monad m => Monoid (ZeptoT m a) 

parse :: Parser a -> ByteString -> Either String a Source

Run a parser.

parseT :: Monad m => ZeptoT m a -> ByteString -> m (Either String a) Source

Run a parser on top of the given base monad.

atEnd :: Monad m => ZeptoT m Bool Source

Indicate whether the end of the input has been reached.

string :: Monad m => ByteString -> ZeptoT m () Source

Match a string exactly.

take :: Monad m => Int -> ZeptoT m ByteString Source

Consume n bytes of input.

takeWhile :: Monad m => (Word8 -> Bool) -> ZeptoT m ByteString Source

Consume input while the predicate returns True.