dahdit: Binary parsing and serialization with integrated size

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.2.0, 0.3.0, 0.5.0, 0.5.1, 0.6.0, 0.7.0
Dependencies base (>=4.12 && <5), bytestring (>=0.11 && <0.13), containers (>=0.6 && <0.7), data-default (>=0.7 && <0.8), data-sword (>=0.2 && <0.3), free (>=5.1 && <5.3), ghc-typelits-knownnat (>=0.7 && <0.8), mtl (>=2.2 && <2.4), primitive (>=0.7 && <0.10), text (>=1.2 && <2.2), transformers (>=0.5 && <0.7), vector (>=0.12 && <0.14) [details]
Tested with ghc ==9.8.4
License BSD-3-Clause
Copyright (c) 2022 Eric Conlon
Author Eric Conlon
Maintainer ejconlon@gmail.com
Category Data
Home page https://github.com/ejconlon/dahdit#readme
Bug tracker https://github.com/ejconlon/dahdit/issues
Source repo head: git clone https://github.com/ejconlon/dahdit
Uploaded by ejconlon at 2024-12-18T21:45:14Z
Distributions
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 434 total (42 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-12-18 [all 1 reports]

Readme for dahdit-0.7.0

[back to package description]

dahdit

Binary parsing and serialization with integrated size.

(dahs and dits are signal durations in Morse code)

This differs from binary in a few ways:

  • It supports parsing from (or rendering into) pinned or unpinned memory.
  • It uses ByteArray internally to avoid generating new or retaining references to old pinned memory.
  • Examining Put can yield required byte size without serializing.
  • Derivation uses via and not anyclass for better control of derived instances.
  • Types implementing Binary can implement byteSized for size calculation (or it will reflect on put).
  • Known-statically-sized types can implement StaticByteSized for size speedups.
  • Provides several additional types representing fixed-length strings or sequences (using TypeLits).

Static sizes

You may find it necessary to discharge simple KnownNat constraints with a plugin like ghc-typelits-knownnat. Add that package to your dependencies and add this to the top of the necessary files:

{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-}