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

David House dmhouse at gmail.com
Mon Mar 19 13:04:13 EDT 2007

On 19/03/07, Fawzi Mohamed <fmohamed at mac.com> wrote:
> This is is very ugly in my opinion, because for me a type class should
> represent something more than just a way to overload, is something is
> not a number then it should not have the class Num.

Num is a collection of types whose members can be added and subtracted
and so on. As numbers are the most common example of this, one could
say the members of Num _act like numbers_, rather than are numbers in

Really typeclasses are all about overloading. For example, Eq is the
collection of types that the equality predicate (==) applies to. I
don't see this as ugly; quite the contrary, in that if you know a type
instantiates Eq you can use (==) without worrying about using a
type-specific equality predicate. E.g. it's nice to see the same (==)
everywhere rather than seeing (say) (Int.==), (Bool.==) and so on.

-David House, dmhouse at gmail.com

More information about the Haskell-Cafe mailing list