[GHC] #12215: Debugging herald should be printed before forcing SDoc

GHC ghc-devs at haskell.org
Tue Jun 21 05:50:18 UTC 2016


#12215: Debugging herald should be printed before forcing SDoc
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  task           |            Status:  new
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When I am debugging panics or infinite loops related laziness issues
 (e.g., lazy interface checking), I've noticed that sometimes a debugging
 trace can change the strictness of a function, causing us to tag a thunk
 too early.

 Unfortunately, GHC makes it a bit difficult to tell that it's the debug
 trace's fault. Specifically, if the bad trace has the form `traceTc "foo"
 someBadSDoc`, we attempt to evaluate `someBadSDoc` before we start
 printing any output. That's too bad: we should FIRST output `foo`, and
 then force and print the rest of the SDoc.

 Internally, `traceTc`'s herald is implemented by catting the herald into
 the SDoc, so I am not sure what the best way of getting things to be
 lazier is. I don't think SDoc can be made to stream, so we might have to
 do something a little nasty like split the trace into two internal trace
 calls.

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


More information about the ghc-tickets mailing list