On 11 September 2010 18:21, Jonathan Geddes <geddes.jonat...@gmail.com> wrote:
>>someUpdate :: MyRecord -> MyRecord >>someUpdate myRecord = myRecord >> { field1 = f $ field1 myRecord >> , field2 = g $ field2 myRecord >> , field3 = h $ filed3 myRecord >> } Applicatively, using no additional libraries, is how I do it: updateAllThree :: MyRecord -> MyRecord updateAllThree = (\s a b c -> s { field1 = f a, field2 = g b, field3 = h c}) <*> field1 <*> field2 <*> field3 Note - (<$>) is not used, and the left hand function has one extra argument. This style exploits the fact that (<*>) is the Startling (S) combinator. Unfortunately, I haven't worked out how to do nested records in this style. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe