[GHC] #16089: seq is not cooperating with :sprint in GHCi as expected

GHC ghc-devs at haskell.org
Thu Dec 27 09:39:27 UTC 2018


#16089: seq is not cooperating with :sprint in GHCi as expected
-------------------------------------+-------------------------------------
        Reporter:  radrow            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  8.6.3
      Resolution:                    |             Keywords:  seq sprint
                                     |  strictness
Operating System:  Linux             |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7253, #16096     |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 My fix for #16096 (Phab:D5473) fixes the original reproducer:

 {{{
 ~ $ ghc-stage2 --interactive
 GHCi, version 8.7.20181227: https://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/omer/rcbackup/.ghci
 λ:1> x = [True, False]
 λ:2> :sprint x
 x = [True,False]
 λ:3> :print x
 x = [True,False]
 }}}

 Here's a slightly more complex example:

 {{{
 ~ $ ghc-stage2 --interactive
 GHCi, version 8.7.20181227: https://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/omer/rcbackup/.ghci
 λ:1> x = [ 1.. ] :: [Integer]
 λ:2> :sprint x
 x = _
 λ:3> x `seq` ()
 ()
 λ:4> :sprint x
 x = 1 : _
 }}}

 However if I omit the type annotation in the first line it doesn't work as
 expected:

 {{{
 ~ $ ghc-stage2 --interactive
 GHCi, version 8.7.20181227: https://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/omer/rcbackup/.ghci
 λ:1> x = [ 1.. ]
 λ:2> x `seq` ()
 ()
 λ:3> :sprint x
 x = _
 }}}

 I'd expect to see the same output `x = 1 : _` here. We should use this one
 as the reproducer.

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


More information about the ghc-tickets mailing list