summaryrefslogtreecommitdiff
path: root/pshow.hs
blob: 64fbab1472fea97f0554dcc473c9416d5d8c4161 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# 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 a, PShow b) => PShow (a, b) where
    pshow (a, b) = "(" ++ pshow a ++ "," ++ pshow b ++ ")"