The latest version of binary-tagged is 0.3.1-4.
binary-tagged
Version 0.2 revision 0 uploaded by phadej.
Package meta
- Synopsis
- Tagged binary serialisation.
- Description
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 simplyencodeTaggedFile "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)
- Author
- Oleg Grenrus <oleg.grenrus@iki.fi>
- Bug reports
- https://github.com/phadej/binary-tagged/issues
- Category
- Data
- Copyright
- n/a
- Homepage
- https://github.com/phadej/binary-tagged#readme
- Maintainer
- Oleg Grenrus <oleg.grenrus@iki.fi>
- Package URL
- n/a
- Stability
- n/a