text-trie: An efficient finite map from Text to values, based on bytestring-trie.

[ bsd3, data, data-structures, library ] [ Propose Tags ] [ Report a vulnerability ]

An efficient finite map from Text to values, based on bytestring-trie.

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.2.5.0
Change log CHANGELOG
Dependencies base (>=4.5 && <4.13), binary (>=0.5.1 && <0.8.7), text (>=1.2.3 && <1.2.4) [details]
License BSD-3-Clause
Copyright Copyright (c) 2008--2019 wren gayle romano, 2019 michael j. klein
Author wren gayle romano, michael j. klein
Maintainer lambdamichael@gmail.com
Category Data, Data Structures
Home page http://github.com/michaeljklein/text-trie
Source repo head: git clone https://github.com/michaeljklein/text-trie.git
Uploaded by lambdamichael at 2019-04-11T19:52:45Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 953 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-04-11 [all 1 reports]

Readme for text-trie-0.2.5.0

[back to package description]

text-trie

Hackage version TravisCI Build Status

The text-trie package is a lightweight adaptation of bytestring-trie to Text.

For the differences in performance, see bench.md.

bytestring-trie

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 one of the following standard methods to install it.

    -- With stack and without the source:
    $> stack install text-trie
    
    -- With stack and with the source already:
    $> cd text-trie
    $> stack install
    

Portability

The implementation only relies on a few basic language extensions and DeriveGeneric. The complete list of extensions used is:

  • CPP
  • MagicHash
  • NoImplicitPrelude
  • StandaloneDeriving
  • DeriveGeneric