bracket, (un)block and MonadIO
Simon Marlow
simonmar@microsoft.com
Mon, 8 Sep 2003 11:40:11 +0100
=20
> On Friday 05 September 2003 1:02 pm, Keith Wansbrough wrote:
> > > -- ** The @handle@ functions
> > > - handle, -- :: (Exception -> IO a) -> IO a -> IO a
> > > - handleJust,-- :: (Exception -> Maybe b) -> (b -> IO a)=20
> -> IO a -> IO a
> > > + handle, -- :: MonadIO m =3D> (Exception -> m a) -> m a -> m a
> > > + handleJust,-- :: (Exception -> Maybe b) -> (b -> m a)=20
> -> m a -> m a
> >
> > Is the MonadIO constraint on m intentionally missing from=20
> handleJust?
>=20
> No, it's an unfortunate omission. Thanks for pointing that out!
> Corrected patch attached.
This patch is still too deeply wired-in for my liking. It generalises
the types of all the IO-related functions in Control.Exception.
We don't intend to generalise *every* IO function over MonadIO, that's
what liftIO is for. And hence, we shouldn't also generalise functions
that take IO-typed arguments, since that is what liftIO' is for, and so
on. By all means provide the generalised versions for convenience, but
I don't believe we should generalise the originals.
Cheers,
Simon