[Haskell-beginners] Typeclasses vs. Data

Brent Yorgey byorgey at seas.upenn.edu
Thu Jul 21 15:08:10 CEST 2011


On Thu, Jul 21, 2011 at 12:26:15PM +0200, Thomas wrote:
> 
> I just wonder: Are typeclasses such an advanced feature that I'd
> better use alternatives wherever possible?

No. Typeclasses are a (relatively) straightforward, and quite useful,
feature.  Yitzchak was arguing that type classes are often overused by
beginners, for purposes where other, better solutions exist.  If you
find yourself using type classes all over the place for everything
then perhaps you are using them too much.  But there is no need to
avoid them completely, and certainly not because they are "too
advanced".

The obvious question you may be wondering is "well, when should I use
them and when shouldn't I?" Unfortunately I can't answer that off the
top of my head.  Just read and write a lot of code, try out different
ways of solving problems, and you'll start to get a feel for what
works well and what doesn't.

-Brent



More information about the Beginners mailing list