[Haskell-cafe] field record update syntax

John Meacham john at repetae.net
Fri Jan 28 06:30:19 EST 2005


On Thu, Jan 27, 2005 at 12:59:50PM -0500, S. Alexander Jacobson wrote:
> I have a lot of code of the form
> 
>   foo {bar = fn $ bar foo}
> 
> Is there a more concise syntax?  I am thinking 
> the record equivalent of C's foo+=5...
> 

you can use DrIFT to automatically create
bar_u to update a field and
bar_s to set a field.

They also behave nicer than the built in syntax as they pass through
constructors without the given field rather than return bottom.
        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell-Cafe mailing list