[Haskell-beginners] Re: data constructor with IO type
Daneel Yaitskov
rtfm.rtfm.rtfm at gmail.com
Tue Feb 24 16:12:28 EST 2009
Brent Yorgey <byorgey at seas.upenn.edu> writes:
>
> Note that record syntax like
>
>> data TestB = TestB { xGetB :: MVar Bool }
>
> only adds capabilities; you can still use TestB as if it was defined
> without record syntax, like TestA. So you are not required to use the
>
> TestB {xGetB = tmp}
>
> syntax to create a TestB, you could also just say 'TestB tmp'. So the
> second code example should work fine if you just replace all the 'A's
> with 'B's.
>
> Does this answer your question? I must admit that I am not entirely
> sure what you are asking, so if this doesn't address your question
> feel free to clarify.
>
> -Brent
I know about it. I mean how to save names of arguments.
Because usually data structures is complex and they contain many fields.
Method which doesn't the names of the arguments requires to give the
values for all members. Sometimes some subsets of one structure calculate
themselves at other places or structure contains many fields. One part of
them get themselves from the pure functions and other do from the action
functions.
Daneel Yaitskov
More information about the Beginners
mailing list