Opened 7 years ago

Closed 7 years ago

#1152 closed bug (invalid)

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 (2)

comment:1 Changed 7 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

comment:2 Changed 7 years ago by igloo

  • Resolution set to invalid
  • Status changed from new to closed

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.