summaryrefslogtreecommitdiff
path: root/pshow.hs
blob: 6fba9ffb5fc257f7ee1ce52f9da61372b8f2c908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# 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 ++ ")"