diff --git a/src/Data/SumBag.hs b/src/Data/SumBag.hs index f118c8c0aeafe6924989e65f14ba2078a17112c8..eaca38ad32153e20b686ca7fbfcd834aae3c5638 100644 --- a/src/Data/SumBag.hs +++ b/src/Data/SumBag.hs @@ -113,7 +113,7 @@ rotateSingleRight _ _ _ = error "rotateSingleRight called with empty left tree" rotateDoubleLeft :: Monoid a => Element a -> Tree a -> Tree a -> Tree a rotateDoubleLeft a x (Node _ c (Node _ b y1 y2) z) = node b (node a x y1) (node c y2 z) -rotateDoubleLeft _ _ _ = error "rotateDoubleLeft called with too small left tree" +rotateDoubleLeft _ _ _ = error "rotateDoubleLeft called with too small right tree" rotateDoubleRight :: Monoid a => Element a -> Tree a -> Tree a -> Tree a rotateDoubleRight c (Node _ a x (Node _ b y1 y2)) z = node b (node a x y1) (node c y2 z) @@ -136,7 +136,7 @@ balance1 a left right sizeLL = size lleft sizeLR = size lright in if sizeLL < sizeLR then rotateSingleRight a left right else rotateDoubleRight a left right - -- No subtree is too heave, we can just form a new tree straight away + -- No subtree is too heavy, we can just form a new tree straight away | otherwise = node a left right addOnce :: Semigroup a => Element a -> Element a