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

GHC ghc-devs at haskell.org
Fri Jan 16 00:27:01 UTC 2015


#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


More information about the ghc-tickets mailing list