[Haskell-cafe] Future of MonadCatchIO
John Lato
jwlato at gmail.com
Mon Mar 4 03:14:34 CET 2013
On Mon, Mar 4, 2013 at 12:07 AM, Ertugrul Söylemez <es at ertes.de> wrote:
> Arie Peterson <ariep at xs4all.nl> wrote:
>
> > 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'?
>
> Yes. This is a simplified variant of a monad I use:
>
> newtype Continue f m a = Continue (m (Maybe a, f (Continue f a)))
>
> It's related to Cofree and has a valid and very straightforward
> MonadCatchIO instance. However, it's probably impossible to write a
> valid MonadTransControl/MonadBaseControl instance for it.
>
> So I kindly ask you not to deprecate MonadCatchIO. The reason I'm
> hesitant about moving to monad-control is that it's hard to understand
> and also very difficult to define for CPS monads. It is commonly
> believed to be impossible.
>
You can always cast the continuation to a dynamic type and cast it back
later.
Doing so would typically require additional constraints, however if you're
trying to make an instance for MonadTransControl that's unfortunately not
possible (you'd need a Typeable constraint on the monad parameter, but it's
not in scope). Lacking an appropriate MonadTransControlWithTypeable class,
it's certainly possible to fall back to various low-level, highly-dubious
constructs. Which I of course implemented without hesitation :grin
> Also I've seen at least one article about the incorrectness of
> monad-control. That's one further reason I like to avoid it.
>
I'd appreciate a link if anyone could manage to find it. I haven't seen
any criticisms of monad-control.
John L.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130304/5c28f351/attachment.htm>
More information about the Haskell-Cafe
mailing list