I would like to use the temporary package with Shake, but that requires Action to have an instance for MonadMask, which is missing. Why does Shake not provide such an instance?
Why does Shake not provide a MonadMask instance for Action?
153 Views Asked by Neil Mitchell At
1
There are two reasons:
Actionis based on a continuation monad, and you can't implementMonadMaskfor a continuation monad. See this blog post for a rough justification of why that is impossible.However, Shake does provide
actionFinallyandactionOnExceptionas building blocks, which are a restricted variant of the functions available inMonadMask. In addition, Shake provideswithTempFileandwithTempDir, which do some of the same things as thetemporarypackage. And finally, if you are entirely inIO, thenliftIOandbracketworks fine.