Open robrix opened 9 years ago
Wow, so that's all a prism really is. Why couldn't someone have simply shown me this code when trying to learn about prisms, lenses, etc. Instead I ended up in the weeds of category theory barely understanding anything.
I think this and some of your other repos are the closest I've found so far for a pragmatic approach to these concepts.
Yup! The Haskellers will tend to use van Laarhoven lenses, which are a function type which sort of subsumes the separate get/set functions (and a lot more besides) and which compose with normal function composition.
Unfortunately you can’t really represent them in Swift without losing composition using the normal function composition operator, or type inference, or both. @cbarrett had some neat ideas involving phantom types, but I was never able to get it working.
Prism
s are neat! I’m using them in Tess for de/serializing, which is what gave me the idea of using them for parsing/pretty-printing.
I think this and some of your other repos are the closest I've found so for to a pragmatic approach to these concepts.
@neilpa: Thank you! I do try.
@neilpa: I should also note that Chris Eidhof’s lens post is what kicked off my (implementation) journey, and @robb has a nice Lens
library named Monocle which I intend to add Prism
to.
Thanks for the links, enlightening stuff. Helps to solidify some of the ideas I've been experimenting with for end-to-end modeling of collections for UI as "patch sequences".
Nice! I’ve been using diffs in similar circumstances to that, and have been quite pleased with the results.
Prism
.Prism
s returnEither
) once #77 has been merged.Prism
s.master
in.Stream<T>
.Stream<T>
.