[Haskell-cafe] Re: Fun with multi-parameter type classes

Sam Mason mason at f2s.com
Thu Aug 19 18:39:52 EDT 2004

karczma wrote:
>Don't forget that this is the toplevel business, not a universal
>"disease". GHCi says 
>Prelude> :t (show . read)
>(show . read) :: String -> String 
>and doesn't complain. But if you define 
>bz = show . read 
>the attempt to load this definition (file: ctest.hs) results in: 
>  Ambiguous type variable `a' in these top-level constraints:
>    `Read a' arising from use of `read' at ctest.hs:5
>    `Show a' arising from use of `show' at ctest.hs:5
>Failed, modules loaded: none.

OK, you've got me interested!  Why doesn't GHCi complain about the

>So, as one of my friends used to say: it should be obvious for
>everybody that what is obvious for one, need not be obvious for
>the others... 

Suitably abstruse!

More information about the Haskell-Cafe mailing list