Giter Site home page Giter Site logo

binary-typed's Introduction

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, 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, or you can generate the documentation yourself (via cabal haddock).

binary-typed's People

Contributors

quchen avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.