[Haskell] Annoying naming clashes
wolfgang at jeltsch.net
Tue Jun 15 05:30:24 EDT 2004
Am Dienstag, 15. Juni 2004 04:05 schrieb John Meacham:
> now classes are a bit trickier, the main thing is that classes in
> haskell are not like classes in other languages. A class in haskell is
> nothing more than a construct allowing you to reuse the same syntax on
> different types. (to hopefully do similar things)
Classes are not only for reusing the same syntax but also for polymorphism.
For example, the Num class doesn't exist solely for the purpose that I can
use the + operator with different types. It's also for the purpose that one
can, for example, define a function which sums up the elements of a list
where the element type isn't restricted to one specific numeric type.
I'd say, classes in Haskell are similar to interfaces in Java.
More information about the Haskell