Skip to content

ghc and ghci differs in deailing with "undefined" with I/O

This program:

main = putStrLn ("x == " ++ undefined)

produces the following expected output with ghci:

x == *** Exception: Prelude.undefined

but when compiled with ghc and run, it gives:

$./a.out 
a.out: Prelude.undefined

we observed this in all the way back to ghc6.2.1; possibly earlier.

The semantics of error reporting in combination with I/O is murky; admittedly laziness is observable at the top-level when errors are reported. But at least ghc and ghci should do the same thing. And the behavior of ghci seems to be more appropriate.

Thanks!

Jeff Lewis and Levent Erkok

Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC jeff@galois.com, levent.erkok@galois.com
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information