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
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.