Commit 9627b877 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

SumBag: Don't throw away whole subtrees when deleting

This was a bug in the `delmin` helper that is used to delete the smallest
element of the right tree. It deleted too much.
parent 624bf4e5
......@@ -150,7 +150,7 @@ delOnce e = case snd (NE.uncons (multiplicity e)) of
delmin :: Monoid a => Tree a -> (Element a, Tree a)
delmin Leaf = error "delmin: Empty tree"
delmin (Node _ e Leaf _) = (e, Leaf)
delmin (Node _ e Leaf right) = (e, right)
delmin (Node _ e left right) = (\left' -> balance1 e left' right) <$> delmin left
balanceBound :: Int
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment