[Haskell-cafe] Data records. Default values initialisation. Reading datatype from string.

Siim Haugas haugas at gmail.com
Sun Oct 31 20:31:42 EDT 2010


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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101031/7760edd9/attachment.html

More information about the Haskell-Cafe mailing list