Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-29 Thread David Menendez
On Mon, Apr 26, 2010 at 2:55 PM, Thomas van Noort 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 ::

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort
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

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort
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. T

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 19:52:23 schrieb Thomas van Noort: > Hello all, > > I'm having difficulties understanding rank-2 polymorphism in combination > with overloading. Consider the following contrived definition: > > f :: (forall a . Eq a => a -> a -> Bool) -> Bool > f eq = eq True True > > Then,

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Jochem Berndsen
Thomas van Noort wrote: > Hello all, > > I'm having difficulties understanding rank-2 polymorphism in combination > with overloading. Consider the following contrived definition: > > f :: (forall a . Eq a => a -> a -> Bool) -> Bool > f eq = eq True True > > Then, we pass f both an overloaded fun

[Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort
Hello all, I'm having difficulties understanding rank-2 polymorphism in combination with overloading. Consider the following contrived definition: f :: (forall a . Eq a => a -> a -> Bool) -> Bool f eq = eq True True Then, we pass f both an overloaded function and a regular polymorphic functi