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

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


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 <haugas at gmail.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101031/31e0130d/attachment.html


More information about the Haskell-Cafe mailing list