Closed jdegoes closed 7 years ago
That was kind of the idea with the original formulation that had cancelWith
as a member (cancelWith is just difficult to implement in general). The problem with cancellation is that your effects may have already run (in fact if its all synchronous effects, it definitely has already run), and so while you can say they are algebraically equivalent, they are a far cry from being observably equivalent. For example, with this law, it suggestively implies that cancelling immediately after forking an effect is observably equivalent to throwing before running the effect, which is not possible in any forking environment (JS engines or otherwise).
I'm not sure this is easy, but there's some intention here that may be able to be expressed as a law with a slightly richer Monad.
Not this, but along these lines: