byte-containers: Sets and maps with 8-bit words for keys

[ bsd3, data, library ] [ Propose Tags ]

This library provides variant of Data.Map and Data.Set from the containers library where the key is specialized to Word8. Internally, this uses a 256-bit bitmask for the presence of keys and a SmallArray of values of keys that were present. For example, the map {2 => Z, 3 => B, 5 => X, 9 => A} would be repsented in memory as:

Bitmask: 0011010001000000... (240 more zero bits)
Value Array: Z,B,X,A

This is optimized for reads. Lookup is O(1). Union is technically O(1) but only because the universe of keys is finite. The current implementation always scans through all 256 bits of key space.


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],
Change log
Dependencies base (>=4.12 && <5), primitive (>=0.7 && <0.10), run-st (>=0.1 && <0.2), wide-word (>=0.1.1 && <0.2) [details]
License BSD-3-Clause
Copyright 2020 Andrew Martin
Author Andrew Martin
Category Data
Home page
Bug tracker
Source repo head: git clone git://
Uploaded by l3c_amartin at 2024-01-31T19:09:07Z
Distributions NixOS:
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 69 total (8 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-01-31 [all 1 reports]