nhc98 version of instance Show (a->b) copied from Prelude
authorMalcolm.Wallace@cs.york.ac.uk <unknown>
Thu, 24 May 2007 16:06:15 +0000 (16:06 +0000)
committerMalcolm.Wallace@cs.york.ac.uk <unknown>
Thu, 24 May 2007 16:06:15 +0000 (16:06 +0000)
Text/Show/Functions.hs

index d0e2207..315d4d3 100644 (file)
@@ -22,4 +22,12 @@ import Prelude
 #ifndef __NHC__
 instance Show (a -> b) where
        showsPrec _ _ = showString "<function>"
+#else
+instance (Show a,Show b) => Show (a->b) where
+  showsPrec d a = showString "<<function>>"
+
+  showsType a = showChar '(' . showsType value  . showString " -> " .
+                               showsType result . showChar ')'
+                where (value,result) = getTypes undefined
+                      getTypes x = (x,a x)
 #endif