
Greetings, I often wonder how one would explain type classes to someone coming from an environment such as Java. Whenever I think about type classes, I seem to think of them as Java interfaces. Bah, even the bottom of [1] states
Haskell classes are roughly similar to a Java interface. Like an interface declaration, a Haskell class declaration defines a protocol for using an object rather than defining an object itself.
Is there more to this `roughly similar' statement? Syntax is an obvious difference but beyond that, I can't think of anything I can do with a Haskell type class that I wouldn't be able to do with similar amount of effort with a Java interface, except for the fact that the interface would look absolutely disgusting syntax wise. Any insight appreciated. [1] - http://www.haskell.org/tutorial/classes.html