[Haskell-cafe] Re: what I learnt from my first serious haskell programm

Jón Fairbairn jon.fairbairn at cl.cam.ac.uk
Mon Mar 19 13:56:58 EDT 2007


Fawzi Mohamed <fmohamed at mac.com> writes:

> Vectors don't act like numbers, a vector space is not a
> field, even if they have some common operations.

That's a long-standing flaw in the design of numeric
classes. It's not a problem with typeclasses per se.

> I find it misleading to define something a number when it
> does not satisfy all the properties of numbers.

Justifiably so. But if you had a class Additive, would you
be unhappy about defining (+) on non-numbers?

> The numerical prelude might fix this, but still I think that
> class and overloading should be distinct concepts.

I think the problem here is that you are using the word
class to mean something different from Haskell
classes. Haskell typeclasses /are/ overloading, and that's
what I understand them as.  They were originally introduced
as a solution to the question of how to handle equality so
that one didn't have to use different names for the same
concept on different types.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2006-09-13)



More information about the Haskell-Cafe mailing list