From 9caf2a027f34d7dd4a08ad843e386e54ebbcece4 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/Occurs.hs | 2 +- compiler/src/Type/Type.hs | 9 ++------- compiler/src/Type/Unify.hs | 1 - compiler/src/Type/UnionFind.hs | 6 +----- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/compiler/src/Type/Occurs.hs b/compiler/src/Type/Occurs.hs index 25baa78fe..63092f4b4 100644 --- a/compiler/src/Type/Occurs.hs +++ b/compiler/src/Type/Occurs.hs @@ -18,7 +18,7 @@ import qualified Type.UnionFind as UF occurs :: Type.Variable -> IO Bool -occurs var = +occurs var = occursHelp [] var False diff --git a/compiler/src/Type/Type.hs b/compiler/src/Type/Type.hs index 19dffe1cd..91043904c 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 7308df6f9..297380c52 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 c777b4da8..f631bff63 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