[Haskell-cafe] Rank-2 polymorphism and overloading

David Menendez dave at zednenem.com
Thu Apr 29 16:56:05 EDT 2010

On Mon, Apr 26, 2010 at 2:55 PM, Thomas van Noort <thomas at cs.ru.nl> wrote:
> On 26-4-2010 20:12, Daniel Fischer wrote:
>> Am Montag 26 April 2010 19:52:23 schrieb Thomas van Noort:
>>> ...
>> Yes, y's type is more general than the type required by f, hence y is an
>> acceptable argument for f - even z :: forall a b. a ->  b ->  Bool is.
> That's what I thought. I've just never seen such a notion of a more general
> type involving overloading before.
>>> However, it requires y to throw away the provided
>>> dictionary under the hood, which seems counter intuitive to me.
>> Why? y doesn't need the dictionary, so it just ignores it.
> Sure, but y's type explicitly mentions that it doesn't want a dictionary, so
> why would you provide one to it?

Actually, y's type doesn't say anything at all about dictionaries.
That's a detail about GHC's implementation.

y's type says it will accept two values of any type. f's type says it
will provide two values of a type which is an instance of Eq.

Dave Menendez <dave at zednenem.com>

More information about the Haskell-Cafe mailing list