On Fri, Nov 12, 2010 at 22:48, Jonathan Geddes <geddes.jonat...@gmail.com> wrote: >> Records do leave quite a bit to be desired. But does anybody actually have a >> concrete alternative proposal yet? > > A few months ago I proposed a couple of extensions [1] on -cafe.
[snip] > Consider what this would do for nested updates: > >>UpdateTripleInner :: (Inner->Inner) -> MyTriplyNestedRecord -> >>MyTriplyNestedRecord >>UpdateTripleInner f = \{inner1 => \{inner2 => \{inner3 => f }}} > > I cringe to imagine what the equivalent is in current Haskell syntax. > Anyone want to try it? Not me! You can do this very conveniently already using the fclabels package: updateTrippleInner = modL (inner3 . inner2 . inner1) Here, inner1/2/3 are not record fields, but Lenses. You have to construct the lenses themselves, but this is very easy, and can be automated using Template Haskell. Other packages like data-accessor have similar functionality. Erik _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe