Record of STRefs better than STRef to a Record?

Jorge Adriano jadrian@mat.uc.pt
Wed, 13 Nov 2002 23:05:02 +0000


> G'day all.
>
> > If I use an STRef to a record, will a new record be created each time=
 I
> > want to update a single field?
> Basically, yes.

Ok.


> > Right now I'm using a record of STRefs, like:
> > data E s =3D E{
> >       refi ::  STRef s Int,
> >       refc ::  STRef s Char
> >     }
> >
> You could always use IORefs, if you don't mind having the IO monad
> threaded through.

I'm using the Lazy version of ST with a monadic version of iterate to ret=
urn=20
an infinite list of values. Can't do that with IO...

Thanks,
J.A.