An efficient finite map from (byte)strings to values.

Version on this page:0.2.4@rev:1
LTS Haskell 22.23:
Stackage Nightly 2024-05-30:
Latest on Hackage:

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.4@sha256:a8034e3c1233ae15ac4f738baa43ca211d2f5ed294d29ca910d9b89c8519942d,4321

Module documentation for 0.2.4

  • Data
    • Data.Trie
      • Data.Trie.Convenience
      • Data.Trie.Internal

An efficient finite map from (byte)strings to values.

The implementation is based on big-endian patricia trees, like Data.IntMap. We first trie on the elements of Data.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 strings 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.)