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'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
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.20), 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 || >=0.12.0.2 && <0.13), containers (>=0.5.5.1 && <0.7), structured (>=0.1.1 && <0.1.2), tagged (>=0.8.6 && <0.9) [details] |
Tested with | ghc ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.7 || ==9.6.3 || ==9.8.1 |
License | BSD-3-Clause |
Author | Oleg Grenrus <oleg.grenrus@iki.fi> |
Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
Revised | Revision 4 made by phadej at 2023-10-25T12:48:11Z |
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 |
Reverse Dependencies | 3 direct, 5 indirect [details] |
Downloads | 15052 total (44 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] |