
On 23/02/2012 21:05, John Meacham wrote:
On Thu, Feb 23, 2012 at 8:18 AM, Bas van Dijk
wrote: On 23 February 2012 01:07, Evan Laforge
wrote: Good point, I had forgotten about the Prelude catch. I think I can go remove a bunch of ScopedTypedVariables now.
Note that Prelude.catch has been deprecated in favor of Control.Exception.catch. If you want to catch IOErrors you can either use ScopedTypedVariables or System.IO.Error.catchIOError.
Control.Exception.catch is not in haskell 98 or haskell 2010. It also requires pulling in some heavy extensions and actually has fundamentally different behavior than Prelude.catch. We definitely should not consider it a replacement.
We should consider Control.Exception.catch a generalisation of Prelude.catch. Having both exist was confusing, which is why Prelude.catch was deprecated. It does have a direct replacement: System.IO.Error.catchIOError. catch by itself doesn't require heavy extensions, but it is a bit easier to use with pattern types signatures (which is only available with ScopedTypeVariables, but that's because we're too lazy to separate them.) The right getEnv is easily available as (tryIOError . getEnv). I don't disagree with this proposal though - I think we added getEnv at a time when we were feeling all gung-ho about exceptions, in retrospect this was a bad place to use them. Cheers, Simon