diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-10-22 17:43:52 -0400 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-01-17 09:35:35 +0000 |
commit | d6f7713a19851a5c6114201929d9b5dd4a80e335 (patch) | |
tree | db3d30f5a6a324ba1d570cb8dbe240e81c92e5b4 | |
parent | 48f56dc96ca86df8cf4f07126d6c6cb84bac7158 (diff) | |
download | haskell-d6f7713a19851a5c6114201929d9b5dd4a80e335.tar.gz |
Bag optimisationswip/roughmap-9.2
-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 392922ed85..b9ed65d281 100644 --- a/compiler/GHC/Data/Bag.hs +++ b/compiler/GHC/Data/Bag.hs @@ -334,6 +334,10 @@ instance Foldable.Foldable Bag where foldl' k z (TwoBags b1 b2) = let r1 = foldl' k z b1 in seq r1 $ foldl' k r1 b2 foldl' k z (ListBag xs) = foldl' k z xs + 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 |