Maintainer | bastiaan.heeren@ou.nl |
---|---|

Stability | provisional |

Portability | portable (depends on ghc) |

Safe Haskell | Safe |

Language | Haskell98 |

This module defines the parser interface. It consists of three type classes: ParseState, Parse and ParseLog. These three type classes expose the parsing primitives necessary to be implemented by any parser. Although both ParseState and ParseLog are optional, Parse is not.

## Synopsis

- class (Monad m, Alternative m) => Parse m s | m -> s where
- (|>) :: m a -> m a -> m a
- satisfyWith :: (s -> Maybe a) -> m a
- withInputList :: ([s] -> [a]) -> m a

- safePeek :: Parse m s => m (Maybe s)
- option :: Parse m s => m a -> m (Maybe a)
- satisfy :: Parse m s => (s -> Bool) -> m s
- guardBy :: (MonadState st m, Alternative m) => (st -> Bool) -> m ()
- class ParseLog m where

# Documentation

class (Monad m, Alternative m) => Parse m s | m -> s where Source #

Interface for the basic parsing primitives

(|>) :: m a -> m a -> m a infixl 3 Source #

satisfyWith :: (s -> Maybe a) -> m a Source #

withInputList :: ([s] -> [a]) -> m a Source #

guardBy :: (MonadState st m, Alternative m) => (st -> Bool) -> m () Source #