haskell / containers

Assorted concrete container types
https://hackage.haskell.org/package/containers
316 stars 178 forks source link

Data.Set.Internal error message says Map #902

Closed erikd closed 1 year ago

erikd commented 1 year ago

The file containers/src/Data/Set/Internal.hs in function balanceR has the following error:

       (_, _) -> error "Failure in Data.Map.balanceR"

where the "Map" part should be "Set".

I would have submitted a PR, but I got an odd git error when I tried to commit the fix.

erikd commented 1 year ago
diff --git a/containers/src/Data/Set/Internal.hs b/containers/src/Data/Set/Internal.hs
index 6e4d2d6c..d5d7e29d 100644
--- a/containers/src/Data/Set/Internal.hs
+++ b/containers/src/Data/Set/Internal.hs
@@ -1739,7 +1739,7 @@ balanceL x l r = case r of
                    (Bin lls _ _ _, Bin lrs lrx lrl lrr)
                      | lrs < ratio*lls -> Bin (1+ls+rs) lx ll (Bin (1+rs+lrs) x lr r)
                      | otherwise -> Bin (1+ls+rs) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+rs+size lrr) x lrr r)
-                   (_, _) -> error "Failure in Data.Map.balanceL"
+                   (_, _) -> error "Failure in Data.Set.balanceL"
               | otherwise -> Bin (1+ls+rs) x l r
 {-# NOINLINE balanceL #-}

@@ -1764,7 +1764,7 @@ balanceR x l r = case l of
                    (Bin rls rlx rll rlr, Bin rrs _ _ _)
                      | rls < ratio*rrs -> Bin (1+ls+rs) rx (Bin (1+ls+rls) x l rl) rr
                      | otherwise -> Bin (1+ls+rs) rlx (Bin (1+ls+size rll) x l rll) (Bin (1+rrs+size rlr) rx rlr rr)
-                   (_, _) -> error "Failure in Data.Map.balanceR"
+                   (_, _) -> error "Failure in Data.Set.balanceR"
               | otherwise -> Bin (1+ls+rs) x l r
 {-# NOINLINE balanceR #-}
treeowl commented 1 year ago

Thanks. Do you think you could open a PR?

erikd commented 1 year ago

I would love to open a PR, but I cannot even commit the fix:

> git-commit -m "Fix error message" -- .
error: 'containers/docs/_extensions/haddock-autolink' does not have a commit checked out
fatal: updating files failed

Never seen that before.

treeowl commented 1 year ago

Paging @m-renaud.

treeowl commented 1 year ago

This might be a git submodule thing...

erikd commented 1 year ago

Had to remember how to use submodules. PR coming.

erikd commented 1 year ago

https://github.com/haskell/containers/pull/903

konsumlamm commented 1 year ago

Fixed by #903, so this issue can be closed.