Type classes vs C++ overloading Re: [Haskell-cafe] Messing around with types [newbie]

Cristiano Paris cristiano.paris.ml at gmail.com
Fri Jun 22 05:56:40 EDT 2007


On 6/22/07, Tomasz Zielonka <tomasz.zielonka at gmail.com> wrote:
...

> The problem is not that it can't tell whether 5.0 and 10 would fit Int
> and Double (actually, they do fit), it's that it can't tell if they
> won't fit another instance of FooOp.


You expressed the concept in more correct terms but I intended the same...
I'm starting to understand now.

>
> Instances are duplicate if they have the same (or overlapping) instance
> heads. An instance head is the thing after =>. What's before => doesn't
> count.


So, the context is irrelevant to distinguishing instances?

> It seems that Num and Fractional are somewhat related. Any hint?
>
> It's not important here, but indeed they are:
>    class (Num a) => Fractional a where


I see. Thank you Tomasz.

Cristiano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070622/b0b2e39f/attachment.htm


More information about the Haskell-Cafe mailing list