Skip to content

Commit 7ec93c4

Browse files
committed
Get rid of dodgy Show instance
GHC Head doesn't like it as it's overlapping, and in hindsight these really shouldn't be there at all. Leaving the non-wrapped version as it may be useful, but document it (and the IO ones; leaving the IO-wrapped version in case people use/rely upon it) that it's unsafe.
1 parent 14e174b commit 7ec93c4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Data/Graph/Inductive/Monad/IOArray.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ showGraph (_,a,m) = concatMap showAdj (indices a)
4646
Just (_,l,s) -> '\n':show v++":"++show l++"->"++show s'
4747
where s' = unsafePerformIO (removeDel m s)
4848

49+
-- | Please not that this instance is unsafe.
4950
instance (Show a,Show b) => Show (SGr a b) where
5051
show (SGr g) = showGraph g
5152

53+
-- | Please not that this instance is unsafe.
5254
instance (Show a,Show b) => Show (IO (SGr a b)) where
5355
show g = unsafePerformIO (do {(SGr g') <- g; return (showGraph g')})
5456

Data/Graph/Inductive/Monad/STArray.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ showGraph (_,a,m) = concatMap showAdj (indices a)
5050
unsafeST :: ST RealWorld a -> a
5151
unsafeST = unsafePerformIO . stToIO
5252

53+
-- | Please not that this instance is unsafe.
5354
instance (Show a,Show b) => Show (SGr RealWorld a b) where
5455
show (SGr g) = showGraph g
5556

56-
instance (Show a,Show b) => Show (ST RealWorld (SGr RealWorld a b)) where
57-
show g = unsafeST (do {(SGr g') <- g; return (showGraph g')})
58-
5957
{-
6058
run :: Show (IO a) => IO a -> IO ()
6159
run x = seq x (print x)

0 commit comments

Comments
 (0)