Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Turning strings into things
Synopsis
- data ParserT s m a
- data ParseError s
- runParserT :: ParserT s m a -> [s] -> m (Either [ParseError s] (a, [s]))
- sat :: Applicative m => (s -> Bool) -> ParserT s m s
- item :: Applicative m => ParserT s m s
- symbol :: (Applicative m, Eq s) => s -> ParserT s m s
- string :: (Monad m, Traversable t, Eq s) => t s -> ParserT s m (t s)
- oneOf :: (Applicative m, Foldable t, Eq s) => t s -> ParserT s m s
- noneOf :: (Applicative m, Foldable t, Eq s) => t s -> ParserT s m s
- sepBy :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
- sepBy1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
- endBy :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
- endBy1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a]
- between :: Monad m => ParserT s m open -> ParserT s m close -> ParserT s m a -> ParserT s m a
- option :: (Monad m, Eq s) => a -> ParserT s m a -> ParserT s m a
Types
A monad for parsing symbols of type s with inner monad m and return type a
data ParseError s Source #
Abstract representation of a parse error for symbols of type s
Instances
Show s => Show (ParseError s) Source # | |
Defined in Mini.Transformers.ParserT showsPrec :: Int -> ParseError s -> ShowS # show :: ParseError s -> String # showList :: [ParseError s] -> ShowS # |
Runners
runParserT :: ParserT s m a -> [s] -> m (Either [ParseError s] (a, [s])) Source #
Unwrap a ParserT
given a string of symbols
Parsers
sat :: Applicative m => (s -> Bool) -> ParserT s m s Source #
From a predicate to a parser for symbols satisfying the predicate
digit = sat Data.Char.isDigit spaces = Control.Applicative.many $ sat Data.Char.isSpace
item :: Applicative m => ParserT s m s Source #
A parser for any symbol
string :: (Monad m, Traversable t, Eq s) => t s -> ParserT s m (t s) Source #
A parser for the given string of symbols
oneOf :: (Applicative m, Foldable t, Eq s) => t s -> ParserT s m s Source #
A parser for any of the given symbols
noneOf :: (Applicative m, Foldable t, Eq s) => t s -> ParserT s m s Source #
A parser for any symbol excluding the given symbols
Combinators
sepBy :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a] Source #
Turn a parser and another parser into a parser for zero or more of the former separated by the latter
sepBy1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a] Source #
Turn a parser and another parser into a parser for one or more of the former separated by the latter
endBy :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a] Source #
Turn a parser and another parser into a parser for zero or more of the former separated and ended by the latter
endBy1 :: (Monad m, Eq s) => ParserT s m a -> ParserT s m b -> ParserT s m [a] Source #
Turn a parser and another parser into a parser for one or more of the former separated and ended by the latter