[Haskell-cafe] Future of MonadCatchIO

Arie Peterson ariep at xs4all.nl
Sun Mar 3 16:40:06 CET 2013


Hi all,


The function 'block' and 'unblock' (from Control.Exception) have been 
deprecated for some time, and are apparantly now being removed (in favour of 
'mask').

Generalisations of these functions are (part of) the interface of 
MonadCatchIO-transformers (the 'MonadCatchIO' class has methods 'block' and 
'unblock'). So, the interface would have to change to keep up with base.

I'm inclined to deprecate MonadCatchIO-transformers itself, in favour of 
monad-control.

I suspect that most clients do not use 'block' or 'unblock' directly, but use 
only derived functions, like 'bracket'. (I have partly confirmed this, by 
inspecting some reverse dependencies on hackage.) This allow an easy 
transition to monad-control: in many cases, only imports will need to be 
changed. In the minority of cases where 'block' and 'unblock' are used and/or 
instances of MonadCatchIO are defined, code will need to be updated.

There is a difference in functionality between MonadCatchIO and monad-control. 
In the former, 'bracket' will not perform the final action if the main action 
is an ErrorT that throws an error (in contrast with exceptions in the 
underlying IO monad). In monad-control, 'bracket' will perform the final action 
in this case. (See this discussion for background:
<http://www.haskell.org/pipermail/haskell-cafe/2010-October/084890.html>.)

Probably, in most use cases the behaviour of monad-control is preferred. This 
seems to be the case also for snap, which uses MonadCatchIO-transformers, but 
defines its own variant of 'bracket' to get the right behaviour.


Would anyone have a problem with a deprecation of MonadCatchIO-transformers, 
and a failure to update it to work with a base without 'block' and 'unblock'?


Regards,

Arie




More information about the Haskell-Cafe mailing list