[GHC] #9991: runghc shows the value produced by main when its type is a non-() Show instance

#9991: runghc shows the value produced by main when its type is a non-() Show instance -------------------------------------+------------------------------------- Reporter: shachaf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- When running a program like this: {{{#!hs main :: IO Int main = return 5 }}} With `runghc`, it'll print a value, which is contrary to expected behavior and to compiled program behavior: {{{ $ runghc Main.hs 5 $ ghc Main.hs [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... $ ./Main $ }}} This is the same as `ghci`'s behavior with an IO action, so presumably `runghc` is taking a shortcut here. But a program should behave the same way in both cases. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9991 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9991: runghc shows the value produced by main when its type is a non-() Show instance -------------------------------------+------------------------------------- Reporter: shachaf | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ezyang): * type: bug => task Comment: Looks fixed in 7.10, but we could still use a test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9991#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9991: runghc shows the value produced by main when its type is a non-() Show instance -------------------------------------+------------------------------------- Reporter: shachaf | Owner: Type: task | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #9086 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => duplicate * related: => #9086 Comment: I found the commit that fixed this: 55e7ab1210975e6276f3cab3ac0e1f35bcd772f0 {{{ Author: Gintautas Miliauskas <> Date: Sun Jun 8 11:49:29 2014 +0000 Do not print the result of 'main' after invoking ':main' (fixes #9086). }}} Since it has a test already, we don't have to do anything here. Berdes: please have a look at that commit and [wiki:Building/RunningTests] to see how the testsuite works. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9991#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9991: runghc shows the value produced by main when its type is a non-() Show instance -------------------------------------+------------------------------------- Reporter: shachaf | Owner: Type: task | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: #9086 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): Aha, I missed that test because I grepped for runghc and this test is using GHCi interactive to run main. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9991#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC