summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/RoughMap.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-10-07 15:47:24 -0400
committerBen Gamari <ben@smart-cactus.org>2021-10-07 15:55:42 -0400
commitce61d25afab3db003eba1eb34bc4e365d224c635 (patch)
treeed2a243a855b7094c8b7220b089b78078dd890e8 /compiler/GHC/Core/RoughMap.hs
parent128c2c186f6557b63430a9e8f6b9ec1ca19221bb (diff)
downloadhaskell-wip/T19703.tar.gz
Eliminate mapM_ over eltsRMwip/T19703
Diffstat (limited to 'compiler/GHC/Core/RoughMap.hs')
-rw-r--r--compiler/GHC/Core/RoughMap.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/Core/RoughMap.hs b/compiler/GHC/Core/RoughMap.hs
index 4e55075e13..46cfe2bf45 100644
--- a/compiler/GHC/Core/RoughMap.hs
+++ b/compiler/GHC/Core/RoughMap.hs
@@ -22,6 +22,7 @@ module GHC.Core.RoughMap
, elemsRM
, sizeRM
, foldRM
+ , traverse_RM
, unionRM
) where
@@ -208,6 +209,9 @@ dropEmpty rm = Just rm
elemsRM :: RoughMap a -> [a]
elemsRM = foldRM (:) []
+traverse_RM :: Monad m => (a -> m ()) -> RoughMap a -> m ()
+traverse_RM f = foldRM (\x rest -> f x >> rest) (return ())
+
foldRM :: (a -> b -> b) -> b -> RoughMap a -> b
foldRM f = go
where