summaryrefslogtreecommitdiff
path: root/src/GF/Data/Operations.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-06-17 21:56:27 +0000
committeraarne <aarne@cs.chalmers.se>2007-06-17 21:56:27 +0000
commited5b02d4aafdd5250076ede6cbe4ad3ab707ea98 (patch)
tree7ba36098c6797aa02eb15bec2888122c59cadacc /src/GF/Data/Operations.hs
parent4704c68b3433744492851fe2d0846e86c4cbf7a7 (diff)
checking name conflicts; some RGs don't work now
Diffstat (limited to 'src/GF/Data/Operations.hs')
-rw-r--r--src/GF/Data/Operations.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/GF/Data/Operations.hs b/src/GF/Data/Operations.hs
index ac1ec85bb..c6def01a8 100644
--- a/src/GF/Data/Operations.hs
+++ b/src/GF/Data/Operations.hs
@@ -34,7 +34,7 @@ module GF.Data.Operations (-- * misc functions
-- * binary search trees; now with FiniteMap
BinTree, emptyBinTree, isInBinTree, justLookupTree,
- lookupTree, lookupTreeMany, updateTree,
+ lookupTree, lookupTreeMany, lookupTreeManyAll, updateTree,
buildTree, filterBinTree,
sorted2tree, mapTree, mapMTree, tree2list,
@@ -318,6 +318,12 @@ lookupTreeMany pr (t:ts) x = case lookupTree pr x t of
_ -> lookupTreeMany pr ts x
lookupTreeMany pr [] x = Bad $ "failed to find" +++ pr x
+lookupTreeManyAll :: Ord a => (a -> String) -> [BinTree a b] -> a -> [b]
+lookupTreeManyAll pr (t:ts) x = case lookupTree pr x t of
+ Ok v -> v : lookupTreeManyAll pr ts x
+ _ -> lookupTreeManyAll pr ts x
+lookupTreeManyAll pr [] x = []
+
-- | destructive update
updateTree :: (Ord a) => (a,b) -> BinTree a b -> BinTree a b
-- updateTree (a,b) tr = addToFM tr a b