Is this related to imprecise exceptions?
http://research.microsoft.com/en-us/um/people/simonpj/papers/imprecise-exn.htm
Antoine
And the important observation is: all of them throw A if interpreted in ghci or compiled without -O, right?On Thu, Nov 8, 2012 at 11:24 AM, Albert Y. C. Lai <trebla@vex.net> wrote:
On 12-11-08 07:12 AM, Simon Hengel wrote:
I was just going to say that I can give at least one counterexample[1] http://hackage.haskell.org/trac/ghc/ticket/2273
where this does not hold:
evaluate (('a' : undefined) `deepseq` return () :: IO ())
throwIO exceptionB
But then I realized that here exceptionA is optimized away altogether.
For me this smells like a bug. Is this related to [1]?
Interesting. A few more tests (all GHC 7.4.2, linux, x86 32-bit, use "ghc -O" to compile):
The following cases throw A:
import Control.DeepSeq
import Control.Exception
main = do
evaluate (('a' : error "A") `deepseq` return () :: Maybe ())
throwIO (userError "B")
main = do
evaluate (('a' : error "A") `deepseq` ())
throwIO (userError "B")
main = do
evaluate (('a' : error "A") `deepseq` True)
throwIO (userError "B")
main = do
x <- evaluate (('a' : error "A") `deepseq` putStrLn "hi")
x
throwIO (userError "B")
The following cases throw B:
main = do
evaluate (('a' : error "A") `deepseq` return () :: IO ())
throwIO (userError "B")
main = do
evaluate (('a' : error "A") `deepseq` putStrLn "hi")
throwIO (userError "B")
main = do
evaluate (('a' : error "A") `deepseq` getLine)
throwIO (userError "B")
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users