bv-little
Efficient little-endian bit vector library
https://github.com/recursion-ninja/bv-little
LTS Haskell 22.33: | 1.3.2 |
Stackage Nightly 2024-09-07: | 1.3.2 |
Latest on Hackage: | 1.3.2 |
bv-little-1.3.2@sha256:a1bd7f3dbb8dae48f2a1e8bf5e7c98eaa8fced338cbb72b2ec3f74b1100eb3df,6288
Module documentation for 1.3.2
- Data
- Data.BitVector
Efficient little-endian bit vector Haskell library
This package contains an efficient implementation of little-endian, immutable bit vectors. It implements most applicable type-classes and also conversions to and from signed or unsigned numbers.
For an implementation of big-endian, immutable bit vectors, use the bv
package.
For an implementation of little-endian, mutable bit vectors, use the bitvec
package.
Accessing type-class instances
This package utilizes the “multiple sub-libraries” feature of Cabal.
The intended usage is an “opt-in” dependency footprint for the bv-little
package, as not all type-class instances which are defined are exposed by default.
Therefore package consumers can select which, if any, type-class instances outside of the core libraries they wish to have exposed and transitively depend on the associated package(s).
New type-class instance exposure procedure:
-
All
BitVector
instances of type-classes defined inbase
are exported by default from theData.BitVector.LittleEndian
module. -
Each
BitVector
instance of a type-class defined in a package other thanbase
is exposed through a specific sub-library dependency and a special exposing module.
To access an instance of a type-class defined outside base
, add the requisite sub-library to your build-depends
and import
the corresponding exposing module within your code-base.
Sub-library Dependency | Exposing Module | Type-class Instance(s) |
---|---|---|
bv-little:instances-binary |
Data.BitVector.LittleEndian.Binary |
Binary |
bv-little:instances-mono-traversable |
Data.BitVector.LittleEndian.MonoTraversable |
MonoFoldable MonoFunctor MonoTraversable |
bv-little:instances-mono-traversable-keys |
Data.BitVector.LittleEndian.MonoKeyed |
MonoAdjustable MonoFoldableWithKey MonoIndexable MonoKeyed MonoLookup MonoTraversableWithKey MonoZip MonoZipWithKey |
bv-little:instances-quickcheck |
Data.BitVector.LittleEndian.QuickCheck |
Arbitrary CoArbitrary |
bv-little:instances-text-show |
Data.BitVector.LittleEndian.TextShow |
TextShow |
Tests
The test suite ensures that all type-class instances are “lawful” and that data-structure–specific functionality is well defined.
The TestSuite.hs
file contains the specification. It can be run by invoking any of the following commands:
-
cabal test
-
stack test
Benchmarks
The benchmarks provide an empyrical check for the asymptotic complexity of data structure operations and also provide easy metrics for detecting performance regressions.
The Benchmarks.hs
file contains these metrics. It can be run by invoking any of the following commands:
-
cabal bench
-
stack bench
Changes
bv-little
follows semantic versioning (SemVer).
[v1.3.2][9]
- Updating dependency upper bounds
v1.3.1
- Fixed Haddock documentation rendering in sub-libraries
v1.3.0
-
Added back
TextShow
instance -
Added specializations
-
Dropping support for GHC < 9.2.3
v1.2.0
-
Restructuring library to expose instances in a refined, “opt-in” manner
-
Dropped support for GHC < 8.8.1
-
Added
Binary
instance -
Added
Read
instance
v1.1.1
-
Added more benchmarks
-
Updated test suite to be more reliable
v1.1.0
- Added
rank
andselect
functions
v1.0.1
-
Correcting Eq instance to test for value equality and not construction equality
-
Updated unit tests do not fail when the antecedent of logical implication cannot be satisfied
v1.0.0
-
Added explicit recursion to monomorphic folds to improve time and space performance
-
Added the following instances:
MonoAdjustable
MonoFoldableWithKey
MonoIndexable
MonoKeyed
MonoLookup
MonoTraversableWithKey
MonoZip
MonoZipWithKey
TextShow
-
Updated the following functions to be constant time:
omap
olength64
oall
oany
ofoldr1Ex
ofoldl1Ex
oelem
onotElem
ozipWith
v0.1.2
- Updating to base bounds for GHC 8.6.1
v0.1.1
-
Updated to well-typed internal representation
-
Corrected defect in rotate, rotateL, and rotateR
-
Improved performance by switching exponentiation with base 2 to bit shifting operations
-
Improved performance of clearBit by increasing strictness
-
Increased benchmark coverage
-
Increased test suite coverage
v0.1.0
-
Created instances of applicable typeclass instances
-
Added numeric conversion functions
-
Added basic test suite
-
Added stub benchmark