[Haskell-cafe] Use unsafePerformIO to catch Exception?
jonathanccast at fastmail.fm
Wed Mar 25 17:33:39 EDT 2009
On Wed, 2009-03-25 at 22:32 +0100, Henning Thielemann wrote:
> On Wed, 25 Mar 2009, Jonathan Cast wrote:
> > On Wed, 2009-03-25 at 07:39 -0400, Xiao-Yong Jin wrote:
> >> Could you elaborate more about why this kind of breakage
> >> wouldn't happen if 'try' is used in an IO monad as intended?
> > It would. But it would happen in IO, which is allowed to be
> > non-deterministic. Pure Haskell is not allowed to be non-deterministic.
> In my opinion, 'try' catching 'error's is still a hack, since 'error's aka
> bottom mean programming error. Thus catching them is debugging, bug hiding
> or something worse, but not exception handling.
100% agreed. The nice thing about the extensible exceptions is that you
*can* decline to handle ErrorCall `exceptions'; but errors caught by try
should be viewed analogously to signals or asynchronous exceptions. The
RTS sometimes detects a bug and (sometimes!) stops execution with an
exception; the user sometimes detects the bug and (sometimes!) stops
execution with SIGINT. The most you can do is try to limit the amount
of secondary damage and give the programmer the best clue where to start
More information about the Haskell-Cafe