Data.Serialize

cereal-0.3.0.0: A binary serialization library

Stability | Portability :
Maintainer | Trevor Elliott <trevor@galois.com>

Data.Serialize

Contents

- The Serialize class
- Serialize serialisation

Description

Synopsis

- class Serialize t where
  - put :: Putter t
  - get :: Get t
- encode :: Serialize a => a -> ByteString
- decode :: Serialize a => ByteString -> Either String a
- module Data.Serialize.Get
- module Data.Serialize.Put

# The Serialize class

class Serialize t where

Methods

put :: Putter t

Encode a value in the Put monad.

get :: Get t

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 -> ByteString

Encode a value using binary serialisation to a strict ByteString.

decode :: Serialize a => ByteString -> Either String a

Decode a value from a strict ByteString, reconstructing the original structure.

module Data.Serialize.Get

module Data.Serialize.Put