[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: [Haskell-cafe] Future of MonadCatchIO
From: "Edward Z. Yang" <ezyang () MIT ! EDU>
Date: 2013-03-26 22:38:27
Message-ID: 1364337397-sup-6994 () javelin
[Download RAW message or body]
While block and unblock have been removed from base, they are still implementable
in modern GHC. So another possible future is to deprecate MonadCatchIO
(which should have been done a while ago, honestly!), but manually redefine
the functions so that old code keeps working.
Edward
Excerpts from Arie Peterson's message of Sun Mar 03 07:40:06 -0800 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
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic