Opened 14 months ago

Closed 8 weeks ago

#8796 closed bug (fixed)

-ddump-splices prints to error stream

Reported by: jstolarek Owned by: qnikst
Priority: normal Milestone: 7.12.1
Component: Compiler Version: 7.9
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions: Phab:D627

Description

I just noticed that unlike other dump flags, -ddump-splices dumps to the error stream. I don't think this difference in behaviour is intended.

Change History (10)

comment:1 Changed 14 months ago by simonpj

I doubt it is specifically intended. Do fix.

Simon

comment:2 Changed 14 months ago by jstolarek

I looked at the code responsible for this and it seems that this was a concious decision (not sure if correct one). Code is in typecheck/TcRnMonad.lhs. There's dumpTcRn function which uses printInfoForUser to print to stderr (printOutputForUser would print to stdout). dumpTcRn is used as a backend for dumping renamer and typechecker traces as well as TH splices. Now I'm not sure if all of this should be printed on stdout or just the TH splices? It seems strange to me that stderr is used as an output for more detailed debugging information. I feel this is not the intent for stderr.

comment:3 follow-up: Changed 14 months ago by nomeata

Wasn’t there a ticket asking for more structured splice output, i.e. dumping it to a separate file, with precise origin information, basically everything needed to write a tool that reliably replaces the TH code by the splice...

Currenlty I only find #5016, which is about getting the dump closer to valid Haskell (also see this SE question). At http://stackoverflow.com/a/15851260/946226 people are surprised that it is dumped to stderr, and not to a file. And there are two tools doing this splace-replacement-thingy already: https://joeyh.name/blog/entry/Template_Haskell_on_impossible_architectures/ and http://hackage.haskell.org/package/zeroth. So it seems that there is demand for improvement.

comment:4 Changed 14 months ago by simonpj

I probably implemented this, and I don't think stdin/stderr was a conscious choice. Feel free to change it.

Simon

comment:5 in reply to: ↑ 3 Changed 5 months ago by jstolarek

  • Keywords newcomer added

Replying to nomeata:

Wasn’t there a ticket asking for more structured splice output, i.e. dumping it to a separate file

#8624

comment:6 Changed 4 months ago by jstolarek

Similarly, -dverbose-core2core prints some information on stdout and some on stderr. This could also be cleaned up.

comment:7 Changed 2 months ago by qnikst

  • Differential Revisions set to Phab:627
  • Owner set to qnikst

comment:8 Changed 2 months ago by thoughtpolice

  • Differential Revisions changed from Phab:627 to Phab:D627
  • Milestone set to 7.12.1

comment:9 Changed 8 weeks ago by Austin Seipp <austin@…>

In 73f976c47f00060baaeead9e0331ab265a84251c/ghc:

Make -ddump-splices output to stdout (fixes #8796)

Summary:
Fixes debug output so all info messages will use
stdout. Fixes #8796.

Make -ddump-splices output to stdout (fixes #8796)
Make -dverbose-core2core use stdout (fixes #8796)

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D627

GHC Trac Issues: #8796

comment:10 Changed 8 weeks ago by thoughtpolice

  • Resolution set to fixed
  • Status changed from new to closed

Merged, thanks!

Note: See TracTickets for help on using tickets.