Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Reader a = Reader {}
- str :: IsString s => Reader s
- auto :: Read a => Reader a
- exists :: Reader Bool
- viaCodec :: HasCodec a => Reader a
- maybeReader :: (String -> Maybe a) -> Reader a
- eitherReader :: (String -> Either String a) -> Reader a
- commaSeparated :: Reader a -> Reader (NonEmpty a)
- commaSeparatedList :: Reader a -> Reader [a]
- commaSeparatedSet :: Ord a => Reader a -> Reader (Set a)
- runReader :: Reader a -> String -> Either String a
- renderCommaSeparated :: NonEmpty String -> String
- parseCommaSeparated :: String -> NonEmpty String
Documentation
Common readers
Constructing your own reader
Comma-separated readers
commaSeparated :: Reader a -> Reader (NonEmpty a) Source #
Turn a reader into one that parses comma separated values with that reader.
commaSeparatedList :: Reader a -> Reader [a] Source #
Like commaSeparated
but uses a list type.
Note that this will never parse the empty list, so prefer commaSeparated
if you want a more accurately typed function.
commaSeparatedSet :: Ord a => Reader a -> Reader (Set a) Source #
Like commaSeparated
but uses a set type.
Note that this will never parse the empty list, so prefer commaSeparated
if you want a more accurately typed function.
Note also that this function throws away any ordering information and ignores any duplicate values.