bytestring-trie

An efficient finite map from bytestrings to values.

https://wrengr.org/software/hackage.html

Version on this page:0.2.7
LTS Haskell 23.0:0.2.7.5
Stackage Nightly 2024-12-13:0.2.7.5
Latest on Hackage:0.2.7.5

See all snapshots bytestring-trie appears in

BSD-3-Clause licensed by wren gayle romano
Maintained by [email protected]
This version can be pinned in stack with:bytestring-trie-0.2.7@sha256:f78e9d1dba699ce56080824693787918e9e8904db99d04d3470941420b1dd3ed,9010

Module documentation for 0.2.7

Used by 1 package in lts-20.12(full list with versions):

bytestring-trie

Hackage version Build Status Dependencies

The bytestring-trie package provides an efficient implementation of tries mapping ByteString to values. The implementation is based on Okasaki’s big-endian patricia trees, à la IntMap. We first trie on the elements of ByteString and then trie on the big-endian bit representation of those elements. Patricia trees have efficient algorithms for union and other merging operations, but they’re also quick for lookups and insertions.

If you are only interested in being able to associate individual ByteStrings to values, then you may prefer the hashmap package which is faster for those only needing a map-like structure. This package is intended for those who need the extra capabilities that a trie-like structure can offer (e.g., structure sharing to reduce memory costs for highly redundant keys, taking the submap of all keys with a given prefix, contextual mapping, extracting the minimum and maximum keys, etc.)

Install

This is a simple package and should be easy to install. You should be able to use the standard:

$> cabal install bytestring-trie

Portability

The implementation is quite portable, relying only on a few basic language extensions. The complete list of extensions used by the library is:

  • CPP
  • MagicHash – Only if using GHC
  • NoImplicitPrelude

The test suite uses a few additional extensions:

  • MultiParamTypeClasses
  • FlexibleInstances
  • FlexibleContexts

Links