Safe Haskell | None |
---|
Serialization support. This is mainly used for compatibility with whatever serialization library you want to use.
- class Serializable a where
- serialize :: a -> ByteString
- deserialize :: ByteString -> Maybe a
Documentation
class Serializable a whereSource
Serialization support for values of type a
.
serialize :: a -> ByteStringSource
Serialize a value. The serialized representation should contain some metadata (a UUID for example) which can be used to check reliably whether the encoded representation is semantically valid upon decoding.
deserialize :: ByteString -> Maybe aSource
De-serialize a value from a byte string. Should return
Nothing
if decoding is not possible due to a now-invalid
representation.
Serializable GUID | Serialize instance. |