GHCi :set command

Contents
  • Overview of options
  • Allow multiline commands (+m)
  • Show types (+t)
  • Show statistics (+s)
  • Collect source information (+c)

The :set command can be used to change various behaviors of GHCi from within a running REPL. Options set with the :set command can be undone with the :unset command. If you want them on each time you open a new GHCi session, options set with the :set command can also be enabled in your GHCi configuration file.

Overview of options

Options starting with + are specific to GHCi. This is the complete list:These options are also listed in the GHCi options section of the GHC manual.

  • +m – Allow multiline commands
  • +r – Discard evaluation of top-level expressions after each evaluation
  • +s – Display statistics about time and memory usage after each evaluation
  • +t – Print type after each evaluation
  • +c – Collect source information needed to support the :all-types, :loc-at, :type-at, and :uses commands.

Options starting with - are GHC command-line options. The list of these is long, but here are just a few examples:

  • -v – Set higher debug output verbosity
  • -Wall – Enable all compiler warnings
  • -XOverloadedStrings – Enable the OverloadedStrings extension

Sign up for access to the full page, plus the complete archive and all the latest content.