7 ms·
The papers define the "profunctor optics" mechanism, so it's not really that it isn't understood: it's really Haskell code that implements lenses and prisms, wh
by theoh 8y ago
The papers define the "profunctor optics" mechanism, so it's not really that it isn't understood: it's really Haskell code that implements lenses and prisms, which previously had less elegant formulations.
Yes, there is also Bartosz Milewski having a go at applying category theory to explain why profunctor optics work. But that's not an essential part of understanding them: they clearly do what they are designed to do. This is programming, not physics.
- Double_a_92 8y agoIf I can't roughly explain what something is in 2-3 sentences I don't think I understood it well enough. Your description didn't really help me either. Lenses and prisms are just glass objects to me. Just from thinking about lenses, I guess It could be something that bundles and unbundles function calls... But no idea.
- theoh 8y agoI didn't describe them! I just told you what the state of play is. A lens is a "functional reference". Say you have a data structure of some kind. You can create a lens which points at one of the fields. It lets you get and set that field. Because this is functional programming, when you set the field, you get given a new reference to the whole structure (can't change things in place). So, naturally the way lenses are used involves combinining a reference to a structure of type A, a lens which refers to a field within type A, and, if you are setting the field (not getting it) then you supply the new value as well. The jury is still out on whether writing programs in this style is wise, but the notion of a lens is fixed now.