Skip to content

Commit

Permalink
Remove the deriving Show bits
Browse files Browse the repository at this point in the history
Useful for debugging, but kind of scary because they all hinge on an
`unsafePerformIO`
  • Loading branch information
changlinli committed Jul 17, 2024
1 parent 70afd9c commit 9caf2a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion compiler/src/Type/Occurs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import qualified Type.UnionFind as UF


occurs :: Type.Variable -> IO Bool
occurs var =
occurs var =
occursHelp [] var False


Expand Down
9 changes: 2 additions & 7 deletions compiler/src/Type/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ data Constraint
, _headerCon :: Constraint
, _bodyCon :: Constraint
}
deriving Show


exists :: [Variable] -> Constraint -> Constraint
Expand All @@ -87,7 +86,6 @@ data FlatType
| Record1 (Map.Map Name.Name Variable) Variable
| Unit1
| Tuple1 Variable Variable (Maybe Variable)
deriving Show


data Type
Expand All @@ -100,7 +98,6 @@ data Type
| RecordN (Map.Map Name.Name Type) Type
| UnitN
| TupleN Type Type (Maybe Type)
deriving Show



Expand All @@ -114,7 +111,6 @@ data Descriptor =
, _mark :: Mark
, _copy :: Maybe Variable
}
deriving Show


data Content
Expand All @@ -125,15 +121,14 @@ data Content
| Structure FlatType
| Alias ModuleName.Canonical Name.Name [(Name.Name,Variable)] Variable
| Error
deriving Show


data SuperType
= Number
| Comparable
| Appendable
| CompAppend
deriving (Eq, Show)
deriving (Eq)


makeDescriptor :: Content -> Descriptor
Expand All @@ -160,7 +155,7 @@ outermostRank =


newtype Mark = Mark Word32
deriving (Eq, Ord, Show)
deriving (Eq, Ord)


noMark :: Mark
Expand Down
1 change: 0 additions & 1 deletion compiler/src/Type/Unify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ data Context =
, _second :: Variable
, _secondDesc :: Descriptor
}
deriving Show


reorient :: Context -> Context
Expand Down
6 changes: 1 addition & 5 deletions compiler/src/Type/UnionFind.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down

0 comments on commit 9caf2a0

Please sign in to comment.