On Mon, Oct 25, 2010 at 3:16 AM, Simon Peyton-Jones
<[email protected]> wrote:
> | On a related note, these are also apparently allowed (in 6.10.4):
> |     f :: forall a. (Eq a => a -> a) -> a -> a
> |    -- the Eq context prevents the function from ever being called.
>
> That's not true.  E.g.
>        f ((==) True) True
> works fine.

What I meant is that f cannot call its argument. That is,

  f :: forall a. (Eq a => a -> a) -> a -> a
  f g x = g x

is ill-typed.

>
> |    g :: forall a. Ord a => (Eq a => a -> a) -> a -> a
> |    -- the Eq context is effectively ignored
>
> That's a bit more true, because Ord a implies Eq a, but still not really.  It 
> still says
> that you must pass evidence for equality to g's argument.

Is that different from forall a. Ord a => (a -> a) -> a -> a?

-- 
Dave Menendez <[email protected]>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to