Closed p4l1ly closed 7 years ago
Thanks for your interest.
Your implementation assumes that we're always using a function that returns something wrapped in the identity object, which means that it doesn't support get
or get_all
. Supporting them would be a requirement for merging.
There's not any principled way to implement this, as far as I know, because that would require you to be able to join the multiple result objects together (i.e. that they are monads, which const is certainly not). You could maybe implement this by peeking inside the object and messing around with its internals. Very dirty, but I would not be wholly against that.
I added a primitive "kinds" system to the library that allows it to know what capabilities an optic has. It makes it easier to work with the more obscure optics. What we have here is an optic known as a "Setter". I have merged it as such.
I have added a new LensLike class: ForkedLens. It is similar to the ComposedLens but the composition is parallel from the point, where the lens starts. Maybe some more optimization should be added, but I have not study the internals of your library so deeply that I could optimize it.