[Haskell] Annoying naming clashes

John Meacham john at repetae.net
Tue Jun 15 06:02:18 EDT 2004

On Tue, Jun 15, 2004 at 11:30:24AM +0200, Wolfgang Jeltsch wrote:
> 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.

yes, and that summing function is a piece of reusable syntax. Whether
something is a class member or built on class members is nicely
abstracted away in haskell. (at least for those not creating new
instances). Yeah, polymorphism is the right term, but not always the
best one when trying to explain basic haskell to my impertive minded

I find trying to draw analogies between haskell classes and constructs
in other languages to be problematic as people then try to apply
knowledge from other fields incorrectly to haskell unless you give a
full explanation of haskell classes anyway.. but YMMV. 

John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell mailing list