Easy:

   data ShowHex a
   instance Show (ShowHex a) where
      showsPrec _ (ShowHex a) = showHex a

   main = putStrLn $ (show (ShowHex 27))

Here, with labelled instances you would write:

   show ShowHex 27

instead you write:

   show (ShowHex 27)


Keean.

George Russell wrote:

Keean Schupke wrote:

Do you need a language extension at all? You can certainly
do it with the existing extensions!

data ShowDict a
instance Show (ShowDict a) where
   showsPrec _ (ShowDict a) = ...


I don't understand. How does that help you to, for example, use a function which
requires Show Int but (say) substitute the standard function for which which shows
in hexadecimal?


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to