The latest version of binary-tagged is 0.3.1-4.

binary-tagged

Version 0.3 revision 2 uploaded by phadej.

Package meta

Synopsis
Tagged binary serialisation.
Description

Structurally tag binary serialisation stream.

Say you have:

Say you have a data type

data Record = Record
  { _recordFields  :: HM.HashMap Text (Integer, ByteString)
  , _recordEnabled :: Bool
  }
  deriving (Eq, Show, Generic)

instance Binary Record
instance Structured Record

then you can serialise and deserialise Record values with a structure tag by simply

structuredEncode record :: LBS.ByteString
structuredDecode lbs    :: IO Record

If structure of Record changes in between, deserialisation will fail early.

The overhead is next to non-observable.

benchmarking encode/Binary
time                 352.8 μs   (349.5 μs .. 355.9 μs)

benchmarking encode/Tagged
time                 350.8 μs   (349.0 μs .. 353.1 μs)

benchmarking decode/Binary
time                 346.8 μs   (344.7 μs .. 349.9 μs)

benchmarking decode/Tagged
time                 353.8 μs   (352.0 μs .. 355.8 μs)
Author
Oleg Grenrus <oleg.grenrus@iki.fi>
Bug reports
https://github.com/phadej/binary-tagged/issues
Category
Data
Copyright
n/a
Homepage
n/a
Maintainer
Oleg Grenrus <oleg.grenrus@iki.fi>
Package URL
n/a
Stability
n/a

Components