[Haskell-cafe] Re: I/O interface

Keean Schupke k.schupke at imperial.ac.uk
Thu Jan 20 07:06:10 EST 2005


Andre Pang wrote:

> Just because you can encode the OO idioms in Haskell doesn't mean it's 
> particularly straightforward to use them.  As your example shows, 
> getting the syntax right for these OOish constructs isn't easy (not to 
> mention verbose), and even so, the type errors you face when you get 
> things wrong are, well, long :).

This is true enough... but it really isn't as dificault as it looks. 
Once you get used to
the style it is really quite easy - and notice how you don't need class 
definitions, or
types for the objects - it is all derived by GHC. This is an advance 
over current OO
languages.

> I guess my point is that in theory, Haskell can support OO right now.  
> In practice, it's something that isn't very tasty.

I find it no harder than writing with monads for example... certainly 
there are some
tricky things going on in both... but that doesn't stop people using 
monads for IO,
state etc.

Syntactic sugar over the top for instance and implementation definitions 
is something
we are working on (using template-haskell) - so that end of things can 
certainly be
made neater for the user.

The big problem I guess is error messages - and that would require some user
defined way of throwing compile time errors.

    Keean.



More information about the Haskell-Cafe mailing list