Conversation
|
The violated "law" is "5.5 No duplication of elements" in http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf |
|
@phadej I see. I don't get why is that a problem though. λ> let once = simple
λ> let twice = simple `adjoin` simple
λ> over once (+1) 7
8
λ> over twice (+1) 7
8Even though |
|
This looks great to me. I agree that exporting it normally is fine; it's no worse than say
although maybe a section in |
Yes please 🙏 |
| -- | ||
| -- >>> iview (ipartsOf (each `iadjoin` each)) ("x","y") | ||
| -- ([0,1,0,1],["x","y","x","y"]) | ||
| -- >>> iset (ipartsOf (each `iadjoin` each)) (const ["a","b","c","d"]) ("x","y") |
|
Thanks for the docs @adamgundry, LGTM to me :) |
Fixes #331.
It's reasonably fast when compared to a hand-written version (and obliterates
lens):When adjoining traversals that overlap I'm not sure which laws might be violated though. I suspect traversal composition law can be violated when the traversing function is stateful. I don't think setter laws can be violated.
Because of this I'm for exporting it normally.