There is (a key) part of Stack’s code base that, simplifying, is like:
pure $ mask $ \restore -> do
eres <- try $ restore $ actionDo ...
atomically $ do ...
restore loop
I understand from its Haddock documentation (base
package, Control.Exception
) that restore
‘turns off’ the mask (strictly “restores the prevailing masking state within the context of the masked computation”). So, I reason that the following code should be equivalent to that above:
pure $ do
eres <- try $ actionDo ...
mask_ $ atomically $ do ...
loop
That is, the mask is effectively only applied to the action atomically $ do ...
.
My question is, does my reasoning seem sound, or am I missing something?