https://github.com/quchen/binary-typed
Thin type-safe layer for the Haskell Binary library.
https://github.com/quchen/binary-typed
Last synced: about 2 months ago
JSON representation
Thin type-safe layer for the Haskell Binary library.
- Host: GitHub
- URL: https://github.com/quchen/binary-typed
- Owner: quchen
- License: other
- Created: 2014-06-05T15:32:46.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-07-31T06:48:57.000Z (almost 8 years ago)
- Last Synced: 2024-05-09T23:01:25.066Z (about 1 year ago)
- Language: Haskell
- Homepage:
- Size: 205 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
[][travis]
# Typed Binary lib
Standard `Binary` serializes to `ByteString`, which is an untyped format;
deserialization of unexpected input usually results in unusable data.This module is built around a `Typed` type, which allows serializing both a
value and the type of that value; deserialization can then check whether the
received data was sent assuming the right type, and error messages may provide
insight into the type mismatch.This package serves the same purpose as [tagged-binary][tagged-binary], with
a couple of key differences:- Support of different kinds of serialized type annotations, each with
specific strengths and weaknesses.- Error messages can provide details on type errors at the cost of
longer message lengths to include the necessary information.- Very small performance overhead compared to using standard `Binary` due to
caching when using hashed type information. Since shown and full types are not
cached, decoding them has a significant performance hit (ballpark: factor of
two).- No depencency on `Internal` modules of other libraries, and a very small
dependency footprint in general.For information about usage, see the `Tutorial` submodule.
Performance-wise, here is a value `Right (Left <100 chars lipsum>)` of
type `Either (Char, Int) (Either String (Maybe Integer))` benchmarked
using the `Hashed64` type representation:
More information can be found on the [binary-typed Hackage page][hackage], or
you can generate the documentation yourself (via `cabal haddock`).[travis]: https://travis-ci.org/quchen/binary-typed
[hackage]: http://hackage.haskell.org/package/binary-typed
[tagged-binary]: http://hackage.haskell.org/package/tagged-binary