Record of STRefs better than STRef to a Record?

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


Hi all,=20
If I use an STRef to a record, will a new record be created each time I w=
ant=20
to update a single field? Or can I expect GHC to optimize it and have the=
=20
field of the record updated in place?

Right now I'm using a record of STRefs, like:
data E s =3D E{
      refi ::  STRef s Int,
      refc ::  STRef s Char
    }

but it can get a little messy, since thread s propagates to every datatyp=
e=20
that uses the record type in it's definition.
Thanks,
J.A.