| Safe Haskell | Safe-Inferred |
|---|
Data.ByteString.Readable
- class Readable a where
- readByteString :: ByteString -> Either ByteString (a, ByteString)
- readByteStringList :: ByteString -> Either ByteString ([a], ByteString)
- fromByteString :: ByteString -> Either ByteString a
Documentation
The type-class Readable is used to convert ByteString values to
values of other types. Most instances assume the ByteString is
encoded via UTF-8.
Minimal complete instance definition is given by readByteString.
Methods
readByteString :: ByteString -> Either ByteString (a, ByteString)Source
Parse the given ByteString into a typed value and also return
the unconsumed bytes. In case of error, provide an error message.
readByteStringList :: ByteString -> Either ByteString ([a], ByteString)Source
Parse the given ByteString into a list of typed values and
return the unconsumed bytes. In case of error, provide an error
message. Instances can use this function to express their way of
reading lists of values. The default implementation parses
comma-separated values (also accepting interspersed spaces).
fromByteString :: ByteString -> Either ByteString aSource
Either turn the given ByteString into a typed value or an error
message. This function also checks, that all input bytes have been
consumed or else it will fail.