summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-09-30 05:41:44 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-09-30 05:41:44 +0400
commit0b05b30661eb9e5c60ded740f79603bbb0d46a19 (patch)
tree36e3c54ee927e594ee46b1834f278bccef4abf3c
parente7cf4c0f1dff0eaa24aa5f8dfc2762192899f672 (diff)
Implement union function
-rw-r--r--src/Data/BEncode/BDict.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Data/BEncode/BDict.hs b/src/Data/BEncode/BDict.hs
index 925027b..8ef6d20 100644
--- a/src/Data/BEncode/BDict.hs
+++ b/src/Data/BEncode/BDict.hs
@@ -89,7 +89,11 @@ lookup x = go
89{-# INLINE lookup #-} 89{-# INLINE lookup #-}
90 90
91union :: BDictMap a -> BDictMap a -> BDictMap a 91union :: BDictMap a -> BDictMap a -> BDictMap a
92union = undefined 92union Nil xs = xs
93union xs Nil = xs
94union bd @ (Cons k v xs) bd' @ (Cons k' v' xs')
95 | k < k' = Cons k v (union xs bd')
96 | otherwise = Cons k' v' (union bd xs')
93 97
94map :: (a -> b) -> BDictMap a -> BDictMap b 98map :: (a -> b) -> BDictMap a -> BDictMap b
95map f = go 99map f = go