[commit: base] master: give instances of Ord for TyCon and TypeRep (c80c5cb)
Simon Marlow
marlowsd at gmail.com
Mon Jul 18 16:37:56 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c80c5cb64f5aa5d8d9b142085f3bf40b5bce7567
>---------------------------------------------------------------
commit c80c5cb64f5aa5d8d9b142085f3bf40b5bce7567
Author: Simon Marlow <marlowsd at gmail.com>
Date: Thu Jul 14 15:51:28 2011 +0100
give instances of Ord for TyCon and TypeRep
>---------------------------------------------------------------
Data/Typeable/Internal.hs | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Data/Typeable/Internal.hs b/Data/Typeable/Internal.hs
index f28a079..cdd2778 100644
--- a/Data/Typeable/Internal.hs
+++ b/Data/Typeable/Internal.hs
@@ -87,6 +87,9 @@ data TypeRep = TypeRep {-# UNPACK #-} !Fingerprint TyCon [TypeRep]
instance Eq TypeRep where
(TypeRep k1 _ _) == (TypeRep k2 _ _) = k1 == k2
+instance Ord TypeRep where
+ (TypeRep k1 _ _) <= (TypeRep k2 _ _) = k1 <= k2
+
-- | An abstract representation of a type constructor. 'TyCon' objects can
-- be built using 'mkTyCon'.
data TyCon = TyCon {
@@ -99,6 +102,9 @@ data TyCon = TyCon {
instance Eq TyCon where
(TyCon t1 _ _ _) == (TyCon t2 _ _ _) = t1 == t2
+instance Ord TyCon where
+ (TyCon k1 _ _ _) <= (TyCon k2 _ _ _) = k1 <= k2
+
----------------- Construction --------------------
#include "MachDeps.h"
More information about the Cvs-libraries
mailing list