You can do this with this piece of dirty and dangerous code:
class Showable a where
show2 :: a -> String
instance Showable String where
show2 = id
instance (Show a) => Showable a where
show2 = show
You need -XOverlappingInstances -XFlexibleInstances -XUndecidableInstancesto compile and use it.
*Main> show2 "abc"
"abc"
*Main> show2 3
"3"
source
share