Open LightAndLight opened 2 years ago
If you do this, mask_
should be redefined to something like mask_ act = bracket act (pure (pure ())) pure
.
That said don't understand the benefit of this change. The main argument in #69 seemed to be 'I don't want the power of mask
' -- but bracket
already gives you mask_
. Is being able to restore the outer masking state inside an action worth another layer of hierarchy?
The STM
claim is compelling, but how is it possible to write bracket
for STM
without mask
?
I will say that defining mask
for a new instance is much more difficult than defining bracket, so the change might be worthwhile only for that reason. But a breaking change in a GHC dependency is a tough sell.
I think @dcoutts makes a good argument in #69.
In this PR I factored out MonadBracket and tweaked some documentation. The refactor took about 5 minutes, and I didn't have to change any instances. I'm happy with the result.
What do you think?
If this is something you'd like merged, I'll put in the time to do whatever chores are required to get it release-ready.