Open noughtmare opened 1 year ago
This feels way too specialized. Most combinations of operations can probably be implemented more efficiently by having a combined operation, but that doesn't mean we should do it. This isn't something I'd expect any library to implement, on the contrary, I'd feel like this would be bloat.
I've been wanting to make an equivalent of the Data.Map
mergeA
interface for sets for a long time, but I've never gotten around to it. That would include this operation.
@treeowl that sounds much better than what I proposed here!
Which applicative would you use? I believe the straightforward Writer (Set a)
wouldn't have the right time complexity, or would it?
I'd think
data Pair a = Pair a a
We'd have to make sure it generated good code in typical cases.
Set difference and union sometimes have to be computed together, such as in semi-naive fixed point computation:
If there was a combined operation:
Then I can write it more efficiently: