[Haskell-cafe] Rank-2 polymorphism and overloading
Thomas van Noort
thomas at cs.ru.nl
Mon Apr 26 14:48:15 EDT 2010
On 26-4-2010 20:13, Jochem Berndsen wrote:
> Thomas van Noort wrote:
>> ...
>
> f requires a function that is able to compute, for two values of type a
> (which instantiates Eq), a Boolean.
>
> y certainly fulfills that requirement: it does not even require that the
> values are of a type instantiating Eq.
>
> This is also well-typed and might or might not be enlightening:
>
>> z :: forall a. Eq a => a -> a -> Bool
>> z = y
>>
>> g :: (Bool, Bool)
>> g = (f x, f z) -- note the use of z here instead of y
I find your example of z more intuitive as it is z that does not provide
its dictionary to y, but throws it away explicitly. This in contrast to
y that is provided a dictionary but throws it away implicitly.
Regards,
Thomas
>
> Jochem
More information about the Haskell-Cafe
mailing list