On Thu, 27 Jan 2005, 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...
>
> I imagine there is some operator that does this e.g.
>
>     foo {bar =* fn}
>
> But I don't know what it is...

If you have only few different record fields you may like to define an
update function for each record field.

updateBar fn foo = foo {bar = fn (bar foo)}

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to