[GHC] #15617: Unboxed tuples/sum error message on `a = show 5` in expression evaluation and interactive modes

GHC ghc-devs at haskell.org
Sat Sep 8 02:32:06 UTC 2018


#15617: Unboxed tuples/sum error message on `a = show 5` in expression evaluation
and interactive modes
-------------------------------------+-------------------------------------
           Reporter:  ChaiTRex       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.6.1-beta1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Poor/confusing
  Unknown/Multiple                   |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 With GHC 8.4.3 (`ghc` below on both Ubuntu 16.04.5 and Ubuntu 18.04.1) and
 recent GHC (`~/dev/ghc/inplace/bin/ghc-stage2` below on Ubuntu 16.04.5;
 not `HEAD` but close at `ff29fc84c03c800cfa04c2a00eb8edf6fa5f4183`), 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.
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15617>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list