mutable records

Iavor S. Diatchki
Mon, 09 Sep 2002 13:45:37 -0700


> 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)?

you can find an example of how to do that at:

look inside module Robo for example.  there you will find examples of 
records with mutable fields and some useful functions to manipulate 
them.  the state of the "objects" is not hidden so it is available for 
anyone to modify.  to hide the state you could use fancy types as people 
already pointed out, or you could use the Haskell module system. 
unfortunatelly with the Haskell module system approach you soon run into 
recursive modules (when objects depend on each other) and this is not 
well supported by Haskell implementations at the moment.


| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
|               |