15 Jun
2004
15 Jun
'04
11:05 a.m.
At 11:30 15/06/04 +0200, Wolfgang Jeltsch wrote:
I'd say, classes in Haskell are similar to interfaces in Java.
I started my Haskell programming with that viewpoint, but got tripped up by it. A Java interface can be used as a type in its own right, but a Haskell class cannot. For example, you can't have a list of Eq's, only a list of some type that happens to be an Eq. The different list members can't be differently-typed instances of Eq. To emulate a Java interface, I have ended up creating algebraic data types whose components are functions. (I don't claim that's a good approach to Haskell programming, just what I ended up doing.) #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact