Open Davorak opened 10 years ago
Did you find that link? Is this still the case? We're using this in some production code and are hoping that this abstraction is not broken.
This is the discussion: https://groups.google.com/d/topic/haskell-pipes/kYrol5F4B5M/discussion
I can summarize the discussion by saying:
Proxy ... (SafeT IO)
is okaySafeT (Proxy ... IO)
is not okayThe reason why is that runSafeT
uses the MonadCatch
interface for the monad beneath it, which does the right thing if the monad beneath it is IO
, but does the wrong thing if the monad beneath it is Proxy
(because we can't use the MonadCatch
interface to call Pipes.Safe.bracket
).
I think there was a Haskell-pipes mailing list discussion that I started about this a while back. I will link it if I find it later, I searched for a few moments with out luck. I thought this should be documented for others to reference since it is often hard to search through mailing lists.
The conclusion as I remember it was the problem came down to
C.bracket
inrunSafeT
.The problem was really about Control.Monad.Catch and last I heard Edward, Gabriel, and Snoyman where going to put their head together and come up with a better Mona.Catch.
I think Gabriel has also mentioned using an idea that is in the ballpark of "free categories" to handle this type of problem among other things.
Here is the example that fails to close the "tmp2" file.
I have put the rest of the code in the following gist: https://gist.github.com/Davorak/f75f6df327cbc4742f16