diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-10-22 17:43:52 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-10-22 17:43:52 -0400 |
commit | 6902d7eb7f8a2f77a7c825ea15c53e5f7bacbe4d (patch) | |
tree | ce0615c05f0c55ad9278dad7c96e314ea099fc55 | |
parent | 2e42b31a705e4b523c2421ab8b12c7b62e16d633 (diff) | |
download | haskell-wip/T19703b.tar.gz |
Bag optimisationswip/T19703b
-rw-r--r-- | compiler/GHC/Data/Bag.hs | 4 |
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 |