Data records. Default values initialisation. Reading datatype from string.

Hello, I need some help with data records. Normally I can use a `read' function to convert string to some data type e.g. `(read somestring) :: Type'. However, sometimes I'd like to read a record with some uninitialised fields. I have also set up a default values for my data record, for example: `defrec = {a=0,b=1, ..., z=0}'. Now I would like to override some values, so I have a string "defrec{l=100,r=88}", but it seems that it can't be done with read `(read "defRec{l=100,r=88}") :: defRec'. Any suggestions? Siim

Oh sorry, I had some mistakes in my previous mail..
`defrec = {a=0,b=1, ..., z=0}' should be `defrec =
SomeDataConstructor{a=0,b=1, ..., z=0}' .
Siim
On Mon, Nov 1, 2010 at 2:31 AM, Siim Haugas
Hello,
I need some help with data records. Normally I can use a `read' function to convert string to some data type e.g. `(read somestring) :: Type'. However, sometimes I'd like to read a record with some uninitialised fields. I have also set up a default values for my data record, for example: `defrec = {a=0,b=1, ..., z=0}'. Now I would like to override some values, so I have a string "defrec{l=100,r=88}", but it seems that it can't be done with read `(read "defRec{l=100,r=88}") :: defRec'.
Any suggestions?
Siim
participants (1)
-
Siim Haugas