-- | Serialization support. This is mainly used for compatibility -- with whatever serialization library you want to use. module Data.CQRS.Serializable ( Serializable(..) ) where import Data.ByteString (ByteString) -- | Serialization support for values of type 'a'. class Serializable a where -- | 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. serialize :: a -> ByteString -- | De-serialize a value from a byte string. Should return -- 'Nothing' if decoding is not possible due to a now-invalid -- representation. deserialize :: ByteString -> Maybe a