bitset alternatives and similar packages
Based on the "Data Structures" category.
Alternatively, view bitset alternatives based on common mentions on social networks and blogs.
-
Agda
Agda is a dependently typed programming language / interactive theorem prover. -
vinyl
Extensible Records for Haskell. Pull requests welcome! Come visit us on #vinyl on freenode. -
repa-scalar
High performance, regular, shape polymorphic parallel arrays. -
repa-convert
High performance, regular, shape polymorphic parallel arrays. -
repa-array
High performance, regular, shape polymorphic parallel arrays. -
parameterized-utils
A set of utilities for using indexed types including containers, equality, and comparison. -
ethereum-client-haskell
A Haskell version of an Ethereum client -
type-level-sets
Type-level sets for Haskell (with value-level counterparts and various operations) -
justified-containers
Standard containers, with keys that carry type-level proofs of their own presence. -
bytestring-trie
An efficient finite map from (byte)strings to values. -
knit
Ties the knot on data structures that reference each other by unique keys -
nonempty-containers
Efficient non-empty variants of containers data types, with full API -
claferIG
Support for reasoning on Clafer models by instantiation and counter example generation. -
igraph
Incomplete Haskell bindings to the igraph library (which is written in C) -
selections
Haskell Package for operating with selections over an underlying functor -
map-syntax
Syntax sugar and explicit semantics for statically defined maps
Collect and Analyze Billions of Data Points in Real Time
Do you think we are missing an alternative of bitset or a related project?
README
bitset 
A bit set is a compact data structure, which maintains a set of members
from a type that can be enumerated (i. e. has an Enum
instance). Current
implementation is abstract with respect to conatiner type, so any
numeric type with Bits
instance can be used as a container.
Here's a usage example for a dynamic bit set, which uses a tweaked version
of Integer
for storing bits:
import Data.BitSet (BitSet, (\\))
import qualified Data.BitSet as BitSet
data Color = Red | Green | Blue deriving (Show, Enum)
main :: IO ()
main = print $ bs \\ BitSet.singleton Blue where
bs :: BitSet Color
bs = BitSet.fromList [Red, Green, Blue]
The API is exactly the same for a static bitset, based on native Word
.
Here's an example from hen
library, which uses Data.BitSet
to
store Xen domain status flags:
import qualified Data.BitSet.Word as BS
data DomainFlag = Dying
| Crashed
| Shutdown
| Paused
| Blocked
| Running
| HVM
| Debugged
deriving (Enum, Show)
isAlive :: DomainFlag -> Bool
isAlive = not . BS.null . BS.intersect (BS.fromList [Crashed, Shutdown])
Benchmarks
To run benchmarks, configure cabal
with benchmarks
and build:
$ cabal-dev install-deps --enable-benchmarks && cabal-dev build
$ ./dist/build/bitset-benchmarks/bitset-benchmarks -o dist/bench.html