X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FIntMap.hs;h=1be0bbeac8e78e74d274d68d30409e19662f1244;hb=641f8d5964b2b02f4cd7b9081adf6596c6f4d4d7;hp=e210442707c8bc98951e6f02e4bbf77f9ec8ea43;hpb=2701ac4127cbc37e6d1069e2f5240a1e0ec1e479;p=ghc-base.git diff --git a/Data/IntMap.hs b/Data/IntMap.hs index e210442..1be0bbe 100644 --- a/Data/IntMap.hs +++ b/Data/IntMap.hs @@ -138,6 +138,7 @@ import Data.Int import qualified Data.IntSet as IntSet import Data.Monoid (Monoid(..)) import Data.Typeable +import Data.Foldable (Foldable(foldMap)) {- -- just for testing @@ -216,6 +217,11 @@ instance Ord a => Monoid (IntMap a) where mappend = union mconcat = unions +instance Foldable IntMap where + foldMap f Nil = mempty + foldMap f (Tip _k v) = f v + foldMap f (Bin _ _ l r) = foldMap f l `mappend` foldMap f r + #if __GLASGOW_HASKELL__ {--------------------------------------------------------------------