Debugging herald should be printed before forcing SDoc
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |