[Haskell-cafe] Instances that shouldn't overlap

J. Garrett Morris jgmorris at cecs.pdx.edu
Wed Nov 26 17:05:49 EST 2008


On Wed, Nov 26, 2008 at 1:54 PM, Miguel Mitrofanov
<miguelimo38 at yandex.ru> wrote:
> Maybe it'd be more intuitive if written backwards:
>
> AppEq f a <= (Applicative f, Eq a)
>
> or even
>
> AppEq f a => (Applicative f, Eq a)

The first is good, the second isn't.  The first says the right thing:
if you can prove Applicative f and Eq a, you have a way to prove AppEq
f a.  The second has the implication the wrong way around.

Classes get the implication wrong too:  class Eq a => Ord a doesn't
say that if you can prove Eq a you can prove Ord a; it says that if
you can prove Ord a you can prove Eq a

 /g

-- 
I am in here


More information about the Haskell-Cafe mailing list