summaryrefslogtreecommitdiff
path: root/pshow.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-01-20 16:21:22 +0100
committertomsmeding <tom.smeding@gmail.com>2017-01-20 16:21:22 +0100
commitfbed3a4b44823256f17c6a4473e0ec3f63792be6 (patch)
tree7e56bd392c38670ab89e072301e85205d00fca11 /pshow.hs
Initial -- dump of stuff
Diffstat (limited to 'pshow.hs')
-rw-r--r--pshow.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/pshow.hs b/pshow.hs
new file mode 100644
index 0000000..64fbab1
--- /dev/null
+++ b/pshow.hs
@@ -0,0 +1,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 ++ ")"