vcache-trie 0.2.3 → 0.2.4
raw patch · 3 files changed
+12/−1 lines, 3 files
Files
- changelog.md +3/−0
- hsrc_lib/Data/VCache/Trie.hs +8/−0
- vcache-trie.cabal +1/−1
changelog.md view
@@ -25,3 +25,6 @@ ## 0.2.3 * function: diff; find changes between two tries++## 0.2.4+* added 'functor' instance for the Diff datatype
hsrc_lib/Data/VCache/Trie.hs view
@@ -484,6 +484,11 @@ data Diff a = InL a | Diff a a | InR a deriving (Show, Eq) +instance Functor Diff where+ fmap f (InL a) = InL (f a)+ fmap f (Diff a b) = Diff (f a) (f b)+ fmap f (InR b) = InR (f b)+ -- thoughts: it might be worthwhile to have a variation -- that preserves common subtrees and elements, i.e. such -- that both trees can be reconstructed from the diff.@@ -491,6 +496,9 @@ -- | Compute differences between two tries. The provided functions -- determine the difference type for values in just the left or right -- or both. +--+-- Note: this function is optimized for cases where tries are in the+-- same VSpace and share many subtrees. diff :: (Eq a) => Trie a -> Trie a -> [(ByteString, Diff a)] diff = diffRoot where diffRoot a b = diffChild mempty (trie_root a) (trie_root b)
vcache-trie.cabal view
@@ -1,5 +1,5 @@ Name: vcache-trie-Version: 0.2.3+Version: 0.2.4 Synopsis: patricia tries modeled above VCache Category: Database Description: