Add -fno-bang-patterns to modules using both bang and glasgow-exts
[ghc-base.git] / Data / IntMap.hs
index e210442..03a6ab0 100644 (file)
@@ -1,4 +1,4 @@
-{-# OPTIONS -cpp -fglasgow-exts #-} 
+{-# OPTIONS -cpp -fglasgow-exts -fno-bang-patterns #-} 
 -----------------------------------------------------------------------------
 -- Module      :  Data.IntMap
 -- Copyright   :  (c) Daan Leijen 2002
@@ -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
@@ -211,11 +212,16 @@ type Prefix = Int
 type Mask   = Int
 type Key    = Int
 
-instance Ord a => Monoid (IntMap a) where
+instance Monoid (IntMap a) where
     mempty  = empty
     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__
 
 {--------------------------------------------------------------------
@@ -230,6 +236,7 @@ instance Data a => Data (IntMap a) where
   toConstr _    = error "toConstr"
   gunfold _ _   = error "gunfold"
   dataTypeOf _  = mkNorepType "Data.IntMap.IntMap"
+  dataCast1 f   = gcast1 f
 
 #endif