Copyright | (C) 2015 Oleg Grenrus |
---|---|
License | BSD3 |
Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
Safe Haskell | None |
Language | Haskell2010 |
- class Binary t where
- module Data.Binary
Class re-export
The Binary
class provides put
and get
, methods to encode and
decode a Haskell value to a lazy ByteString
. It mirrors the Read
and
Show
classes for textual representation of Haskell types, and is
suitable for serialising Haskell values to disk, over the network.
For decoding and generating simple external binary formats (e.g. C
structures), Binary may be used, but in general is not suitable
for complex protocols. Instead use the Put
and Get
primitives
directly.
Instances of Binary should satisfy the following property:
decode . encode == id
That is, the get
and put
methods should be the inverse of each
other. A range of instances are provided for basic Haskell types.
Encode a value in the Put monad.
Decode a value in the Get monad
Encode a list of values in the Put monad. The default implementation may be overridden to be more efficient but must still have the same encoding format.
Module re-export
module Data.Binary
Orphan instances
Binary UTCTime Source # | |
Binary Value Source # | |
Binary All Source # | Since: binary-orphans-0.1.1.0 |
Binary Any Source # | Since: binary-orphans-0.1.1.0 |
Binary AbsoluteTime Source # | Since: binary-orphans-0.1.4.0 |
Binary LocalTime Source # | |
Binary ZonedTime Source # | Since: binary-orphans-0.1.8.0 |
Binary TimeOfDay Source # | |
Binary TimeZone Source # | |
Binary NominalDiffTime Source # | |
Binary Day Source # | |
Binary UniversalTime Source # | |
Binary DiffTime Source # | |
Binary a => Binary (Min a) Source # | Since: binary-orphans-0.1.3.0 |
Binary a => Binary (Max a) Source # | Since: binary-orphans-0.1.3.0 |
Binary a => Binary (First a) Source # | Since: binary-orphans-0.1.3.0 |
Binary a => Binary (Last a) Source # | Since: binary-orphans-0.1.3.0 |
Binary m => Binary (WrappedMonoid m) Source # | Since: binary-orphans-0.1.5.0 |
Binary a => Binary (Option a) Source # | Since: binary-orphans-0.1.3.0 |
Binary a => Binary (NonEmpty a) Source # | Since: binary-orphans-0.1.3.0 |
Binary a => Binary (Dual a) Source # | Since: 0.1.1.0 |
Binary a => Binary (Sum a) Source # | Since: binary-orphans-0.1.1.0 |
Binary a => Binary (Product a) Source # | Since: binary-orphans-0.1.1.0 |
Binary a => Binary (First a) Source # | Since: binary-orphans-0.1.1.0 |
Binary a => Binary (Last a) Source # | Since: binary-orphans-0.1.1.0 |
(FoldCase a, Binary a) => Binary (CI a) Source # | Since: binary-orphans-0.1.5.0 |
(Hashable a, Binary a) => Binary (Hashed a) Source # | |
(Hashable v, Eq v, Binary v) => Binary (HashSet v) Source # | |
(Hashable k, Eq k, Binary k, Binary v) => Binary (HashMap k v) Source # | |
(Binary a, Binary b) => Binary (Arg a b) Source # | Since: binary-orphans-0.1.5.0 |
Binary (f a) => Binary (Alt k f a) Source # | Since: binary-orphans-0.1.5.0 |
Binary b => Binary (Tagged k s b) Source # | |