binary-tagged: Tagged binary serialisation.
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) instanceBinary
Record instanceStructured
Record
then you can serialise and deserialise Record
values with a structure tag by simply
structuredEncode
record :: LBS.ByteStringstructuredDecode
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)
Downloads
- binary-tagged-0.3.1.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
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'.
Versions [RSS] | 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, 0.3.1 |
---|---|
Change log | CHANGELOG.md |
Dependencies | array (>=0.5.0.0 && <0.6), base (>=4.7.0.2 && <4.17), 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.12), containers (>=0.5.5.1 && <0.7), structured (>=0.1.1 && <0.1.2), 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 2021-12-17T21:58:34Z |
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 2021-10-09T20:49:20Z |
Distributions | Arch:0.3.1, Debian:0.2, LTSHaskell:0.3.1, NixOS:0.3.1, Stackage:0.3.1 |
Downloads | 13840 total (88 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2021-10-09 [all 1 reports] |