[Haskell-cafe] Representation of lenses
dct25-561bs at mythic-beasts.com
Tue Jan 27 20:29:49 UTC 2015
On 27 January 2015 at 17:23, Charles Durham <ratzes at gmail.com> wrote:
> You need to sign up for it, but this is a phenomenal talk by simon peyton
> jones describing the idea behind lenses the way he understood it.
Thanks, I think that was exactly what I needed to know.
If I understand the key section right, you can do all that stuff with
a straight get/set pair but it'd be desperately inefficient, so then
you add an update function, and then one at Maybe and  and IO and
they all start to look the same so you generalise to all Functors, and
then you discover that using Const you get a getter, and Identity
gives you a setter, so you can throw them away and end up with a lens
as we know it.
And then you generalise it in about a billion other directions and you
end up with the lens library!
More information about the Haskell-Cafe