fuzzy-dates-0.1.0.0

Safe HaskellNone
LanguageHaskell2010

Data.Dates.Parsing.Internal

Synopsis

Documentation

takeN1 :: Stream s m Char => Int -> ParsecT s st m a -> ParsecT s st m [a] Source #

Parsers the parser at least once, but no more than n times.

number Source #

Arguments

:: (Stream s m Char, Read a, Num a, Ord a) 
=> Int

Number of digits

-> a

Maximum value

-> ParsecT s st m a 

Parse natural number of N digits which is not greater than M

pYear :: Stream s m Char => ParsecT s st m Int Source #

readNum :: (Num a, Stream s m Char) => ParsecT s st m a Source #

parseAs :: Stream s m Char => [String] -> String -> ParsecT s st m String Source #

Parse various capitalizations of the given string, but always return the same string on success.

pDay :: Stream s m Char => ParsecT s st m Int Source #

isPrefixOfI :: String -> String -> Bool Source #

Case-insensitive version of isPrefixOf

uniqFuzzyMatch Source #

Arguments

:: (Bounded a, Enum a, Show a) 
=> String 
-> Either [a] a

Either collection of matches or the unique match

Use a data type's Bounded, Enum and Show instances to determine if the given string uniquely matches a constructor. The comparison is case-insensitive and starts from the beginning of the strings (so a partial constructor name can still match if there are enough characters for a unique match)

For example:

 data Things = Foo | Bar | Baz deriving (Bounded, Enum, Show)

 -- Right Foo
 uniqFuzzyMatch "f" :: Either [Things] Things

 -- Left [Bar, Baz]
 uniqFuzzyMatch "ba" :: Either [Things] Things