[GHC] #8925: :print and :sprint sometimes fully evaluates strings

GHC ghc-devs at haskell.org
Sun Mar 23 20:54:44 UTC 2014


#8925: :print and :sprint sometimes fully evaluates strings
------------------------------------+-------------------------------------
       Reporter:  soapie            |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  GHCi              |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  Other
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 Not too confident in my terminology but `:sprint`ing a string that has
 been evaluated down to its spine seems to fully evaluate the string:

 {{{
 Prelude> let a = map (Debug.Trace.trace "!!!") "abc"
 Prelude> a `seq` ()
 ()
 Prelude> :sprint a
 a = _ : _                     -- looks fine
 Prelude> length a
 3
 Prelude> :sprint a
 a = "!!!                      -- strange!
 a!!!
 b!!!
 c"
 }}}

 What I expect to see is `a = [_,_,_]`.  `:print` behaves similarly.  Since
 neither `:print` nor `:sprint` is supposed to force any evaluation this
 seems like a bug.  At least it can make debugging quite confusing if
 you're not aware of it!

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


More information about the ghc-tickets mailing list