summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/GHC/Data/Bag.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Data/Bag.hs b/compiler/GHC/Data/Bag.hs
index 4171d7b03e..94a9ba86f8 100644
--- a/compiler/GHC/Data/Bag.hs
+++ b/compiler/GHC/Data/Bag.hs
@@ -74,7 +74,6 @@ unionManyBags xs = foldr unionBags EmptyBag xs
unionBags :: Bag a -> Bag a -> Bag a
unionBags EmptyBag b = b
-unionBags b EmptyBag = b
unionBags b1 b2 = TwoBags b1 b2
consBag :: a -> Bag a -> Bag a
@@ -85,6 +84,8 @@ snocBag bag elt = bag `unionBags` (unitBag elt)
isEmptyBag :: Bag a -> Bool
isEmptyBag EmptyBag = True
+isEmptyBag (TwoBags b1 b2) = isEmptyBag b1 && isEmptyBag b2
+isEmptyBag (ListBag xs) = null xs
isEmptyBag _ = False -- NB invariants
isSingletonBag :: Bag a -> Bool