@@ -23,6 +23,7 @@ module Data.Map.Monoidal
2323 , member
2424 , notMember
2525 , findWithDefault
26+ , assocs
2627 , elems
2728 , keys
2829 ) where
@@ -142,6 +143,11 @@ delete :: Ord k => k -> MonoidalMap k a -> MonoidalMap k a
142143delete k = _Wrapping' MM %~ M.delete k
143144{-# INLINE delete #-}
144145
146+-- | /O(n)/. Return all elements of the map and their keys
147+assocs :: MonoidalMap k a -> [(k,a)]
148+assocs = M.assocs . unpack
149+{-# INLINE assocs #-}
150+
145151-- | /O(n)/. Return all elements of the map in the ascending order of their
146152-- keys. Subject to list fusion.
147153elems :: MonoidalMap k a -> [a]