[Haskell-cafe] What's the difference?

Joachim Breitner mail at joachim-breitner.de
Tue Apr 8 15:15:21 EDT 2008


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

-- 
Joachim "nomeata" Breitner
  mail: mail at joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080408/d82ebcea/attachment.bin


More information about the Haskell-Cafe mailing list