[commit: ghc] master: Implement Eq TyCon directly (ceaf7f1)

git at git.haskell.org git at git.haskell.org
Thu Jun 9 10:47:33 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ceaf7f10865cd27eaa16a5e1fd308799c00e0607/ghc

>---------------------------------------------------------------

commit ceaf7f10865cd27eaa16a5e1fd308799c00e0607
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Thu Jun 9 03:49:00 2016 -0700

    Implement Eq TyCon directly
    
    Eq TyCon is defined in terms of Ord TyCon, but we want to
    remove Ord TyCon, because it's implemented in terms of unique
    comparison, which is nondeterministic.
    
    GHC Trac: #4012


>---------------------------------------------------------------

ceaf7f10865cd27eaa16a5e1fd308799c00e0607
 compiler/types/TyCon.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index c60e410..bafcb2c 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -2072,8 +2072,8 @@ tyConRuntimeRepInfo _                                         = NoRRI
 -}
 
 instance Eq TyCon where
-    a == b = case (a `compare` b) of { EQ -> True;   _ -> False }
-    a /= b = case (a `compare` b) of { EQ -> False;  _ -> True  }
+    a == b = getUnique a == getUnique b
+    a /= b = getUnique a /= getUnique b
 
 instance Ord TyCon where
     a <= b = case (a `compare` b) of { LT -> True;  EQ -> True;  GT -> False }



More information about the ghc-commits mailing list