bytestring-trie: An efficient finite map from bytestrings to values.

[ bsd3, data, data-structures, library ] [ Propose Tags ]

An efficient finite map from bytestrings 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.)


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.2.2, 0.2.3, 0.2.4, 0.2.4.1, 0.2.4.3, 0.2.5.0, 0.2.5.1, 0.2.5.2, 0.2.5.3, 0.2.6, 0.2.7, 0.2.7.1, 0.2.7.2
Change log CHANGELOG
Dependencies base (>=4.5 && <4.19), binary (>=0.5.1 && <0.11), bytestring (>=0.9.2 && <0.12), deepseq (>=1.2 && <1.5) [details]
License BSD-3-Clause
Copyright 2008–2023 wren gayle romano
Author wren gayle romano
Maintainer wren@cpan.org
Category Data, Data Structures
Home page https://wrengr.org/software/hackage.html
Bug tracker https://github.com/wrengr/bytestring-trie/issues
Source repo head: git clone https://github.com/wrengr/bytestring-trie.git
Uploaded by WrenRomano at 2023-03-19T22:01:52Z
Distributions Fedora:0.2.7.2, LTSHaskell:0.2.7.2, NixOS:0.2.7.2
Reverse Dependencies 24 direct, 356 indirect [details]
Downloads 24234 total (75 in the last 30 days)
Rating 2.5 (votes: 4) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-03-20 [all 1 reports]

Readme for bytestring-trie-0.2.7.2

[back to package description]

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