Opened 6 years ago

Closed 5 years ago

#7863 closed feature request (fixed)

Verbosity level for quieter Template Haskell

Reported by: dolio Owned by: hvr
Priority: low Milestone: 7.10.1
Component: Template Haskell Version: 7.6.3
Keywords: linker Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #5647 Differential Rev(s): Phab:D232
Wiki Page:

Description

In projects with large numbers of dependencies, use of template haskell can cause very large amounts of output that aren't particularly interesting. However, it seems that the only verbosity level that quiets template haskell output is -v0, which also turns off normal indications of build progress. It would be pleasant to have a way to turn off template haskell loading messages while retaining the rest of -v1 output.

Change History (9)

comment:1 Changed 6 years ago by simonpj

difficulty: Unknown

Can you be more precise about which messages you want to suppress?

Maybe they can be be made to come out only with -v2?

Simon

comment:2 Changed 6 years ago by dolio

Oh, sorry. Stuff like the following:

Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package ansi-terminal-0.6 ... linking ... done.
Loading package ansi-wl-pprint-0.6.6 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package blaze-builder-0.3.1.1 ... linking ... done.
Loading package blaze-markup-0.5.1.5 ... linking ... done.
Loading package blaze-html-0.5.1.3 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
...

That's from one of the projects I work on. There are actually 103 lines total, and they get printed multiple times, because we use template Haskell in multiple files.

comment:3 Changed 6 years ago by simonpj

If someone wants to make this output appear only -v2, that'd be fine with me.

comment:4 Changed 5 years ago by hvr

Cc: hvr added
Keywords: linker added
Milestone: 7.10.1
Priority: normallow

comment:5 Changed 5 years ago by hvr

comment:6 Changed 5 years ago by hvr

Owner: set to hvr

The actual change seems to be just a single character:

  • compiler/ghci/Linker.lhs

    diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
    index 5b0251c..ecba45b 100644
    a b findFile mk_file_path (dir : dirs) 
    12921292\begin{code}
    12931293maybePutStr :: DynFlags -> String -> IO ()
    12941294maybePutStr dflags s
    1295     = when (verbosity dflags > 0) $
     1295    = when (verbosity dflags > 1) $
    12961296          do let act = log_action dflags
    12971297             act dflags SevInteractive noSrcSpan defaultUserStyle (text s)

as maybePutStr is used for all linker-related progress logging output

With that change, a GHCi session looks like

$ inplace/bin/ghc-stage2 --interactive
GHCi, version 7.9.20140919: http://www.haskell.org/ghc/  :? for help
λ:2> Control.DeepSeq.rnf ()
()
it :: ()
λ:3> 

for comparison, here's what this looks like in GHC 7.8.3:

GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
λ:2> Control.DeepSeq.rnf ()
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
()
it :: ()
λ:3> 

If we want it that way, I'll go forward and adapt any testsuite wobbles this may have caused.

comment:7 Changed 5 years ago by hvr

Differential Rev(s): Phab:D232
Status: newpatch

There were only two testcases whose output needed tweaking, so I went ahead and submitted a code-rev

comment:8 Changed 5 years ago by Herbert Valerio Riedel <hvr@…>

In 9f7e3633c692dce75c27607131bd386178fb0fcf/ghc:

Change linker message verbosity to `-v2` (re #7863)

With this change, the linker status logging output such as

    Loading package ghc-prim ... linking ... done.
    Loading package integer-gmp ... linking ... done.
    Loading package base ... linking ... done.

is suppressed unless verbosity level is `-v2` or higher. This is done
to reduce the compiler message noise when TH is involved, which can
reduce the visibiliy of compile warnings.

Reviewed By: ekmett, austin

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

comment:9 Changed 5 years ago by hvr

Resolution: fixed
Status: patchclosed

Please reopen if this is not what we want

Note: See TracTickets for help on using tickets.