Skip to content

"ghc -e <invalid expression>" should return non-zero exit status

When GHC is run in expression-evaluation mode (i.e. with the "-e" flag) and the expression does not compile, GHC correctly prints an error message, but then exits with exit status 0. For example:

$ ghc -e foo

<interactive>:1:1: Not in scope: `foo'
$ echo $?
0

This is inconvenient for automated scripts that call GHC.

Trac metadata
Trac field Value
Version 7.6.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information