Copyright | Bryan O'Sullivan 2011, Mario Blažević <blamario@yahoo.com> 2014 |
---|---|

License | BSD3 |

Maintainer | blamario@yahoo.com |

Stability | experimental |

Portability | unknown |

Safe Haskell | Safe-Inferred |

Language | Haskell2010 |

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.

- data Parser t a
- parse :: Parser t a -> t -> Either String a
- atEnd :: MonoidNull t => Parser t Bool
- string :: LeftReductiveMonoid t => t -> Parser t ()
- take :: FactorialMonoid t => Int -> Parser t t
- takeCharsWhile :: TextualMonoid t => (Char -> Bool) -> Parser t t
- takeWhile :: FactorialMonoid t => (t -> Bool) -> Parser t t

# Documentation

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.

Alternative (Parser t) | |

Monad (Parser t) | |

Functor (Parser t) | |

MonadPlus (Parser t) | |

Applicative (Parser t) |

atEnd :: MonoidNull t => Parser t Bool Source

Indicate whether the end of the input has been reached.

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

Match a string exactly.

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

Consume `n`

prime tokens of input.

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

Consume input while the predicate returns `True`

.