@hackage binary-tagged0.1.5.2
Tagged binary serialisation.
Categories
License
BSD-3-Clause
Maintainer
Oleg Grenrus <oleg.grenrus@iki.fi>
Links
Versions
Installation
Tested Compilers
Dependencies (18)
Dependents (3)
@hackage/stack, @hackage/flowdock-rest, @hackage/stackage-curator
binary-tagged
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 and the results.