Stability | Portability : |
---|---|
Maintainer | Trevor Elliott <trevor@galois.com> |
Safe Haskell | Safe-Infered |
- class Serialize t where
- encode :: Serialize a => a -> ByteString
- encodeLazy :: Serialize a => a -> ByteString
- decode :: Serialize a => ByteString -> Either String a
- decodeLazy :: Serialize a => ByteString -> Either String a
- module Data.Serialize.Get
- module Data.Serialize.Put
- module Data.Serialize.IEEE754
The Serialize class
If your compiler has support for the DeriveGeneric
and
DefaultSignatures
language extensions (ghc >= 7.2.1
), the put
and get
methods will have default generic implementations.
To use this option, simply add a deriving
clause to your datatype
and declare a Generic
Serialize
instance for it without giving a definition for
put
and get
.
Encode a value in the Put monad.
Decode a value in the Get monad
Serialize serialisation
encode :: Serialize a => a -> ByteStringSource
Encode a value using binary serialization to a strict ByteString.
encodeLazy :: Serialize a => a -> ByteStringSource
Encode a value using binary serialization to a lazy ByteString.
decode :: Serialize a => ByteString -> Either String aSource
Decode a value from a strict ByteString, reconstructing the original structure.
decodeLazy :: Serialize a => ByteString -> Either String aSource
Decode a value from a lazy ByteString, reconstructing the original structure.
module Data.Serialize.Get
module Data.Serialize.Put
module Data.Serialize.IEEE754