Repository navigation
Add (i)adjoin - #332
Add (i)adjoin#332
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") |
There was a problem hiding this comment.
Nice example ð
|
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.