-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optics #7
Comments
Hi! I have a few comments and ideas on the optics implementation. I'm just learning rust, coming from the Haskell/Swift/Kotlin world, so apologies for not using rusty syntax. Further apologies if all this information is known to you. A first thought is that your lens definition is not polymorphic. It is parameterized over just Another general comment: you've chosen what I think are called "normal" lens structures (i.e., a pair of functions), which is how I think Monocle defines them. The other notable approaches are profunctor optics ( Your lens structure getter is returning an Sorry for the Swift, but here's a quick set of definitions as I understand these types:
Using this approach, I find it easiest to define 1) how an optic composes with itself (e.g., Defining a fairly complete family of optics in this manner turns out not to be too complicated, with the only downside that you don't get composition via function composition; you have to provide your own composition operator/function. (Whereas profunctor lenses are simply functions that compose naturally.) I'd be curious to hear more of your thoughts on the direction you want to go on optics within this library. If you are interested, I can also share a more complete example of the above swift code that includes all the composition implementations. |
the readme mentions a |
No description provided.
The text was updated successfully, but these errors were encountered: