[GHC] #13348: Consider making throw and throwIO strict

#13348: Consider making throw and throwIO strict -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.4.1 Component: Core | Version: 8.1 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It's possible for code to throw an exception that itself throws an imprecise exception. Such an exception is tricky to catch. For example: {{{#!hs import Control.Exception strange = throwIO (undefined :: SomeException) `catch` \ex -> case () of _ | Just _ <- (fromException ex :: Maybe IOError) -> print "IOError" | otherwise -> print "Something else" }}} You might think that this would catch the exception and print "Something else", but in fact it does not. If others think this is as surprising as I do, perhaps we should make `throwIO` and `throw` strict, so an exception will never itself be bottom. Using {{{#!hs throwIO' !e = throwIO e }}} in the code above instead of `throwIO` allows the exception to be caught. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13348 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13348: Consider making throw and throwIO strict -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.4.1 Component: Core Libraries | Version: 8.1 Resolution: wontfix | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => closed * resolution: => wontfix Comment: Eric Mertens has given a reasonable argument against this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13348#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13348: Consider making throw and throwIO strict -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.4.1 Component: Core Libraries | Version: 8.1 Resolution: wontfix | Keywords: Exceptions Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => Exceptions -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13348#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC