:print and :sprint sometimes fully evaluates strings
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!
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | hvr |
Operating system | |
Architecture |