Use explicit language extensions & remove extension fields from base.cabal
[ghc-base.git] / Text / Show / Functions.hs
index d0e2207..1ae46aa 100644 (file)
@@ -1,3 +1,7 @@
+{-# LANGUAGE CPP #-}
+-- This module deliberately declares orphan instances:
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Show.Functions
@@ -22,4 +26,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