Unboxed tuples/sum error message on `a = show 5` in expression evaluation and interactive modes
With GHC 8.4.3 (on both Ubuntu 16.04.5 and Ubuntu 18.04.1) and recent GHC (not HEAD
but close at ff29fc84c03c800cfa04c2a00eb8edf6fa5f4183
on Ubuntu 16.04.5), I get errors for a = show 5
.
I run the following commands, showing that show 5
is usually fine:
$ ghc -fobject-code -O2 -e 'show 5'
"5"
$ ghc -fobject-code -O2 -e 'let a = show 5 in a'
"5"
But not with a = show 5
:
$ ghc -fobject-code -O2 -e 'a = show 5'
<interactive>: Error: bytecode compiler can't handle unboxed tuples and sums.
Possibly due to foreign import/export decls in source.
Workaround: use -fobject-code, or compile this module to .o separately.
Running with ghci
gives the same error:
$ ghci -fobject-code -O2
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> a = show 5
Error: bytecode compiler can't handle unboxed tuples and sums.
Possibly due to foreign import/export decls in source.
Workaround: use -fobject-code, or compile this module to .o separately.
Prelude>
Leaving GHCi.
Both errors stop when optimization is turned off:
$ ghc -fobject-code -O0 -e 'a = show 5'
$ ghci -fobject-code -O0
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> a = show 5
Prelude>
Leaving GHCi.