pipes-cereal-0.1.0.0: Encode and decode binary streams using the pipes and cereal libraries.

Safe HaskellNone
LanguageHaskell2010

Pipes.Cereal

Synopsis

Documentation

encode :: (Serialize a, Monad m) => a -> Producer' ByteString m () Source

Encode a value to a byte stream.

encodePut :: Monad m => Put -> Producer' ByteString m () Source

Encode an explicit Put.

decode :: (Serialize a, Monad m) => Parser ByteString m (Either String a) Source

Decode a value from a byte stream.

decodeGet :: Monad m => Get a -> Parser ByteString m (Either String a) Source

Decode a value using an explicit Get.

type Put = PutM ()

Put merely lifts Builder into a Writer monad, applied to ().

data Get a :: * -> *

The Get monad is an Exception and State monad.

class Serialize t

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.

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 All 
Serialize Any 
Serialize ByteString 
Serialize ByteString 
Serialize IntSet 
Serialize a => Serialize [a] 
(Serialize a, Integral a) => Serialize (Ratio a) 
Serialize a => Serialize (Dual a) 
Serialize a => Serialize (Sum a) 
Serialize a => Serialize (Product a) 
Serialize a => Serialize (First a) 
Serialize a => Serialize (Last a) 
Serialize a => Serialize (Maybe a) 
Serialize e => Serialize (IntMap e) 
(Ord a, Serialize a) => Serialize (Set a) 
Serialize e => Serialize (Tree e) 
Serialize e => Serialize (Seq e) 
(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)