Fixed bug regarding insertion in SortedMap.
libs/base/Data/SortedMap.idr+1−1
@@ -114,7 +114,7 @@ treeInsert' k v (Branch3 t1 k1 t2 k2 t3) =
115 case treeInsert' k v t3 of
115 case treeInsert' k v t3 of
116 Left t3' => Left (Branch3 t1 k1 t2 k2 t3')
116 Left t3' => Left (Branch3 t1 k1 t2 k2 t3')
117− Right (a, b, c) => Right (Branch2 t1 k2 t2, k2, Branch2 a b c)
117+ Right (a, b, c) => Right (Branch2 t1 k1 t2, k2, Branch2 a b c)
119treeInsert : Ord k => k -> v -> Tree n k v -> Either (Tree n k v) (Tree (S n) k v)
119treeInsert : Ord k => k -> v -> Tree n k v -> Either (Tree n k v) (Tree (S n) k v)
120treeInsert k v t =
120treeInsert k v t =
test/reg048/expectednew file
No changes to the content.
test/reg048/reg048.idrnew file+24
@@ -0,0 +1,24 @@
4+test : List Int -> IO ()
5+test xs = do let lst = Data.SortedMap.toList mp
7+ then putStrLn $ "wrong length for " ++ show xs
8+ else do let res = map (\x => lookup x mp) xs
9+ let found = mapMaybe id res
11+ then putStrLn $ "some lost in " ++ show xs ++ ": res=" ++ show res
12+ ++ " toList=" ++ show lst
16+ mp : SortedMap Int ()
17+ mp = foldr (\x => \m => insert x () m) empty xs
22+main = do test [1,2,3]
test/reg048/runnew file+4
@@ -0,0 +1,4 @@
2+idris $@ reg048.idr -o reg048