[Haskell-cafe] "show" for functional types

Robert Dockins robdockins at fastmail.fm
Sat Apr 1 12:34:14 EST 2006

On Saturday 01 April 2006 11:53 am, Brian Hulley wrote:
> Claus Reinke wrote:
> > the usual way to achieve this uses the overloading of Nums in Haskell:
> > when you write '1' or '1+2', the meaning of those expressions depends
> > on their types. in particular, the example above uses 'T Double', not
> > just 'Double'.
> However there is nothing in the functions themselves that restricts their
> use to just T Double. Thus the functions can be compared for equality by
> supplying an argument of type T Double but used elsewhere in the program
> with args of type (plain) Double eg:

Overloaded functions instantiated at different types are not (in general) the 
same function.  If you mentally do the dictionary-translation, you'll see 

In particular for f, g :: XYZ a => a -> b, and types n m such that (XYZ n) and 
(XYZ m),

f :: (n -> b) === g :: (n -> b)

does *not* imply

f :: (m -> b) === g :: (m -> b)

That is where your argument falls down.

Rob Dockins

More information about the Haskell-Cafe mailing list