
Ah yes - the joy of Haskell It so easy to roll your own, rather than search to find someone else's (better/more elegant) solution... :-) On 2 Aug 2012, at 11:41, Erik Hesselink wrote:
On Thu, Aug 2, 2012 at 12:30 PM, Andrew Butterfield
wrote: On 2 Aug 2012, at 09:25, Erik Hesselink wrote:
Isn't this exactly the problem solved by all the lens packages? Current popular ones are fclabels [0] and data-lens [1].
[0] http://hackage.haskell.org/package/fclabels [1] http://hackage.haskell.org/package/data-lens
Not sure what all of these do, but I have a simple solution I use in my work:
They do exactly that. They create 'lenses' which are getters/setters/modifiers combined, and allow you to compose these to get/set/modify deep inside nested data types. Look at the examples in the fclabels documentation [2] for more details.
[2] http://hackage.haskell.org/packages/archive/fclabels/1.1.4/doc/html/Data-Lab...
-------------------------------------------------------------------- Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations & Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ --------------------------------------------------------------------