Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Jonathan Geddes
Evan Laforge wrote: I consider that a strength of the lens approach. If I say 'set (a.b.c.d) 42 record', 'a', 'b' etc. don't have to be record fields, I can swap them out for other lenses later on. I can also easily precompose, e.g. 'setThis = a . b; setThat = b . c' and encourage people to use

Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Ryan Ingram
On Fri, Aug 3, 2012 at 10:11 AM, Jonathan Geddes geddes.jonat...@gmail.comwrote: The nice part about the SEC functions is that they compose as regular functions. Lenses are super powerful in that they form a category. Unfortunately using categories other than functions feels a tad unwieldy

Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Ryan Ingram
Oops, forgot my references [1] Original post: http://www.twanvl.nl/blog/haskell/cps-functional-references [2] polymorphic update support: http://r6.ca/blog/20120623T104901Z.html [3] another post about these: http://comonad.com/reader/2012/mirrored-lenses/ On Fri, Aug 3, 2012 at 1:53 PM, Ryan

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Richard O'Keefe
On 2/08/2012, at 5:34 PM, Jonathan Geddes wrote: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that this kind of thing violates the Law of Demeter and that an

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Erik Hesselink
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 On Thu, Aug 2, 2012 at 7:34 AM, Jonathan Geddes geddes.jonat...@gmail.com

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Andrew Butterfield
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

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Andrew Butterfield
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 andrew.butterfi...@scss.tcd.ie wrote: On 2 Aug

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Erik Hesselink
On Thu, Aug 2, 2012 at 12:30 PM, Andrew Butterfield andrew.butterfi...@scss.tcd.ie 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]

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Jonathan Geddes
Richard O'Keefe Said: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that this kind of thing violates the Law of Demeter and that an object should not be

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Thiago Negri
I'm new to Haskell, but I do like your idea. I prefer this as a built-in feature because it will create a standard way of doing this, making the question wich package should I use to get mutatos? lens-foo, lens-bar, monad-lens, lens-lens-foo-bar, ...? simply go away. So, yes, I up-vote your idea

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Evan Laforge
On Thu, Aug 2, 2012 at 9:00 AM, Jonathan Geddes geddes.jonat...@gmail.com wrote: Richard O'Keefe Said: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that