summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/GHC/Data/Bag.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/Data/Bag.hs b/compiler/GHC/Data/Bag.hs
index 97790e15da..0f4263268b 100644
--- a/compiler/GHC/Data/Bag.hs
+++ b/compiler/GHC/Data/Bag.hs
@@ -337,6 +337,10 @@ instance Foldable.Foldable Bag where
go z (ListBag xs) = foldl' k z xs
{-# INLINEABLE foldl' #-}
+ length = lengthBag
+ null = isEmptyBag
+ x `elem` bag = anyBag (==x) bag
+
instance Traversable Bag where
traverse _ EmptyBag = pure EmptyBag
traverse f (UnitBag x) = UnitBag <$> f x