
#14998: Sort out the strictness mess for exceptions -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.3 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Exceptions Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sgraf): Re Item 2: A net loss (0.2% Allocs, 0.1% Instr). `reverse-complement` allocates 11.6% more, `sphere` executes 4.4% more instructions, `binary- trees` 0.9% less. This was the diff: {{{ diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 118ebea..554b4e3 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -142,7 +142,7 @@ have to work around that in the definition of catch below). -- @catchException undefined b == _|_@. See #exceptions_and_strictness# -- for details. catchException :: Exception e => IO a -> (e -> IO a) -> IO a -catchException !io handler = catch io handler +catchException io handler = catch io handler -- | This is the simplest of the exception-catching functions. It -- takes a single argument, runs it, and if an exception is raised @@ -194,7 +194,7 @@ catch (IO io) handler = IO $ catch# io handler' -- @catchAny undefined b == _|_@. See #exceptions_and_strictness# for -- details. catchAny :: IO a -> (forall e . Exception e => e -> IO a) -> IO a -catchAny !(IO io) handler = IO $ catch# io handler' +catchAny (IO io) handler = IO $ catch# io handler' where handler' (SomeException e) = unIO (handler e) -- Using catchException here means that if `m` throws an }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14998#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler