Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides the ChParser typeclass and some methods for input parsing.
- class ChScanner m => ChParser m where
- request :: ChScanner m => m Char
- match :: ChParser m => Char -> m Char
- matchs :: ChParser m => String -> m String
- white :: ChParser m => m Char
- digit :: ChParser m => m Int
- alpha :: ChParser m => m Char
- anum :: ChParser m => m Char
- possibly :: ChParser m => m a -> m (Maybe a)
- many :: ChParser m => m a -> m [a]
- some :: ChParser m => m a -> m [a]
- number :: ChParser m => m Int
- fract :: ChParser m => m Double
Documentation
class ChScanner m => ChParser m where Source
Typeclass for input parsing.
Abort the parse process.
(??) :: Eq a => m a -> m a -> m a Source
Provide an alternative if the first choice fails. This version nubs the available forks and thus only works with instances of Eq
.
(???) :: m a -> m a -> m a Source
Provide an alternative if the first choice fails. This version works for everything, but you should use ??
whenever possible.
ptry :: MonadPlus n => m a -> m (n a) Source
Find all/one solution(s) for the given parsing function
request :: ChScanner m => m Char Source
An prettier alias for mscan1
. It scans and removes the next available character.
match :: ChParser m => Char -> m Char Source
Scan the next character and abort if it does not match the given one.
matchs :: ChParser m => String -> m String Source
Try to match all of the given characters. Abort otherwise.
possibly :: ChParser m => m a -> m (Maybe a) Source
Try to run the given parsing function. Return Nothing
otherwise.
many :: ChParser m => m a -> m [a] Source
Try to run the given parsing function as often as possible.