binary-tagged: Tagged binary serialisation.

[ bsd3, data, library ] [ Propose Tags ]

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)
Versions [faq] 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.1.3.0, 0.1.3.1, 0.1.4.0, 0.1.4.1, 0.1.4.2, 0.1.5, 0.1.5.1, 0.1.5.2, 0.2, 0.3
Change log CHANGELOG.md
Dependencies array (>=0.5.0.0 && <0.6), base (>=4.7.0.2 && <4.15), base16-bytestring (>=0.1.1.6 && <0.2 || >=1.0.0.0 && <1.1), binary (>=0.7.1.0 && <0.10), bytestring (>=0.10.4.0 && <0.11), containers (>=0.5.5.1 && <0.7), structured (>=0.1 && <0.1.1), tagged (>=0.8.6 && <0.9) [details]
License BSD-3-Clause
Author Oleg Grenrus <oleg.grenrus@iki.fi>
Maintainer Oleg Grenrus <oleg.grenrus@iki.fi>
Revised Revision 1 made by phadej at 2020-10-01T16:24:06Z
Category Data
Bug tracker https://github.com/phadej/binary-tagged/issues
Source repo head: git clone https://github.com/phadej/binary-tagged(binary-tagged)
Uploaded by phadej at 2020-05-16T15:17:44Z
Distributions Arch:0.3, Debian:0.1.5, LTSHaskell:0.1.5.2, NixOS:0.3, Stackage:0.2
Downloads 11516 total (237 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-05-16 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees