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

Safe HaskellSafe-Inferred

Text.Chatty.Parser

Description

Provides the ChParser typeclass and some methods for input parsing.

Synopsis

Documentation

class ChScanner m => ChParser m whereSource

Typeclass for input parsing.

Methods

pabort :: m aSource

Abort the parse process.

(??) :: Eq a => m a -> m a -> m aSource

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 aSource

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 CharSource

An prettier alias for mscan1. It scans and removes the next available character.

match :: ChParser m => Char -> m CharSource

Scan the next character and abort if it does not match the given one.

matchs :: ChParser m => String -> m StringSource

Try to match all of the given characters. Abort otherwise.

white :: ChParser m => m CharSource

Try to match a whitespace. Abort otherwise.

digit :: ChParser m => m IntSource

Try to match a digit. Abort otherwise.

alpha :: ChParser m => m CharSource

Try to match a letter. Abort otherwise.

anum :: ChParser m => m CharSource

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 IntSource

Try to match a natural decimal number.

fract :: ChParser m => m DoubleSource

Try to match a fractional number.