From 5e4007e417c791debf9e39c0fbf4f890db85c72f Mon Sep 17 00:00:00 2001 From: Changlin Li Date: Wed, 17 Jul 2024 14:39:34 -0700 Subject: [PATCH] Remove the deriving Show bits Useful for debugging, but kind of scary because they all hinge on an `unsafePerformIO` --- compiler/src/Type/Type.hs | 9 ++------- compiler/src/Type/Unify.hs | 1 - compiler/src/Type/UnionFind.hs | 6 +----- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/compiler/src/Type/Type.hs b/compiler/src/Type/Type.hs index 19dffe1c..dafebff2 100644 --- a/compiler/src/Type/Type.hs +++ b/compiler/src/Type/Type.hs @@ -64,7 +64,6 @@ data Constraint , _headerCon :: Constraint , _bodyCon :: Constraint } - deriving Show exists :: [Variable] -> Constraint -> Constraint @@ -87,7 +86,6 @@ data FlatType | Record1 (Map.Map Name.Name Variable) Variable | Unit1 | Tuple1 Variable Variable (Maybe Variable) - deriving Show data Type @@ -100,7 +98,6 @@ data Type | RecordN (Map.Map Name.Name Type) Type | UnitN | TupleN Type Type (Maybe Type) - deriving Show @@ -114,7 +111,6 @@ data Descriptor = , _mark :: Mark , _copy :: Maybe Variable } - deriving Show data Content @@ -125,7 +121,6 @@ data Content | Structure FlatType | Alias ModuleName.Canonical Name.Name [(Name.Name,Variable)] Variable | Error - deriving Show data SuperType @@ -133,7 +128,7 @@ data SuperType | Comparable | Appendable | CompAppend - deriving (Eq, Show) + deriving Eq makeDescriptor :: Content -> Descriptor @@ -160,7 +155,7 @@ outermostRank = newtype Mark = Mark Word32 - deriving (Eq, Ord, Show) + deriving (Eq, Ord) noMark :: Mark diff --git a/compiler/src/Type/Unify.hs b/compiler/src/Type/Unify.hs index 7308df6f..297380c5 100644 --- a/compiler/src/Type/Unify.hs +++ b/compiler/src/Type/Unify.hs @@ -135,7 +135,6 @@ data Context = , _second :: Variable , _secondDesc :: Descriptor } - deriving Show reorient :: Context -> Context diff --git a/compiler/src/Type/UnionFind.hs b/compiler/src/Type/UnionFind.hs index c777b4da..f631bff6 100644 --- a/compiler/src/Type/UnionFind.hs +++ b/compiler/src/Type/UnionFind.hs @@ -40,16 +40,12 @@ import GHC.IO (unsafePerformIO) newtype Point a = Pt (IORef (PointInfo a)) - deriving (Eq, Show) - -instance (Show a) => Show (IORef a) where - show a = show (unsafePerformIO (readIORef a)) + deriving Eq data PointInfo a = Info {-# UNPACK #-} !(IORef Word32) {-# UNPACK #-} !(IORef a) | Link {-# UNPACK #-} !(Point a) - deriving Show