I’m working through the book “Lenses for the Mere Mortal.”
Are there polymorphic lenses, such that I can define a lens ‘_position’ that operates on any data type that has a ‘position’ field?
I’m working through the book “Lenses for the Mere Mortal.”
Are there polymorphic lenses, such that I can define a lens ‘_position’ that operates on any data type that has a ‘position’ field?
Thanks, that looks good. By any chance can you explain how that lens can be “type-changing”? How do I implement the algorithm for the type change? There’s not much of an example in the documentation.
Wait I think I figured it out. It will change type based on the function provided to ‘over’ from Data.Lens.
@mike1127 I’m still gradually adding documentation to Data.Lens
. If you want help documenting Data.Lens.Record
or want to give me examples to use in its documentation, give me a shout. (I’ve never used it.) marick@exampler.com