Hi,<br><br>I've defined a class and some instances, which I'm hoping would help me "show" values of types that may include transactional elements.<br><br>class TShow a where<br>
tshow :: a -> IO String<br>
<br>
instance Show (TVar a) where<br>
show = "%"<br>
<br>
instance (Show a) => TShow a where<br>
tshow a = return $ show a<br>
<br>
instance (Show a) => TShow (TVar a) where<br>
tshow ta = do<br>
a <- readTVar ta<br>
return $ show a<br>
<br>Having created a new class is it possible to do some magic so that it can be put it into a deriving clause?<br><br>data Type = Type<br> { field1 :: Int<br> , field2 :: Int<br> }<br> deriving Show<br><br>data AnotherType = AnotherType<br>
{ field3 :: Int<br> , field4 :: TVar Type<br> }<br> deriving <b>TShow</b><br><br>Thanks<br><br>-John<br><br>