Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#4865 closed proposal (fixed)

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

Reported by: igloo Owned by:
Priority: normal Milestone: Not GHC
Component: libraries/base Version: 7.0.1
Keywords: report-impact Cc: hvr, ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Prelude and System.IO.Error both export an old version of catch, which only catches IOErrors, and System.IO.Error additionally exports try with the same problem.

These exports are annoying for people who want to use the modern exception handling functions in Control.Exception, as you need to explicitly either import the Prelude with catch hidden, or give the module of the function you want to use.

They may also be confusing for beginners, who may not expect to have to use anything other than the catch function in the default scope to catch all exceptions.

I believe these functions are only there for historical reasons, and are old cruft that we should tidy up, so I propose that in the base package that comes with GHC 7.2 we deprecate these old functions, and in 7.4 we remove them.

Suggested deadline: 24 Jan 2011.

Attachments (1)

dep.dpatch (61.6 KB) - added by igloo 7 years ago.

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by igloo

Attachment: dep.dpatch added

comment:2 Changed 7 years ago by malcolm.wallace@…

Prelude.catch is defined in the Haskell Language Report (section 7.3. of H'2010) I believe this proposal should therefore be a Haskell-prime language proposal, rather than a library proposal.

comment:3 in reply to:  2 Changed 7 years ago by igloo

Replying to malcolm.wallace@…:

Prelude.catch is defined in the Haskell Language Report (section 7.3. of H'2010) I believe this proposal should therefore be a Haskell-prime language proposal, rather than a library proposal.

I disagree; AFAIK we'll continue to use library proposals for libraries like Data.List that the standards now describe, so I don't see why Prelude should be any different.

comment:4 Changed 7 years ago by malcolm.wallace@…

My point is that the Report section 7.3 describes "Exception handling in the I/O monad", as part of a chapter on "Basic input/output". It is not just a matter of updating some auto-generated library documentation - it will need a hand-written report delta.

comment:5 Changed 7 years ago by igloo

Both the library and the report will need to be changed, but I think the library process is the more appropriate for making the decision.

comment:6 Changed 7 years ago by simonmar

Ian's right. We use the library proposal process for making changes to the base package, and separately there can be a Haskell' proposal for changing the Report and the official standard libraries (the haskell98 and haskell2010 packages).

However, if this proposal is implemented, it would cause a problem for GHC's Haskell 98 support, which currently shares the Prelude with the base package. (Haskell 2010 is unaffected, because it has its own Prelude in the haskell2010 package). Thus, we would need to add a Haskell 98 Prelude to the haskell98 package, which would then become incompatible with base, in the same way that haskell2010 is.

comment:7 Changed 7 years ago by igloo

Resolution: fixed
Status: newclosed

Consensus was to apply the proposal, with several people expressing support, and only one against.

Additionally, catchIOError and tryIOError functions were added to System.IO.Error, so that the module includes functions to handle the exceptions it exports, and so that the language report has exception functions to refer to.

Sat Feb  5 15:53:54 GMT 2011  Ian Lynagh <igloo@earth.li>
  * Deprecate System.IO.Error.{catch,try} and Prelude.catch; fixes trac #4865

comment:8 Changed 3 years ago by hvr

Cc: hvr ekmett added
Keywords: report-impact added
Note: See TracTickets for help on using tickets.