{-# LANGUAGE FlexibleInstances, UndecidableInstances #-} module PShow(PShow(..), pprint) where class PShow a where pshow :: a -> String pprint :: (PShow a) => a -> IO () pprint = putStrLn . pshow instance PShow String where {pshow = show} instance PShow Int where {pshow = show} instance PShow Integer where {pshow = show} instance PShow Float where {pshow = show} instance PShow Double where {pshow = show} instance (PShow a, PShow b) => PShow (a, b) where pshow (a, b) = "(" ++ pshow a ++ "," ++ pshow b ++ ")"