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 <tre...@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 >> 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]? >> >> [1] >> http://hackage.haskell.org/**trac/ghc/ticket/2273<http://hackage.haskell.org/trac/ghc/ticket/2273> >> > > 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 <Glasgow-haskell-users@haskell.org> > http://www.haskell.org/**mailman/listinfo/glasgow-**haskell-users<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