4.6. Verbosity options
Prev | Chapter 4. Using GHC | Next

## 4.6. Verbosity options

See also the `--help`, `--version`, `--numeric-version`, and `--print-libdir` modes in Section 4.5, “Modes of operation”.

`-v`

  The `-v` option makes GHC verbose: it reports its version number and shows (on stderr) exactly how it invokes each phase of the compilation system. Moreover, it passes the `-v` flag to most phases; each reports its version number (and possibly some other information).

  Please, oh please, use the `-v` option when reporting bugs! Knowing that you ran the right bits in the right order is always the first thing we want to verify.

`-v` `n`

  To provide more control over the compiler's verbosity, the `-v` flag takes an optional numeric argument. Specifying `-v` on its own is equivalent to `-v3`, and the other levels have the following meanings:

  `-v0`

    Disable all non-essential messages (this is the default).

  `-v1`

    Minimal verbosity: print one line per compilation (this is the default when `--make` or `--interactive` is on).

  `-v2`

    Print the name of each compilation phase as it is executed. (equivalent to `-dshow-passes`).

  `-v3`

    The same as `-v2`, except that in addition the full command line (if appropriate) for each compilation phase is also printed.

  `-v4`

    The same as `-v3` except that the intermediate program representation after each compilation phase is also printed (excluding preprocessed and C/assembly files).

`--fprint-explicit-foralls, -fprint-explicit-kinds`

  These two flags control the way in which GHC displays types, in error messages and in GHCi. Using `-fprint-explicit-foralls` makes GHC print explicit `forall` quantification at the top level of a type; normally this is suppressed. For example, in GHCi:

      ghci> let f x = x
      ghci> :t f
      f :: a -> a
      ghci> :set -fprint-explicit-foralls
      ghci> :t f
      f :: forall a. a -> a

  However, regardless of the flag setting, the quantifiers are printed under these circumstances:

  - For nested `foralls`, e.g.

        ghci> :t GHC.ST.runST
        GHC.ST.runST :: (forall s. GHC.ST.ST s a) -> a

  - If any of the quantified type variables has a kind that mentions a kind variable, e.g.

        ghci> :i Data.Coerce.coerce
        coerce ::
          forall (k :: BOX) (a :: k) (b :: k). Coercible a b => a -> b
             -- Defined in GHC.Prim

  Using `-fprint-explicit-kinds` makes GHC print kind arguments in types, which are normally suppressed. This can be important when you are using kind polymorphism. For example:

      ghci> :set -XPolyKinds
      ghci> data T a = MkT
      ghci> :t MkT
      MkT :: forall (k :: BOX) (a :: k). T a
      ghci> :set -fprint-explicit-foralls
      ghci> :t MkT
      MkT :: forall (k :: BOX) (a :: k). T k a

`-ferror-spans`

  Causes GHC to emit the full source span of the syntactic entity relating to an error message. Normally, GHC emits the source location of the start of the syntactic entity only.

  For example:

      test.hs:3:6: parse error on input `where'

  becomes:

      test296.hs:3:6-10: parse error on input `where'

  And multi-line spans are possible too:

      test.hs:(5,4)-(6,7):
          Conflicting definitions for `a'
          Bound at: test.hs:5:4
                    test.hs:6:7
          In the binding group for: a, b, a

  Note that line numbers start counting at one, but column numbers start at zero. This choice was made to follow existing convention (i.e. this is how Emacs does it).

`-H` `size`

  Set the minimum size of the heap to `size`. This option is equivalent to `+RTS -H`size``, see Section 4.17.3, “RTS options to control the garbage collector”.

`-Rghc-timing`

  Prints a one-line summary of timing statistics for the GHC run. This option is equivalent to `+RTS -tstderr`, see Section 4.17.3, “RTS options to control the garbage collector”.

Prev | Up | Next
4.5. Modes of operation | Home | 4.7. Filenames and separate compilation