
"Scott J."
wrote, Is it possible to define oject types in Haskell and what does one
Sorry for my late reply,
But is it possible to be more specific (little examples)
In Haskell one can use existential lists but I doubt about the efficiency.
It is not my aim to make of everything an object like in Jave e.g. . The
objects I have in mind are showable ojects: windows, scrollbars,
messageboxes, etc. . Of such objects I demand fast response with respect to
key input or mouse clicks. I am sure Ocamel can do that.
Regards
Scott
----- Original Message -----
From: "Manuel M T Chakravarty"
Depends on what you mean by object types. You can surely define a record with funcions dubbing as methods and non-functional values dubbing as object data.
Is it possible to define parts of a record with the help of the ST s
monad mutable during the whole program? (As is possible in Ocamel)?
Just make the fields that you want to update be values of `STRef s a'. (You can also do the same with the IO monad and `IORef's.)
Having said this, there are not that many situations where you need to do this (and in consequence ST-monadify your program). Purely functional updates (using the record syntax) where the system effectively copies the whole record (not all data in it, just the references to that data) is perfectly suitable in most cases. If you are concerned about efficiency first profile the code to see whether the performance bottleneck is really where you think it is.
Cheers, Manuel