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@