Proposal: Deprecate and remove Prelude.catch and System.IO.Error.{catch,try}

kahl at kahl at
Mon Dec 27 17:29:29 CET 2010

On Mon, Dec 27, 2010 at 02:37:58PM +0100, Henning Thielemann wrote:
> On Mon, 27 Dec 2010, Ian Lynagh wrote:
> >
> > Hi all,
> >
> >    Deprecate and remove Prelude.catch and System.IO.Error.{catch,try}
> >
> >
> > Prelude and System.IO.Error both export an old version of catch, which
> > only catches IOError's, and System.IO.Error additionally exports try
> > with the same problem.
> This would mean, that Control.Exception.catch remains, that catches also 
> the non-exception "undefined".

Since ``undefined'' should be semantically equivalent to nontermination,
and nontermination in general cannot be caught (by the halting problem),
Control.Exception.catch has to be considered as impure,
while System.IO.Error.catch (also known as Prelude.catch)
was intentionally designed to be pure.

While System.IO.Error.catch may not be the best tool for all situations,
it therefore does have its place.

Deprecating the export from the prelude sounds okay
(should readFile and writeFile then also be taken out of the Prelude?),
but an export of the pure catch from System.IO definitely makes sense.
(Since the errors are a documented part of the interface,
 the way of catching them should be there, too.)


More information about the Libraries mailing list