binary-tagged: Tagged binary serialisation.
Structurally tag binary serialisation stream.
Say you have:
data Record = Record
{ _recordFields :: HM.HashMap Text (Integer, ByteString)
, _recordEnabled :: Bool
}
deriving (Eq, Show, Generic)
instance Binary Record
instance HasStructuralInfo Record
instance HasSemanticVersion Record
then you can serialise and deserialise Record values with a structure tag by simply
encodeTaggedFile "cachefile" record decodeTaggedFile "cachefile" :: IO Record
If structure of Record changes in between, deserialisation will fail early.
The overhead is next to non-observable, see a simple benchmark.
benchmarking encode/Binary time 362.6 μs (361.2 μs .. 363.8 μs) benchmarking encode/Tagged time 379.2 μs (375.5 μs .. 382.2 μs) benchmarking decode/Binary time 366.3 μs (365.1 μs .. 368.1 μs) benchmarking decode/Tagged time 367.6 μs (367.0 μs .. 368.2 μs)
Downloads
- binary-tagged-0.2.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 | aeson (>=0.8 && <1.5), array (>=0.5.0.0 && <0.6), base (>=4.7.0.2 && <4.14), base16-bytestring (>=0.1.1.6 && <0.2), binary (>=0.7.1.0 && <0.10), bytestring (>=0.10.4.0 && <0.11), containers (>=0.5.5.1 && <0.7), cryptohash-sha1 (>=0.11.100.1 && <0.12), generics-sop (>=0.3.2.0 && <0.6), hashable (>=1.2 && <1.4), nats (>=1.1.2 && <1.2), scientific (>=0.3 && <0.4), semigroups (>=0.18.5 && <0.20), tagged (>=0.7 && <0.9), text (>=1.2.3.0 && <1.3), time (>=1.4.2 && <1.10), unordered-containers (>=0.2 && <0.3), vector (>=0.10 && <0.13) [details] |
| Tested with | ghc ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1 |
| License | BSD-3-Clause |
| Author | Oleg Grenrus <oleg.grenrus@iki.fi> |
| Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
| Uploaded | by phadej at 2019-05-14T11:30:49Z |
| Revised | Revision 1 made by phadej at 2019-09-10T20:22:02Z |
| Category | Data |
| Home page | https://github.com/phadej/binary-tagged#readme |
| Bug tracker | https://github.com/phadej/binary-tagged/issues |
| Source repo | head: git clone https://github.com/phadej/binary-tagged |
| Distributions | Arch:0.3.1, Debian:0.2 |
| Reverse Dependencies | 3 direct, 5 indirect [details] |
| Downloads | 15609 total (45 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs available [build log] Last success reported on 2019-05-14 [all 1 reports] |