[Haskell-cafe] Deprecation of MonadCatchIO-transformers

Arie Peterson ariep at xs4all.nl
Wed Nov 6 14:45:01 UTC 2013


Hi all,


As discussed before <http://www.mail-archive.com/haskell-cafe@haskell.org/msg104498.html>, the interface of the MonadCatchIO packages 
is effectively deprecated by the removal of the 'block' and 'unblock' functions 
in base-4.7. I would like to deprecate MonadCatchIO-transformers now.

As there are quite a few reverse dependencies, and as there is at least one 
use case that apparently cannot be migrated easily <http://www.mail-archive.com/haskell-cafe@haskell.org/msg104501.html>, I will try to keep the 
package functioning, for now.

In order to do this, I followed Edward Z. Yang's suggestion, and re-
implemented the IO instances of block and unblock, in terms of GHC primitives. 
The instance now reads

> import qualified Control.Exception.Extensible as E
> import GHC.Base (maskAsyncExceptions#)
> import GHC.IO (unsafeUnmask,IO(IO))
> 
> instance MonadCatchIO IO where
>   catch   = E.catch
>   block   = \ (IO io) -> IO $ maskAsyncExceptions# io
>   unblock = unsafeUnmask


You can get a release candidate for a new version 0.3.1.0, by

darcs get http://patch-tag.com/r/AriePeterson/MonadCatchIO-transformers

I would be most grateful if someone could review and/or test this under GHC 
7.8!


Regards,

Arie



More information about the Haskell-Cafe mailing list