[project @ 2005-01-17 13:23:43 by simonmar]
authorsimonmar <unknown>
Mon, 17 Jan 2005 13:23:44 +0000 (13:23 +0000)
committersimonmar <unknown>
Mon, 17 Jan 2005 13:23:44 +0000 (13:23 +0000)
Add Typeable instances for the new DData libraries

Data/IntMap.hs
Data/IntSet.hs
Data/Map.hs
Data/Set.hs

index 6e26867..41d9ba2 100644 (file)
@@ -137,6 +137,7 @@ import Data.Bits
 import Data.Int
 import Data.Monoid
 import qualified Data.IntSet as IntSet
+import Data.Typeable
 
 {-
 -- just for testing
@@ -967,6 +968,13 @@ showMap (x:xs)
     showElem (k,x)  = shows k . showString ":=" . shows x
   
 {--------------------------------------------------------------------
+  Typeable
+--------------------------------------------------------------------}
+
+#include "Typeable.h"
+INSTANCE_TYPEABLE1(IntMap,intMapTc,"IntMap")
+
+{--------------------------------------------------------------------
   Debugging
 --------------------------------------------------------------------}
 -- | /O(n)/. Show the tree that implements the map. The tree is shown
index 510498c..1d46218 100644 (file)
@@ -95,6 +95,7 @@ import Data.Int
 
 import qualified Data.List as List
 import Data.Monoid
+import Data.Typeable
 
 {-
 -- just for testing
@@ -581,6 +582,13 @@ showSet (x:xs)
     showTail (x:xs) = showChar ',' . shows x . showTail xs
 
 {--------------------------------------------------------------------
+  Typeable
+--------------------------------------------------------------------}
+
+#include "Typeable.h"
+INSTANCE_TYPEABLE0(IntSet,intSetTc,"IntSet")
+
+{--------------------------------------------------------------------
   Debugging
 --------------------------------------------------------------------}
 -- | /O(n)/. Show the tree that implements the set. The tree is shown
index 2451016..b23880a 100644 (file)
@@ -151,6 +151,7 @@ import Prelude hiding (lookup,map,filter,foldr,foldl,null)
 import Data.Monoid
 import qualified Data.Set as Set
 import qualified Data.List as List
+import Data.Typeable
 
 {-
 -- for quick check
@@ -1374,6 +1375,12 @@ node           = "+--"
 withBar bars   = "|  ":bars
 withEmpty bars = "   ":bars
 
+{--------------------------------------------------------------------
+  Typeable
+--------------------------------------------------------------------}
+
+#include "Typeable.h"
+INSTANCE_TYPEABLE2(Map,mapTc,"Map")
 
 {--------------------------------------------------------------------
   Assertions
index 887c206..3affb0a 100644 (file)
@@ -114,6 +114,7 @@ module Data.Set  (
 import Prelude hiding (filter,foldr,foldl,null,map)
 import Data.Monoid
 import qualified Data.List as List
+import Data.Typeable
 
 {-
 -- just for testing
@@ -508,6 +509,13 @@ showSet (x:xs)
     
 
 {--------------------------------------------------------------------
+  Typeable/Data
+--------------------------------------------------------------------}
+
+#include "Typeable.h"
+INSTANCE_TYPEABLE1(Set,setTc,"Set")
+
+{--------------------------------------------------------------------
   Utility functions that return sub-ranges of the original
   tree. Some functions take a comparison function as argument to
   allow comparisons against infinite values. A function [cmplo x]