-- Stability : provisional
-- Portability : portable
--
+-- NOTE: Data.FiniteMap is DEPRECATED, please use "Data.Map" instead.
+--
-- A finite map implementation, derived from the paper:
-- /Efficient sets: a balancing act/, S. Adams,
-- Journal of functional programming 3(4) Oct 1993, pp553-562
#define OUTPUTABLE_key {--}
#endif
-module Data.FiniteMap (
+module Data.FiniteMap
+ {-# DEPRECATED "Please use Data.Map instead." #-}
+ (
-- * The @FiniteMap@ type
FiniteMap, -- abstract type
import Data.Maybe ( isJust )
#ifdef __GLASGOW_HASKELL__
import GHC.Base
+import Data.Typeable
+import Data.Generics.Basics
+import Data.Generics.Instances
#endif
#ifdef __HADDOCK__
#endif /* not GHC */
+
-- ---------------------------------------------------------------------------
-- The signature of the module
instance Functor (FiniteMap k) where
fmap f = mapFM (const f)
+#if __GLASGOW_HASKELL__
+
+#include "Typeable.h"
+INSTANCE_TYPEABLE2(FiniteMap,arrayTc,"FiniteMap")
+
+-- This instance preserves data abstraction at the cost of inefficiency.
+-- We omit reflection services for the sake of data abstraction.
+
+instance (Data a, Data b, Ord a) => Data (FiniteMap a b) where
+ gfoldl f z fm = z listToFM `f` (fmToList fm)
+ toConstr _ = error "toConstr"
+ gunfold _ _ = error "gunfold"
+ dataTypeOf _ = mkNorepType "Data.FiniteMap.FiniteMap"
+
+#endif
+
+
-- ---------------------------------------------------------------------------
-- Adding to and deleting from @FiniteMaps@