runghc shows the value produced by main when its type is a non-() Show instance
When running a program like this:
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.4 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |