Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Two continuation parser combinators.
- data Parser s r
- data Result s ans
- type CharParser a = Parser Char a
- type CharResult a = Result Char a
- type ParseError = String
- runParser :: Parser s a -> [s] -> Result s a
- runParserEither :: Show s => Parser s a -> [s] -> Either ParseError a
- apply :: Functor f => f a -> (a -> b) -> f b
- failure :: Parser s a
- throwError :: String -> Parser s a
- (<?>) :: Parser s a -> String -> Parser s a
- lookahead :: Parser s a -> (a -> Parser s b) -> Parser s b
- peek :: Parser s a -> Parser s a
- eof :: Parser s ()
- equals :: Eq s => s -> Parser s s
- satisfy :: (s -> Bool) -> Parser s s
- oneOf :: Eq s => [s] -> Parser s s
- noneOf :: Eq s => [s] -> Parser s s
- chainl1 :: MonadPlus m => m a -> m (a -> a -> a) -> m a
- chainr1 :: MonadPlus m => m a -> m (a -> a -> a) -> m a
- chainl :: MonadPlus m => m a -> m (a -> a -> a) -> a -> m a
- chainr :: MonadPlus m => m a -> m (a -> a -> a) -> a -> m a
- choice :: Alternative f => [f a] -> f a
- count :: Applicative f => Int -> f a -> f [a]
- between :: Applicative f => f open -> f close -> f a -> f a
- option :: Alternative f => a -> f a -> f a
- optionMaybe :: Alternative f => f a -> f (Maybe a)
- optionUnit :: Alternative f => f a -> f ()
- skipOne :: Applicative f => f a -> f ()
- skipMany :: Alternative f => f a -> f ()
- skipMany1 :: Alternative f => f a -> f ()
- many1 :: Alternative f => f a -> f [a]
- sepBy :: Alternative f => f a -> f b -> f [a]
- sepBy1 :: Alternative f => f a -> f b -> f [a]
- sepEndBy :: Alternative f => f a -> f b -> f [a]
- sepEndBy1 :: Alternative f => f a -> f b -> f [a]
- manyTill :: Alternative f => f a -> f b -> f [a]
- manyTill1 :: Alternative f => f a -> f b -> f [a]
- char :: Char -> CharParser Char
- string :: String -> CharParser String
- anyChar :: CharParser Char
- upper :: CharParser Char
- lower :: CharParser Char
- letter :: CharParser Char
- alphaNum :: CharParser Char
- digit :: CharParser Char
- hexDigit :: CharParser Char
- octDigit :: CharParser Char
- newline :: CharParser Char
- tab :: CharParser Char
- space :: CharParser Char
Documentation
Monad (Parser s) | |
Functor (Parser s) | |
MonadPlus (Parser s) | |
Applicative (Parser s) | |
Alternative (Parser s) |
type CharParser a = Parser Char aSource
type CharResult a = Result Char aSource
type ParseError = StringSource
runParserEither :: Show s => Parser s a -> [s] -> Either ParseError aSource
throwError :: String -> Parser s aSource
lookahead :: Parser s a -> (a -> Parser s b) -> Parser s bSource
This one is from Chris Okasaki's "Even Higher-Order Functions for Parsing".
peek :: Parser s a -> Parser s aSource
Peek tries the supplied parse, but does not consume input ** even when the parse succeeds **.
choice :: Alternative f => [f a] -> f aSource
count :: Applicative f => Int -> f a -> f [a]Source
between :: Applicative f => f open -> f close -> f a -> f aSource
option :: Alternative f => a -> f a -> f aSource
optionMaybe :: Alternative f => f a -> f (Maybe a)Source
optionUnit :: Alternative f => f a -> f ()Source
skipOne :: Applicative f => f a -> f ()Source
skipMany :: Alternative f => f a -> f ()Source
skipMany1 :: Alternative f => f a -> f ()Source
many1 :: Alternative f => f a -> f [a]Source
sepBy :: Alternative f => f a -> f b -> f [a]Source
sepBy1 :: Alternative f => f a -> f b -> f [a]Source
sepEndBy :: Alternative f => f a -> f b -> f [a]Source
sepEndBy1 :: Alternative f => f a -> f b -> f [a]Source
manyTill :: Alternative f => f a -> f b -> f [a]Source
manyTill1 :: Alternative f => f a -> f b -> f [a]Source
Char parsers
char :: Char -> CharParser CharSource
string :: String -> CharParser StringSource