fuzzy-dates- Libary for parsing dates in strings in varied formats.

Safe HaskellNone




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 #


:: (Stream s m Char, Integral a, Show 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 #


:: (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