Ticket #1152 (closed bug: invalid)

Opened 6 years ago

Last modified 6 years ago

Unexcepted behaviour of Control.Exception.catch

Reported by: tobi@… Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.6
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Hi,

I'm running GHC Interactive, version 6.6, for Haskell 98 on a Suse Linux 9.3 Distribution.

the expression

Control.Exception.catch (Control.Exception.throw (Control.Exception.AssertionFailed? "error"))(\e -> return "caught")

evaluates to the expected value "caught". But the expression

Control.Exception.catch (return (Control.Exception.throw (Control.Exception.AssertionFailed? "error")))(\e -> return "caught")

stops with the message: "*** Exception: error which seems to be an error (at least from my point of view).

best regards

Tobias

Change History

Changed 6 years ago by guest

Hi,

I'm running GHC Interactive, version 6.6, for Haskell 98 on a Suse Linux 9.3 Distribution.

the expression

Control.Exception.catch (Control.Exception.throw (Control.Exception.AssertionFailed "error"))(\e -> return "caught")

evaluates to the expected value "caught". But the expression

Control.Exception.catch (return (Control.Exception.throw (Control.Exception.AssertionFailed "error")))(\e -> return "caught")

stops with the message: "*** Exception: error

which seems to be an error (at least from my point of view).

best regards

Tobias

Changed 6 years ago by igloo

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

This is actually expected behaviour. In the second expression the value throw ... isn't demanded by catch as it is happy with return <thunk>. The thunk is then evaluated outside of the catch and the exception is raised.

Note: See TracTickets for help on using tickets.