[Haskell-cafe] Field updates in a state monad

Chaddaï Fouché chaddai.fouche at gmail.com
Thu Jan 10 13:10:10 EST 2008

2008/1/10, Lutz Donnerhacke <lutz at iks-jena.de>:
> * Michael Roth wrote:
> > Exists there a way to write this cleaner without writing countless
> > "set_xyz" helper functions?
> The syntactic sugar for record modifications is simply that: sugar.
> You might write your own modifier functions:
>   set_bla x y = x { bla = y }

That seems to be exactly what Michael search to avoid. And I don't see
any way to do that with the haskell records. Some extension of records
may have first-class label though.

A pretty interesting alternative could be HList, it has first-class
label and a bunch of other good stuff. I never used it though, so I
don't know how it affects the performances, if someone could give his
experience with it ?


More information about the Haskell-Cafe mailing list