Safe Haskell | None |
---|---|
Language | Haskell98 |
- tryRead :: (Read a, Stream s m Char) => String -> ParsecT s st m a
- tryReadInt :: (Stream s m Char, Num a) => String -> ParsecT s st m a
- times :: Stream s m Char => Int -> ParsecT s st m t -> ParsecT s st m [t]
- number :: (Stream s m Char, Num a, Ord a) => Int -> a -> ParsecT s st m a
- pYear :: Stream s m Char => ParsecT s st m Int
- pMonth :: Stream s m Char => ParsecT s st m Month
- pDay :: Stream s m Char => ParsecT s st m Int
- uppercase :: String -> String
- isPrefixOfI :: String -> String -> Bool
- uniqFuzzyMatch :: (Bounded a, Enum a, Show a) => String -> Either [a] a
Documentation
tryRead :: (Read a, Stream s m Char) => String -> ParsecT s st m a Source
Parser version of Prelude.read
times :: Stream s m Char => Int -> ParsecT s st m t -> ParsecT s st m [t] Source
Apply parser N times
Parse natural number of N digits which is not greater than M
isPrefixOfI :: String -> String -> Bool Source
Case-insensitive version of isPrefixOf
:: (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