From: simonmar Date: Mon, 17 Jan 2005 13:23:44 +0000 (+0000) Subject: [project @ 2005-01-17 13:23:43 by simonmar] X-Git-Tag: nhc98-1-18-release~103 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=7d4e0922dd95d5a72d02ecc865598f1ce86aa48d;p=ghc-base.git [project @ 2005-01-17 13:23:43 by simonmar] Add Typeable instances for the new DData libraries --- diff --git a/Data/IntMap.hs b/Data/IntMap.hs index 6e26867..41d9ba2 100644 --- a/Data/IntMap.hs +++ b/Data/IntMap.hs @@ -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 diff --git a/Data/IntSet.hs b/Data/IntSet.hs index 510498c..1d46218 100644 --- a/Data/IntSet.hs +++ b/Data/IntSet.hs @@ -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 diff --git a/Data/Map.hs b/Data/Map.hs index 2451016..b23880a 100644 --- a/Data/Map.hs +++ b/Data/Map.hs @@ -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 diff --git a/Data/Set.hs b/Data/Set.hs index 887c206..3affb0a 100644 --- a/Data/Set.hs +++ b/Data/Set.hs @@ -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]