[Haskell-cafe] What's the difference?

Dan Weston westondan at imageworks.com
Tue Apr 8 17:58:57 EDT 2008

Yes, sorry I should have read the post more carefully. I was talking 
specifically the use of => in class declarations, and this is a good 
example of how inconsistent the notation seems to me.

It is in the class declaration that the arrow is backwards. (I imagine 
this decision was more syntactically motivated by the fact that <= is 
already the less-than-or-equal-to symbol, rather than intended semantic 

class    Necessary  a => My a   i.e. My a implies Necessary a
instance Sufficient a => My a   i.e. Sufficient a implies My a

I pronounce the => in class declarations as "required for", and in 
instance definitions as "sufficient for".

For me, the word "implies" is too tied in my brain to an arrow symbol to 
be useful to me in keeping the implications straight.


Joachim Breitner wrote:
> Hi,
> Am Dienstag, den 08.04.2008, 11:51 -0700 schrieb Dan Weston:
>> Paul Johnson wrote:
>>> You can regard an "instance" declaration as an inference rule for the 
>>> type checker, with "=>" meaning "implies" (though I don't think its the 
>>> answer to your other question about names).
>> "implies" might be a bad word, because the direction is backwards:
>> Eq a => Ord a
>> is clearly false if read that "Eq a implies Ord a". It is Ord a that 
>> implies Eq a.
>> I just read it as "required for" myself.
> I think both can be justified. Take
>> instance X a => Y a where ...
> "X a" is required so that the instance declaration can be used.
> But also:
> Given this declaration, having an instance "X a" implies that you will
> also have an instance "Y a". But not not every type with "Y b" will also
> have "Y a".
> Or were you talking about constraints in the class declaration, which
> your choice of Eq and Ord suggests?
> Greetings,
> Joachim
> ------------------------------------------------------------------------
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list