cereal-0.3.5.1: A binary serialization library

StabilityPortability :
MaintainerTrevor Elliott <trevor@galois.com>
Safe HaskellSafe-Infered

Data.Serialize

Contents

Description

 

Synopsis

The Serialize class

class Serialize t whereSource

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 Generic clause to your datatype and declare a Serialize instance for it without giving a definition for put and get.

Methods

put :: Putter tSource

Encode a value in the Put monad.

get :: Get tSource

Decode a value in the Get monad

Instances

Serialize Bool 
Serialize Char 
Serialize Double 
Serialize Float 
Serialize Int 
Serialize Int8 
Serialize Int16 
Serialize Int32 
Serialize Int64 
Serialize Integer 
Serialize Ordering 
Serialize Word 
Serialize Word8 
Serialize Word16 
Serialize Word32 
Serialize Word64 
Serialize () 
Serialize ByteString 
Serialize ByteString 
Serialize IntSet 
Serialize a => Serialize [a] 
(Serialize a, Integral a) => Serialize (Ratio a) 
Serialize a => Serialize (Maybe a) 
Serialize e => Serialize (Tree e) 
Serialize e => Serialize (Seq e) 
Serialize e => Serialize (IntMap e) 
(Ord a, Serialize a) => Serialize (Set a) 
(Serialize a, Serialize b) => Serialize (Either a b) 
(Serialize a, Serialize b) => Serialize (a, b) 
(Serialize i, Ix i, Serialize e, IArray UArray e) => Serialize (UArray i e) 
(Serialize i, Ix i, Serialize e) => Serialize (Array i e) 
(Ord k, Serialize k, Serialize e) => Serialize (Map k e) 
(Serialize a, Serialize b, Serialize c) => Serialize (a, b, c) 
(Serialize a, Serialize b, Serialize c, Serialize d) => Serialize (a, b, c, d) 
(Serialize a, Serialize b, Serialize c, Serialize d, Serialize e) => Serialize (a, b, c, d, e) 
(Serialize a, Serialize b, Serialize c, Serialize d, Serialize e, Serialize f) => Serialize (a, b, c, d, e, f) 
(Serialize a, Serialize b, Serialize c, Serialize d, Serialize e, Serialize f, Serialize g) => Serialize (a, b, c, d, e, f, g) 
(Serialize a, Serialize b, Serialize c, Serialize d, Serialize e, Serialize f, Serialize g, Serialize h) => Serialize (a, b, c, d, e, f, g, h) 
(Serialize a, Serialize b, Serialize c, Serialize d, Serialize e, Serialize f, Serialize g, Serialize h, Serialize i) => Serialize (a, b, c, d, e, f, g, h, i) 
(Serialize a, Serialize b, Serialize c, Serialize d, Serialize e, Serialize f, Serialize g, Serialize h, Serialize i, Serialize j) => Serialize (a, b, c, d, e, f, g, h, i, j) 

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.