chatty-text-0.6.0.1: Provides some classes and types for dealing with text, using the fundaments of Chatty.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Chatty.Parser

Description

Provides the ChParser typeclass and some methods for input parsing.

Synopsis

Documentation

class ChScanner m => ChParser m where Source

Typeclass for input parsing.

Methods

pabort :: m a Source

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

Instances

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.

white :: ChParser m => m Char Source

Try to match a whitespace. Abort otherwise.

digit :: ChParser m => m Int Source

Try to match a digit. Abort otherwise.

alpha :: ChParser m => m Char Source

Try to match a letter. Abort otherwise.

anum :: ChParser m => m Char Source

Try to match a letter or digit. 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.

some :: ChParser m => m a -> m [a] Source

Try to run the given parsing function as often as possible, but at least once. Abort otherwise.

number :: ChParser m => m Int Source

Try to match a natural decimal number.

fract :: ChParser m => m Double Source

Try to match a fractional number.