tagged-binary

Provides tools for serializing data tagged with type information.

LTS Haskell 22.36:0.2.0.1
Stackage Nightly 2024-10-05:0.2.0.1
Latest on Hackage:0.2.0.1

See all snapshots tagged-binary appears in

MIT licensed and maintained by Justin Le
This version can be pinned in stack with:tagged-binary-0.2.0.1@sha256:8107b1a32ffba4b8b6afcd246ff83b72f19dfa30d7172bee745d2921ec75fd93,2580

Module documentation for 0.2.0.1

tagged-binary

tagged-binary on Hackage tagged-binary on Stackage LTS tagged-binary on Stackage Nightly Build Status

Very minimal (Haskell) library providing tools for serializing and decoding data into ByteString tagged with information about its type, inspired by Cloud Haskell and distributed-process.

Intended for use by libraries and frameworks in distributed contexts, such as distributed computation between native servers and communication between native servers and ghcjs/various front-ends, for behavior similar to the polymorphic communication channels of Cloud Haskell and distributed-process; servers can send tagged data, and clients can choose to selectively accept, ignore or queue incoming messages depending on their types.

For basic encoding and decoding, only Data.Binary.Tagged should be necessary. Data.Binary.Tagged.Internal is exported in case you need it.

Quick example

> let x = encodeTagged (1 :: Int)
> decodeTagged x :: Maybe Bool
Nothing
> decodeTagged x :: Maybe Int
Just 1

Copyright

Copyright (c) 2015 Justin Le

Changes

0.2.0.1

https://github.com/mstksg/tagged-binary/releases/tag/v0.2.0.1

  • Compatibility with base-4.10 and ghc 8.2.

0.2.0.0

https://github.com/mstksg/tagged-binary/releases/tag/v0.2.0.0

  • Removed Default instance on TagFingerprint in favor of just a normal emptyTagFP function. This is a breaking change, and is the reason for the “major” version bump.
  • Fixed bug on decoding badly formatted binary due to unexpected laziness.
  • Removed dependency on data-default and spoon packages.
  • Removed upper version bounds for all dependencies except for base.

0.1.2.0

https://github.com/mstksg/tagged-binary/releases/tag/v0.1.2.0

  • Tagged ByteStrings now lead with a “TagLead” byte sequence that signifies that a Tagged is coming. For now, it is statically 0xfe 0xff, which are two bytes that are never found in any valid UTF-8 encoded string.
  • So that all TagFingerprints should be of the same length, TagFingerprints contain an MD5Digest, generated from the name of the type. Its Default instance is the MD5Digest of an empty string.

0.1.0.0

https://github.com/mstksg/tagged-binary/releases/tag/v0.1.0.0

  • Initial version.