Ticket #4865 (closed proposal: fixed)

Opened 2 years ago

Last modified 2 years ago

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: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

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

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

Change History

Changed 2 years ago by igloo

follow-up: ↓ 3   Changed 2 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.

in reply to: ↑ 2   Changed 2 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.

  Changed 2 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.

  Changed 2 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.

  Changed 2 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.

  Changed 2 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

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
Note: See TracTickets for help on using tickets.