summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2012-03-23 10:32:07 -0700
committerDavid Terei <davidterei@gmail.com>2012-03-23 10:32:07 -0700
commitf5584e695c5f3ea9c1a66ef047fde3c5601cbf99 (patch)
treee556bb4a6d96960d8899f1e33eba6d5c5b4978e4 /docs/users_guide
parent2938619aec4e1da098b56130df0fe9ae73429c7a (diff)
downloadhaskell-f5584e695c5f3ea9c1a66ef047fde3c5601cbf99.tar.gz
Tabs -> Spaces
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/using.xml1854
1 files changed, 927 insertions, 927 deletions
diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml
index 234b64d736..465da0173b 100644
--- a/docs/users_guide/using.xml
+++ b/docs/users_guide/using.xml
@@ -118,7 +118,7 @@ ghc [argument...]
<para>Sometimes it is useful to make the connection between a
source file and the command-line options it requires quite
tight. For instance, if a Haskell source file deliberately
- uses name shadowing, it should be compiled with the
+ uses name shadowing, it should be compiled with the
<option>-fno-warn-name-shadowing</option> option. Rather than maintaining
the list of per-file options in a <filename>Makefile</filename>,
it is possible to do this directly in the source file using the
@@ -179,29 +179,29 @@ module X where
<variablelist>
<varlistentry>
- <term>Mode flags</term>
- <listitem>
- <para>For example, <option>&ndash;&ndash;make</option> or <option>-E</option>.
- There may only be a single mode flag on the command line. The
- available modes are listed in <xref linkend="modes"/>.</para>
- </listitem>
+ <term>Mode flags</term>
+ <listitem>
+ <para>For example, <option>&ndash;&ndash;make</option> or <option>-E</option>.
+ There may only be a single mode flag on the command line. The
+ available modes are listed in <xref linkend="modes"/>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>Dynamic Flags</term>
- <listitem>
- <para>Most non-mode flags fall into this category. A dynamic flag
- may be used on the command line, in a
- <literal>OPTIONS_GHC</literal> pragma in a source file, or set
- using <literal>:set</literal> in GHCi.</para>
- </listitem>
+ <term>Dynamic Flags</term>
+ <listitem>
+ <para>Most non-mode flags fall into this category. A dynamic flag
+ may be used on the command line, in a
+ <literal>OPTIONS_GHC</literal> pragma in a source file, or set
+ using <literal>:set</literal> in GHCi.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>Static Flags</term>
- <listitem>
- <para>A few flags are "static", which means they can only be used on
- the command-line, and remain in force over the entire GHC/GHCi
- run.</para>
- </listitem>
+ <term>Static Flags</term>
+ <listitem>
+ <para>A few flags are "static", which means they can only be used on
+ the command-line, and remain in force over the entire GHC/GHCi
+ run.</para>
+ </listitem>
</varlistentry>
</variablelist>
@@ -227,75 +227,75 @@ module X where
<variablelist>
<varlistentry>
- <term><filename>.hs</filename></term>
- <listitem>
- <para>A Haskell module.</para>
- </listitem>
+ <term><filename>.hs</filename></term>
+ <listitem>
+ <para>A Haskell module.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<filename>.lhs</filename>
<indexterm><primary><literal>lhs</literal> suffix</primary></indexterm>
- </term>
- <listitem>
- <para>A &ldquo;literate Haskell&rdquo; module.</para>
- </listitem>
+ </term>
+ <listitem>
+ <para>A &ldquo;literate Haskell&rdquo; module.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.hi</filename></term>
- <listitem>
- <para>A Haskell interface file, probably
- compiler-generated.</para>
- </listitem>
+ <term><filename>.hi</filename></term>
+ <listitem>
+ <para>A Haskell interface file, probably
+ compiler-generated.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.hc</filename></term>
- <listitem>
- <para>Intermediate C file produced by the Haskell
- compiler.</para>
- </listitem>
+ <term><filename>.hc</filename></term>
+ <listitem>
+ <para>Intermediate C file produced by the Haskell
+ compiler.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.c</filename></term>
- <listitem>
- <para>A C&nbsp;file not produced by the Haskell
- compiler.</para>
- </listitem>
+ <term><filename>.c</filename></term>
+ <listitem>
+ <para>A C&nbsp;file not produced by the Haskell
+ compiler.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.ll</filename></term>
- <listitem>
- <para>An llvm-intermediate-language source file, usually
+ <term><filename>.ll</filename></term>
+ <listitem>
+ <para>An llvm-intermediate-language source file, usually
produced by the compiler.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.bc</filename></term>
- <listitem>
- <para>An llvm-intermediate-language bitcode file, usually
+ <term><filename>.bc</filename></term>
+ <listitem>
+ <para>An llvm-intermediate-language bitcode file, usually
produced by the compiler.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.s</filename></term>
- <listitem>
- <para>An assembly-language source file, usually produced by
+ <term><filename>.s</filename></term>
+ <listitem>
+ <para>An assembly-language source file, usually produced by
the compiler.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><filename>.o</filename></term>
- <listitem>
- <para>An object file, produced by an assembler.</para>
- </listitem>
+ <term><filename>.o</filename></term>
+ <listitem>
+ <para>An object file, produced by an assembler.</para>
+ </listitem>
</varlistentry>
</variablelist>
@@ -324,164 +324,164 @@ module X where
<variablelist>
<varlistentry>
- <term>
- <cmdsynopsis><command>ghc --interactive</command>
- </cmdsynopsis>
+ <term>
+ <cmdsynopsis><command>ghc --interactive</command>
+ </cmdsynopsis>
<indexterm><primary>interactive mode</primary></indexterm>
<indexterm><primary>ghci</primary></indexterm>
- </term>
- <listitem>
- <para>Interactive mode, which is also available as
- <command>ghci</command>. Interactive mode is described in
- more detail in <xref linkend="ghci"/>.</para>
- </listitem>
+ </term>
+ <listitem>
+ <para>Interactive mode, which is also available as
+ <command>ghci</command>. Interactive mode is described in
+ more detail in <xref linkend="ghci"/>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
- <cmdsynopsis><command>ghc &ndash;&ndash;make</command>
- </cmdsynopsis>
+ <term>
+ <cmdsynopsis><command>ghc &ndash;&ndash;make</command>
+ </cmdsynopsis>
<indexterm><primary>make mode</primary></indexterm>
<indexterm><primary><option>&ndash;&ndash;make</option></primary></indexterm>
- </term>
- <listitem>
- <para>In this mode, GHC will build a multi-module Haskell
- program automatically, figuring out dependencies for itself.
- If you have a straightforward Haskell program, this is
- likely to be much easier, and faster, than using
- <command>make</command>. Make mode is described in <xref
- linkend="make-mode"/>.</para>
+ </term>
+ <listitem>
+ <para>In this mode, GHC will build a multi-module Haskell
+ program automatically, figuring out dependencies for itself.
+ If you have a straightforward Haskell program, this is
+ likely to be much easier, and faster, than using
+ <command>make</command>. Make mode is described in <xref
+ linkend="make-mode"/>.</para>
<para>
This mode is the default if there are any Haskell
source files mentioned on the command line, and in this case
the <option>&ndash;&ndash;make</option> option can be omitted.
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
- <cmdsynopsis><command>ghc -e</command>
- <arg choice='plain'><replaceable>expr</replaceable></arg>
+ <term>
+ <cmdsynopsis><command>ghc -e</command>
+ <arg choice='plain'><replaceable>expr</replaceable></arg>
</cmdsynopsis>
<indexterm><primary>eval mode</primary></indexterm>
- </term>
- <listitem>
- <para>Expression-evaluation mode. This is very similar to
- interactive mode, except that there is a single expression
- to evaluate (<replaceable>expr</replaceable>) which is given
- on the command line. See <xref linkend="eval-mode"/> for
- more details.</para>
- </listitem>
+ </term>
+ <listitem>
+ <para>Expression-evaluation mode. This is very similar to
+ interactive mode, except that there is a single expression
+ to evaluate (<replaceable>expr</replaceable>) which is given
+ on the command line. See <xref linkend="eval-mode"/> for
+ more details.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
- <command>ghc -E</command>
- <command>ghc -c</command>
- <command>ghc -S</command>
- <command>ghc -c</command>
- </cmdsynopsis>
- <indexterm><primary><option>-E</option></primary></indexterm>
- <indexterm><primary><option>-C</option></primary></indexterm>
- <indexterm><primary><option>-S</option></primary></indexterm>
- <indexterm><primary><option>-c</option></primary></indexterm>
+ <command>ghc -E</command>
+ <command>ghc -c</command>
+ <command>ghc -S</command>
+ <command>ghc -c</command>
+ </cmdsynopsis>
+ <indexterm><primary><option>-E</option></primary></indexterm>
+ <indexterm><primary><option>-C</option></primary></indexterm>
+ <indexterm><primary><option>-S</option></primary></indexterm>
+ <indexterm><primary><option>-c</option></primary></indexterm>
</term>
- <listitem>
- <para>This is the traditional batch-compiler mode, in which
- GHC can compile source files one at a time, or link objects
- together into an executable. This mode also applies if
- there is no other mode flag specified on the command line,
- in which case it means that the specified files should be
- compiled and then linked to form a program. See <xref
- linkend="options-order"/>.</para>
- </listitem>
+ <listitem>
+ <para>This is the traditional batch-compiler mode, in which
+ GHC can compile source files one at a time, or link objects
+ together into an executable. This mode also applies if
+ there is no other mode flag specified on the command line,
+ in which case it means that the specified files should be
+ compiled and then linked to form a program. See <xref
+ linkend="options-order"/>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc -M</command>
</cmdsynopsis>
<indexterm><primary>dependency-generation mode</primary></indexterm>
</term>
- <listitem>
- <para>Dependency-generation mode. In this mode, GHC can be
- used to generate dependency information suitable for use in
- a <literal>Makefile</literal>. See <xref
- linkend="makefile-dependencies"/>.</para>
- </listitem>
+ <listitem>
+ <para>Dependency-generation mode. In this mode, GHC can be
+ used to generate dependency information suitable for use in
+ a <literal>Makefile</literal>. See <xref
+ linkend="makefile-dependencies"/>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc --mk-dll</command>
</cmdsynopsis>
- <indexterm><primary>DLL-creation mode</primary></indexterm>
+ <indexterm><primary>DLL-creation mode</primary></indexterm>
</term>
- <listitem>
- <para>DLL-creation mode (Windows only). See <xref
- linkend="win32-dlls-create"/>.</para>
- </listitem>
+ <listitem>
+ <para>DLL-creation mode (Windows only). See <xref
+ linkend="win32-dlls-create"/>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
- <cmdsynopsis>
+ <term>
+ <cmdsynopsis>
<command>ghc --help</command> <command>ghc -?</command>
- </cmdsynopsis>
+ </cmdsynopsis>
<indexterm><primary><option>&ndash;&ndash;help</option></primary></indexterm>
</term>
- <listitem>
- <para>Cause GHC to spew a long usage message to standard
+ <listitem>
+ <para>Cause GHC to spew a long usage message to standard
output and then exit.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc --show-iface <replaceable>file</replaceable></command>
</cmdsynopsis>
<indexterm><primary><option>&ndash;&ndash;--show-iface</option></primary></indexterm>
</term>
- <listitem>
- <para>Read the interface in
- <replaceable>file</replaceable> and dump it as text to
- <literal>stdout</literal>. For example <literal>ghc --show-iface M.hi</literal>.</para>
- </listitem>
+ <listitem>
+ <para>Read the interface in
+ <replaceable>file</replaceable> and dump it as text to
+ <literal>stdout</literal>. For example <literal>ghc --show-iface M.hi</literal>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc --supported-extensions</command>
<command>ghc --supported-languages</command>
</cmdsynopsis>
<indexterm><primary><option>&ndash;&ndash;supported-extensions</option></primary><primary><option>&ndash;&ndash;supported-languages</option></primary></indexterm>
</term>
- <listitem>
- <para>Print the supported language extensions.</para>
- </listitem>
+ <listitem>
+ <para>Print the supported language extensions.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc --info</command>
</cmdsynopsis>
<indexterm><primary><option>&ndash;&ndash;info</option></primary></indexterm>
</term>
- <listitem>
- <para>Print information about the compiler.</para>
- </listitem>
+ <listitem>
+ <para>Print information about the compiler.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc --version</command>
<command>ghc -V</command>
@@ -489,40 +489,40 @@ module X where
<indexterm><primary><option>-V</option></primary></indexterm>
<indexterm><primary><option>&ndash;&ndash;version</option></primary></indexterm>
</term>
- <listitem>
- <para>Print a one-line string including GHC's version number.</para>
- </listitem>
+ <listitem>
+ <para>Print a one-line string including GHC's version number.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<cmdsynopsis>
<command>ghc --numeric-version</command>
</cmdsynopsis>
<indexterm><primary><option>&ndash;&ndash;numeric-version</option></primary></indexterm>
</term>
- <listitem>
- <para>Print GHC's numeric version number only.</para>
- </listitem>
+ <listitem>
+ <para>Print GHC's numeric version number only.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
- <cmdsynopsis>
+ <term>
+ <cmdsynopsis>
<command>ghc --print-libdir</command>
</cmdsynopsis>
<indexterm><primary><option>&ndash;&ndash;print-libdir</option></primary></indexterm>
</term>
- <listitem>
- <para>Print the path to GHC's library directory. This is
- the top of the directory tree containing GHC's libraries,
- interfaces, and include files (usually something like
- <literal>/usr/local/lib/ghc-5.04</literal> on Unix). This
- is the value of
- <literal>$libdir</literal><indexterm><primary><literal>libdir</literal></primary></indexterm>
+ <listitem>
+ <para>Print the path to GHC's library directory. This is
+ the top of the directory tree containing GHC's libraries,
+ interfaces, and include files (usually something like
+ <literal>/usr/local/lib/ghc-5.04</literal> on Unix). This
+ is the value of
+ <literal>$libdir</literal><indexterm><primary><literal>libdir</literal></primary></indexterm>
in the package configuration file
(see <xref linkend="packages"/>).</para>
- </listitem>
+ </listitem>
</varlistentry>
</variablelist>
@@ -565,23 +565,23 @@ ghc Main.hs
<literal>Makefile</literal>s are:</para>
<itemizedlist>
- <listitem>
- <para>GHC doesn't have to be restarted for each compilation,
- which means it can cache information between compilations.
- Compiling a multi-module program with <literal>ghc
- &ndash;&ndash;make</literal> can be up to twice as fast as
- running <literal>ghc</literal> individually on each source
- file.</para>
- </listitem>
- <listitem>
- <para>You don't have to write a <literal>Makefile</literal>.</para>
+ <listitem>
+ <para>GHC doesn't have to be restarted for each compilation,
+ which means it can cache information between compilations.
+ Compiling a multi-module program with <literal>ghc
+ &ndash;&ndash;make</literal> can be up to twice as fast as
+ running <literal>ghc</literal> individually on each source
+ file.</para>
+ </listitem>
+ <listitem>
+ <para>You don't have to write a <literal>Makefile</literal>.</para>
<indexterm><primary><literal>Makefile</literal>s</primary><secondary>avoiding</secondary></indexterm>
- </listitem>
- <listitem>
- <para>GHC re-calculates the dependencies each time it is
- invoked, so the dependencies never get out of sync with the
- source.</para>
- </listitem>
+ </listitem>
+ <listitem>
+ <para>GHC re-calculates the dependencies each time it is
+ invoked, so the dependencies never get out of sync with the
+ source.</para>
+ </listitem>
</itemizedlist>
<para>Any of the command-line options described in the rest of
@@ -656,65 +656,65 @@ olleh
This table summarises:</para>
<informaltable>
- <tgroup cols="4">
- <colspec align="left"/>
- <colspec align="left"/>
- <colspec align="left"/>
- <colspec align="left"/>
-
- <thead>
- <row>
- <entry>Phase of the compilation system</entry>
- <entry>Suffix saying &ldquo;start here&rdquo;</entry>
- <entry>Flag saying &ldquo;stop after&rdquo;</entry>
- <entry>(suffix of) output file</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>literate pre-processor</entry>
- <entry><literal>.lhs</literal></entry>
- <entry>-</entry>
- <entry><literal>.hs</literal></entry>
- </row>
-
- <row>
- <entry>C pre-processor (opt.) </entry>
- <entry><literal>.hs</literal> (with
- <option>-cpp</option>)</entry>
- <entry><option>-E</option></entry>
- <entry><literal>.hspp</literal></entry>
- </row>
-
- <row>
- <entry>Haskell compiler</entry>
- <entry><literal>.hs</literal></entry>
- <entry><option>-C</option>, <option>-S</option></entry>
- <entry><literal>.hc</literal>, <literal>.s</literal></entry>
- </row>
-
- <row>
- <entry>C compiler (opt.)</entry>
- <entry><literal>.hc</literal> or <literal>.c</literal></entry>
- <entry><option>-S</option></entry>
- <entry><literal>.s</literal></entry>
- </row>
-
- <row>
- <entry>assembler</entry>
- <entry><literal>.s</literal></entry>
- <entry><option>-c</option></entry>
- <entry><literal>.o</literal></entry>
- </row>
-
- <row>
- <entry>linker</entry>
- <entry><replaceable>other</replaceable></entry>
- <entry>-</entry>
- <entry><filename>a.out</filename></entry>
- </row>
- </tbody>
- </tgroup>
+ <tgroup cols="4">
+ <colspec align="left"/>
+ <colspec align="left"/>
+ <colspec align="left"/>
+ <colspec align="left"/>
+
+ <thead>
+ <row>
+ <entry>Phase of the compilation system</entry>
+ <entry>Suffix saying &ldquo;start here&rdquo;</entry>
+ <entry>Flag saying &ldquo;stop after&rdquo;</entry>
+ <entry>(suffix of) output file</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>literate pre-processor</entry>
+ <entry><literal>.lhs</literal></entry>
+ <entry>-</entry>
+ <entry><literal>.hs</literal></entry>
+ </row>
+
+ <row>
+ <entry>C pre-processor (opt.) </entry>
+ <entry><literal>.hs</literal> (with
+ <option>-cpp</option>)</entry>
+ <entry><option>-E</option></entry>
+ <entry><literal>.hspp</literal></entry>
+ </row>
+
+ <row>
+ <entry>Haskell compiler</entry>
+ <entry><literal>.hs</literal></entry>
+ <entry><option>-C</option>, <option>-S</option></entry>
+ <entry><literal>.hc</literal>, <literal>.s</literal></entry>
+ </row>
+
+ <row>
+ <entry>C compiler (opt.)</entry>
+ <entry><literal>.hc</literal> or <literal>.c</literal></entry>
+ <entry><option>-S</option></entry>
+ <entry><literal>.s</literal></entry>
+ </row>
+
+ <row>
+ <entry>assembler</entry>
+ <entry><literal>.s</literal></entry>
+ <entry><option>-c</option></entry>
+ <entry><literal>.o</literal></entry>
+ </row>
+
+ <row>
+ <entry>linker</entry>
+ <entry><replaceable>other</replaceable></entry>
+ <entry>-</entry>
+ <entry><filename>a.out</filename></entry>
+ </row>
+ </tbody>
+ </tgroup>
</informaltable>
<indexterm><primary><option>-C</option></primary></indexterm>
@@ -745,26 +745,26 @@ ghc -c Foo.hs</screen>
of the compiler, dumping the result in a file.</para>
<sect3 id="overriding-suffixes">
- <title>Overriding the default behaviour for a file</title>
-
- <para>As described above, the way in which a file is processed by GHC
- depends on its suffix. This behaviour can be overridden using the
- <option>-x</option> option:</para>
-
- <variablelist>
- <varlistentry>
- <term><option>-x</option> <replaceable>suffix</replaceable>
- <indexterm><primary><option>-x</option></primary>
- </indexterm></term>
- <listitem>
- <para>Causes all files following this option on the command
- line to be processed as if they had the suffix
- <replaceable>suffix</replaceable>. For example, to compile a
- Haskell module in the file <literal>M.my-hs</literal>,
- use <literal>ghc -c -x hs M.my-hs</literal>.</para>
- </listitem>
- </varlistentry>
- </variablelist>
+ <title>Overriding the default behaviour for a file</title>
+
+ <para>As described above, the way in which a file is processed by GHC
+ depends on its suffix. This behaviour can be overridden using the
+ <option>-x</option> option:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-x</option> <replaceable>suffix</replaceable>
+ <indexterm><primary><option>-x</option></primary>
+ </indexterm></term>
+ <listitem>
+ <para>Causes all files following this option on the command
+ line to be processed as if they had the suffix
+ <replaceable>suffix</replaceable>. For example, to compile a
+ Haskell module in the file <literal>M.my-hs</literal>,
+ use <literal>ghc -c -x hs M.my-hs</literal>.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</sect3>
</sect2>
@@ -780,107 +780,107 @@ ghc -c Foo.hs</screen>
and <option>--print-libdir</option> modes in <xref linkend="modes"/>.</para>
<variablelist>
<varlistentry>
- <term>
+ <term>
<option>-v</option>
<indexterm><primary><option>-v</option></primary></indexterm>
</term>
- <listitem>
- <para>The <option>-v</option> option makes GHC
+ <listitem>
+ <para>The <option>-v</option> option makes GHC
<emphasis>verbose</emphasis>: it reports its version number
and shows (on stderr) exactly how it invokes each phase of
the compilation system. Moreover, it passes the
<option>-v</option> flag to most phases; each reports its
version number (and possibly some other information).</para>
- <para>Please, oh please, use the <option>-v</option> option
+ <para>Please, oh please, use the <option>-v</option> option
when reporting bugs! Knowing that you ran the right bits in
the right order is always the first thing we want to
verify.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<option>-v</option><replaceable>n</replaceable>
<indexterm><primary><option>-v</option></primary></indexterm>
</term>
- <listitem>
- <para>To provide more control over the compiler's verbosity,
- the <option>-v</option> flag takes an optional numeric
- argument. Specifying <option>-v</option> on its own is
- equivalent to <option>-v3</option>, and the other levels
- have the following meanings:</para>
-
- <variablelist>
- <varlistentry>
- <term><option>-v0</option></term>
- <listitem>
- <para>Disable all non-essential messages (this is the
- default).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-v1</option></term>
- <listitem>
- <para>Minimal verbosity: print one line per
- compilation (this is the default when
- <option>&ndash;&ndash;make</option> or
- <option>&ndash;&ndash;interactive</option> is on).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-v2</option></term>
- <listitem>
- <para>Print the name of each compilation phase as it
- is executed. (equivalent to
- <option>-dshow-passes</option>).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-v3</option></term>
- <listitem>
- <para>The same as <option>-v2</option>, except that in
+ <listitem>
+ <para>To provide more control over the compiler's verbosity,
+ the <option>-v</option> flag takes an optional numeric
+ argument. Specifying <option>-v</option> on its own is
+ equivalent to <option>-v3</option>, and the other levels
+ have the following meanings:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-v0</option></term>
+ <listitem>
+ <para>Disable all non-essential messages (this is the
+ default).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-v1</option></term>
+ <listitem>
+ <para>Minimal verbosity: print one line per
+ compilation (this is the default when
+ <option>&ndash;&ndash;make</option> or
+ <option>&ndash;&ndash;interactive</option> is on).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-v2</option></term>
+ <listitem>
+ <para>Print the name of each compilation phase as it
+ is executed. (equivalent to
+ <option>-dshow-passes</option>).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-v3</option></term>
+ <listitem>
+ <para>The same as <option>-v2</option>, except that in
addition the full command line (if appropriate) for
each compilation phase is also printed.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-v4</option></term>
- <listitem>
- <para>The same as <option>-v3</option> except that the
- intermediate program representation after each
- compilation phase is also printed (excluding
- preprocessed and C/assembly files).</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </listitem>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-v4</option></term>
+ <listitem>
+ <para>The same as <option>-v3</option> except that the
+ intermediate program representation after each
+ compilation phase is also printed (excluding
+ preprocessed and C/assembly files).</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-ferror-spans</option>
+ <term><option>-ferror-spans</option>
<indexterm><primary><option>-ferror-spans</option></primary>
- </indexterm>
+ </indexterm>
</term>
- <listitem>
- <para>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.</para>
+ <listitem>
+ <para>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.</para>
- <para>For example:</para>
+ <para>For example:</para>
<screen>test.hs:3:6: parse error on input `where'</screen>
- <para>becomes:</para>
+ <para>becomes:</para>
<screen>test296.hs:3:6-10: parse error on input `where'</screen>
- <para>And multi-line spans are possible too:</para>
+ <para>And multi-line spans are possible too:</para>
<screen>test.hs:(5,4)-(6,7):
Conflicting definitions for `a'
@@ -888,11 +888,11 @@ ghc -c Foo.hs</screen>
test.hs:6:7
In the binding group for: a, b, a</screen>
- <para>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).</para>
- </listitem>
+ <para>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).</para>
+ </listitem>
</varlistentry>
<varlistentry>
@@ -954,27 +954,27 @@ ghc -c Foo.hs</screen>
<variablelist>
<varlistentry>
- <term><option>-W</option>:</term>
- <listitem>
- <indexterm><primary>-W option</primary></indexterm>
- <para>Provides the standard warnings plus
- <option>-fwarn-incomplete-patterns</option>,
- <option>-fwarn-dodgy-exports</option>,
- <option>-fwarn-dodgy-imports</option>,
- <option>-fwarn-unused-matches</option>,
- <option>-fwarn-unused-imports</option>, and
- <option>-fwarn-unused-binds</option>.</para>
- </listitem>
+ <term><option>-W</option>:</term>
+ <listitem>
+ <indexterm><primary>-W option</primary></indexterm>
+ <para>Provides the standard warnings plus
+ <option>-fwarn-incomplete-patterns</option>,
+ <option>-fwarn-dodgy-exports</option>,
+ <option>-fwarn-dodgy-imports</option>,
+ <option>-fwarn-unused-matches</option>,
+ <option>-fwarn-unused-imports</option>, and
+ <option>-fwarn-unused-binds</option>.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-Wall</option>:</term>
- <listitem>
- <indexterm><primary><option>-Wall</option></primary></indexterm>
- <para>Turns on all warning options that indicate potentially
- suspicious code. The warnings that are
- <emphasis>not</emphasis> enabled by <option>-Wall</option>
- are
+ <term><option>-Wall</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-Wall</option></primary></indexterm>
+ <para>Turns on all warning options that indicate potentially
+ suspicious code. The warnings that are
+ <emphasis>not</emphasis> enabled by <option>-Wall</option>
+ are
<option>-fwarn-tabs</option>,
<option>-fwarn-incomplete-uni-patterns</option>,
<option>-fwarn-incomplete-record-updates</option>,
@@ -982,35 +982,35 @@ ghc -c Foo.hs</screen>
<option>-fwarn-unrecognised-pragmas</option>,
<option>-fwarn-auto-orphans</option>,
<option>-fwarn-implicit-prelude</option>.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-w</option>:</term>
- <listitem>
- <indexterm><primary><option>-w</option></primary></indexterm>
- <para>Turns off all warnings, including the standard ones and
+ <term><option>-w</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-w</option></primary></indexterm>
+ <para>Turns off all warnings, including the standard ones and
those that <literal>-Wall</literal> doesn't enable.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-Werror</option>:</term>
- <listitem>
- <indexterm><primary><option>-Werror</option></primary></indexterm>
- <para>Makes any warning into a fatal error. Useful so that you don't
- miss warnings when doing batch compilation. </para>
- </listitem>
+ <term><option>-Werror</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-Werror</option></primary></indexterm>
+ <para>Makes any warning into a fatal error. Useful so that you don't
+ miss warnings when doing batch compilation. </para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-Wwarn</option>:</term>
- <listitem>
- <indexterm><primary><option>-Wwarn</option></primary></indexterm>
- <para>Warnings are treated only as warnings, not as errors. This is
- the default, but can be useful to negate a
+ <term><option>-Wwarn</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-Wwarn</option></primary></indexterm>
+ <para>Warnings are treated only as warnings, not as errors. This is
+ the default, but can be useful to negate a
<option>-Werror</option> flag.</para>
- </listitem>
+ </listitem>
</varlistentry>
</variablelist>
@@ -1022,84 +1022,84 @@ ghc -c Foo.hs</screen>
<variablelist>
<varlistentry>
- <term><option>-fdefer-type-errors</option>:</term>
- <listitem>
- <indexterm><primary><option>-fdefer-type-errors</option></primary>
- </indexterm>
- <indexterm><primary>warnings</primary></indexterm>
- <para>Defer as many type errors as possible until runtime.
+ <term><option>-fdefer-type-errors</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fdefer-type-errors</option></primary>
+ </indexterm>
+ <indexterm><primary>warnings</primary></indexterm>
+ <para>Defer as many type errors as possible until runtime.
At compile time you get a warning (instead of an error). At
runtime, if you use a value that depends on a type error, you
get a runtime error; but you can run any type-correct parts of your code
just fine.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fhelpful-errors</option>:</term>
- <listitem>
- <indexterm><primary><option>-fhelpful-errors</option></primary>
- </indexterm>
- <indexterm><primary>warnings</primary></indexterm>
- <para>When a name or package is not found in scope, make
+ <term><option>-fhelpful-errors</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fhelpful-errors</option></primary>
+ </indexterm>
+ <indexterm><primary>warnings</primary></indexterm>
+ <para>When a name or package is not found in scope, make
suggestions for the name or package you might have meant instead.</para>
- <para>This option is on by default.</para>
- </listitem>
+ <para>This option is on by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-unrecognised-pragmas</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-unrecognised-pragmas</option></primary>
- </indexterm>
- <indexterm><primary>warnings</primary></indexterm>
- <indexterm><primary>pragmas</primary></indexterm>
- <para>Causes a warning to be emitted when a
- pragma that GHC doesn't recognise is used. As well as pragmas
+ <term><option>-fwarn-unrecognised-pragmas</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-unrecognised-pragmas</option></primary>
+ </indexterm>
+ <indexterm><primary>warnings</primary></indexterm>
+ <indexterm><primary>pragmas</primary></indexterm>
+ <para>Causes a warning to be emitted when a
+ pragma that GHC doesn't recognise is used. As well as pragmas
that GHC itself uses, GHC also recognises pragmas known to be used
by other tools, e.g. <literal>OPTIONS_HUGS</literal> and
<literal>DERIVE</literal>.</para>
- <para>This option is on by default.</para>
- </listitem>
+ <para>This option is on by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-warnings-deprecations</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-warnings-deprecations</option></primary>
- </indexterm>
- <indexterm><primary>warnings</primary></indexterm>
- <indexterm><primary>deprecations</primary></indexterm>
- <para>Causes a warning to be emitted when a
- module, function or type with a WARNING or DEPRECATED pragma
+ <term><option>-fwarn-warnings-deprecations</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-warnings-deprecations</option></primary>
+ </indexterm>
+ <indexterm><primary>warnings</primary></indexterm>
+ <indexterm><primary>deprecations</primary></indexterm>
+ <para>Causes a warning to be emitted when a
+ module, function or type with a WARNING or DEPRECATED pragma
is used. See <xref linkend="warning-deprecated-pragma"/> for more
details on the pragmas.</para>
- <para>This option is on by default.</para>
- </listitem>
+ <para>This option is on by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-deprecated-flags</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-deprecated-flags</option></primary>
- </indexterm>
- <indexterm><primary>deprecated-flags</primary></indexterm>
- <para>Causes a warning to be emitted when a deprecated
- commandline flag is used.</para>
+ <term><option>-fwarn-deprecated-flags</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-deprecated-flags</option></primary>
+ </indexterm>
+ <indexterm><primary>deprecated-flags</primary></indexterm>
+ <para>Causes a warning to be emitted when a deprecated
+ commandline flag is used.</para>
- <para>This option is on by default.</para>
- </listitem>
+ <para>This option is on by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-dodgy-foreign-imports</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-dodgy-foreign-imports</option></primary>
- </indexterm>
- <para>Causes a warning to be emitted for foreign imports of
- the following form:</para>
+ <term><option>-fwarn-dodgy-foreign-imports</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-dodgy-foreign-imports</option></primary>
+ </indexterm>
+ <para>Causes a warning to be emitted for foreign imports of
+ the following form:</para>
<programlisting>
foreign import "f" f :: FunPtr t
</programlisting>
@@ -1114,83 +1114,83 @@ foreign import "&amp;f" f :: FunPtr t
declaration is usually a mistake, and one that is hard to
debug because it results in a crash, hence this
warning.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-dodgy-exports</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-dodgy-exports</option></primary>
- </indexterm>
- <para>Causes a warning to be emitted when a datatype
+ <term><option>-fwarn-dodgy-exports</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-dodgy-exports</option></primary>
+ </indexterm>
+ <para>Causes a warning to be emitted when a datatype
<literal>T</literal> is exported
with all constructors, i.e. <literal>T(..)</literal>, but is it
just a type synonym.</para>
- <para>Also causes a warning to be emitted when a module is
+ <para>Also causes a warning to be emitted when a module is
re-exported, but that module exports nothing.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-dodgy-imports</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-dodgy-imports</option></primary>
- </indexterm>
- <para>Causes a warning to be emitted when a datatype
+ <term><option>-fwarn-dodgy-imports</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-dodgy-imports</option></primary>
+ </indexterm>
+ <para>Causes a warning to be emitted when a datatype
<literal>T</literal> is imported
with all constructors, i.e. <literal>T(..)</literal>, but has been
exported abstractly, i.e. <literal>T</literal>.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-lazy-unlifted-bindings</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-lazy-unlifted-bindings</option></primary>
- </indexterm>
- <para>Causes a warning to be emitted when an unlifted type
+ <term><option>-fwarn-lazy-unlifted-bindings</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-lazy-unlifted-bindings</option></primary>
+ </indexterm>
+ <para>Causes a warning to be emitted when an unlifted type
is bound in a way that looks lazy, e.g.
<literal>where (I# x) = ...</literal>. Use
<literal>where !(I# x) = ...</literal> instead. This will be an
error, rather than a warning, in GHC 7.2.
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-duplicate-exports</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-duplicate-exports</option></primary></indexterm>
- <indexterm><primary>duplicate exports, warning</primary></indexterm>
- <indexterm><primary>export lists, duplicates</primary></indexterm>
+ <term><option>-fwarn-duplicate-exports</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-duplicate-exports</option></primary></indexterm>
+ <indexterm><primary>duplicate exports, warning</primary></indexterm>
+ <indexterm><primary>export lists, duplicates</primary></indexterm>
- <para>Have the compiler warn about duplicate entries in
+ <para>Have the compiler warn about duplicate entries in
export lists. This is useful information if you maintain
large export lists, and want to avoid the continued export
of a definition after you've deleted (one) mention of it in
the export list.</para>
- <para>This option is on by default.</para>
- </listitem>
+ <para>This option is on by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-hi-shadowing</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-hi-shadowing</option></primary></indexterm>
- <indexterm><primary>shadowing</primary>
- <secondary>interface files</secondary></indexterm>
-
- <para>Causes the compiler to emit a warning when a module or
- interface file in the current directory is shadowing one
- with the same module name in a library or other
- directory.</para>
- </listitem>
+ <term><option>-fwarn-hi-shadowing</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-hi-shadowing</option></primary></indexterm>
+ <indexterm><primary>shadowing</primary>
+ <secondary>interface files</secondary></indexterm>
+
+ <para>Causes the compiler to emit a warning when a module or
+ interface file in the current directory is shadowing one
+ with the same module name in a library or other
+ directory.</para>
+ </listitem>
</varlistentry>
<varlistentry>
<term><option>-fwarn-identities</option>:</term>
- <listitem>
+ <listitem>
<indexterm><primary><option>-fwarn-identities</option></primary></indexterm>
<para>Causes the compiler to emit a warning when a Prelude numeric
conversion converts a type T to the same type T; such calls
@@ -1200,7 +1200,7 @@ foreign import "&amp;f" f :: FunPtr t
<literal>fromIntegral</literal>,
and <literal>realToFrac</literal>.
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
@@ -1229,18 +1229,18 @@ foreign import "&amp;f" f :: FunPtr t
</varlistentry>
<varlistentry>
- <term><option>-fwarn-incomplete-patterns</option>,
+ <term><option>-fwarn-incomplete-patterns</option>,
<option>-fwarn-incomplete-uni-patterns</option>:
</term>
- <listitem>
- <indexterm><primary><option>-fwarn-incomplete-patterns</option></primary></indexterm>
- <indexterm><primary><option>-fwarn-incomplete-uni-patterns</option></primary></indexterm>
- <indexterm><primary>incomplete patterns, warning</primary></indexterm>
- <indexterm><primary>patterns, incomplete</primary></indexterm>
+ <listitem>
+ <indexterm><primary><option>-fwarn-incomplete-patterns</option></primary></indexterm>
+ <indexterm><primary><option>-fwarn-incomplete-uni-patterns</option></primary></indexterm>
+ <indexterm><primary>incomplete patterns, warning</primary></indexterm>
+ <indexterm><primary>patterns, incomplete</primary></indexterm>
<para>The option <option>-fwarn-incomplete-patterns</option> warns
about places where
- a pattern-match might fail at runtime.
+ a pattern-match might fail at runtime.
The function
<function>g</function> below will fail when applied to
non-empty lists, so the compiler will emit a warning about
@@ -1249,7 +1249,7 @@ foreign import "&amp;f" f :: FunPtr t
<programlisting>
g [] = 2
</programlisting>
- This option isn't enabled by default because it can be
+ This option isn't enabled by default because it can be
a bit noisy, and it doesn't always indicate a bug in the
program. However, it's generally considered good practice
to cover all the cases in your functions, and it is switched
@@ -1258,23 +1258,23 @@ g [] = 2
<para>The flag <option>-fwarn-incomplete-uni-patterns</option> is
similar, except that it
applies only to lambda-expressions and pattern bindings, constructs
- that only allow a single pattern:
+ that only allow a single pattern:
<programlisting>
h = \[] -> 2
Just k = f y
</programlisting>
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-incomplete-record-updates</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-incomplete-record-updates</option></primary></indexterm>
- <indexterm><primary>incomplete record updates, warning</primary></indexterm>
- <indexterm><primary>record updates, incomplete</primary></indexterm>
+ <term><option>-fwarn-incomplete-record-updates</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-incomplete-record-updates</option></primary></indexterm>
+ <indexterm><primary>incomplete record updates, warning</primary></indexterm>
+ <indexterm><primary>record updates, incomplete</primary></indexterm>
- <para>The function
+ <para>The function
<function>f</function> below will fail when applied to
<literal>Bar</literal>, so the compiler will emit a warning about
this when <option>-fwarn-incomplete-record-updates</option> is
@@ -1288,42 +1288,42 @@ f :: Foo -> Foo
f foo = foo { x = 6 }
</programlisting>
- <para>This option isn't enabled by default because it can be
+ <para>This option isn't enabled by default because it can be
very noisy, and it often doesn't indicate a bug in the
program.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<option>-fwarn-missing-fields</option>:
- <indexterm><primary><option>-fwarn-missing-fields</option></primary></indexterm>
- <indexterm><primary>missing fields, warning</primary></indexterm>
- <indexterm><primary>fields, missing</primary></indexterm>
+ <indexterm><primary><option>-fwarn-missing-fields</option></primary></indexterm>
+ <indexterm><primary>missing fields, warning</primary></indexterm>
+ <indexterm><primary>fields, missing</primary></indexterm>
</term>
- <listitem>
+ <listitem>
- <para>This option is on by default, and warns you whenever
+ <para>This option is on by default, and warns you whenever
the construction of a labelled field constructor isn't
complete, missing initializers for one or more fields. While
not an error (the missing fields are initialised with
bottoms), it is often an indication of a programmer error.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<option>-fwarn-missing-import-lists</option>:
- <indexterm><primary><option>-fwarn-import-lists</option></primary></indexterm>
- <indexterm><primary>missing import lists, warning</primary></indexterm>
- <indexterm><primary>import lists, missing</primary></indexterm>
+ <indexterm><primary><option>-fwarn-import-lists</option></primary></indexterm>
+ <indexterm><primary>missing import lists, warning</primary></indexterm>
+ <indexterm><primary>import lists, missing</primary></indexterm>
</term>
- <listitem>
+ <listitem>
- <para>This flag warns if you use an unqualified
+ <para>This flag warns if you use an unqualified
<literal>import</literal> declaration
- that does not explicitly list the entities brought into scope. For
- example
+ that does not explicitly list the entities brought into scope. For
+ example
</para>
<programlisting>
module M where
@@ -1334,77 +1334,77 @@ module M where
</programlisting>
<para>
The <option>-fwarn-import-lists</option> flag will warn about the import
- of <literal>Y</literal> but not <literal>X</literal>
- If module <literal>Y</literal> is later changed to export (say) <literal>f</literal>,
+ of <literal>Y</literal> but not <literal>X</literal>
+ If module <literal>Y</literal> is later changed to export (say) <literal>f</literal>,
then the reference to <literal>f</literal> in <literal>M</literal> will become
- ambiguous. No warning is produced for the import of <literal>Z</literal>
- because extending <literal>Z</literal>'s exports would be unlikely to produce
- ambiguity in <literal>M</literal>.
+ ambiguous. No warning is produced for the import of <literal>Z</literal>
+ because extending <literal>Z</literal>'s exports would be unlikely to produce
+ ambiguity in <literal>M</literal>.
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-missing-methods</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-missing-methods</option></primary></indexterm>
- <indexterm><primary>missing methods, warning</primary></indexterm>
- <indexterm><primary>methods, missing</primary></indexterm>
+ <term><option>-fwarn-missing-methods</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-missing-methods</option></primary></indexterm>
+ <indexterm><primary>missing methods, warning</primary></indexterm>
+ <indexterm><primary>methods, missing</primary></indexterm>
- <para>This option is on by default, and warns you whenever
+ <para>This option is on by default, and warns you whenever
an instance declaration is missing one or more methods, and
the corresponding class declaration has no default
declaration for them.</para>
- <para>The warning is suppressed if the method name
- begins with an underscore. Here's an example where this is useful:
- <programlisting>
- class C a where
- _simpleFn :: a -> String
- complexFn :: a -> a -> String
- complexFn x y = ... _simpleFn ...
- </programlisting>
- The idea is that: (a) users of the class will only call <literal>complexFn</literal>;
- never <literal>_simpleFn</literal>; and (b)
- instance declarations can define either <literal>complexFn</literal> or <literal>_simpleFn</literal>.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-fwarn-missing-signatures</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-missing-signatures</option></primary></indexterm>
- <indexterm><primary>type signatures, missing</primary></indexterm>
-
- <para>If you would like GHC to check that every top-level
+ <para>The warning is suppressed if the method name
+ begins with an underscore. Here's an example where this is useful:
+ <programlisting>
+ class C a where
+ _simpleFn :: a -> String
+ complexFn :: a -> a -> String
+ complexFn x y = ... _simpleFn ...
+ </programlisting>
+ The idea is that: (a) users of the class will only call <literal>complexFn</literal>;
+ never <literal>_simpleFn</literal>; and (b)
+ instance declarations can define either <literal>complexFn</literal> or <literal>_simpleFn</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-fwarn-missing-signatures</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-missing-signatures</option></primary></indexterm>
+ <indexterm><primary>type signatures, missing</primary></indexterm>
+
+ <para>If you would like GHC to check that every top-level
function/value has a type signature, use the
<option>-fwarn-missing-signatures</option> option. As part of
- the warning GHC also reports the inferred type. The
+ the warning GHC also reports the inferred type. The
option is off by default.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-missing-local-sigs</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-missing-local-sigs</option></primary></indexterm>
- <indexterm><primary>type signatures, missing</primary></indexterm>
+ <term><option>-fwarn-missing-local-sigs</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-missing-local-sigs</option></primary></indexterm>
+ <indexterm><primary>type signatures, missing</primary></indexterm>
- <para>If you use the
+ <para>If you use the
<option>-fwarn-missing-local-sigs</option> flag GHC will warn
you about any polymorphic local bindings. As part of
- the warning GHC also reports the inferred type. The
+ the warning GHC also reports the inferred type. The
option is off by default.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-name-shadowing</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-name-shadowing</option></primary></indexterm>
- <indexterm><primary>shadowing, warning</primary></indexterm>
+ <term><option>-fwarn-name-shadowing</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-name-shadowing</option></primary></indexterm>
+ <indexterm><primary>shadowing, warning</primary></indexterm>
- <para>This option causes a warning to be emitted whenever an
+ <para>This option causes a warning to be emitted whenever an
inner-scope value has the same name as an outer-scope value,
i.e. the inner value shadows the outer one. This can catch
typographical errors that turn into hard-to-find bugs, e.g.,
@@ -1415,46 +1415,46 @@ module M where
f x = do { _ignore &lt;- this; _ignore &lt;- that; return (the other) }
</programlisting>
</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-fwarn-orphans, -fwarn-auto-orphans</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-orphans</option></primary></indexterm>
- <indexterm><primary><option>-fwarn-auto-orphans</option></primary></indexterm>
- <indexterm><primary>orphan instances, warning</primary></indexterm>
- <indexterm><primary>orphan rules, warning</primary></indexterm>
-
- <para>These flags cause a warning to be emitted whenever the
- module contains an "orphan" instance declaration or rewrite rule.
- An instance declaration is an orphan if it appears in a module in
- which neither the class nor the type being instanced are declared
- in the same module. A rule is an orphan if it is a rule for a
- function declared in another module. A module containing any
- orphans is called an orphan module.</para>
- <para>The trouble with orphans is that GHC must pro-actively read the interface
- files for all orphan modules, just in case their instances or rules
- play a role, whether or not the module's interface would otherwise
- be of any use. See <xref linkend="orphan-modules"/> for details.
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-fwarn-orphans, -fwarn-auto-orphans</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-orphans</option></primary></indexterm>
+ <indexterm><primary><option>-fwarn-auto-orphans</option></primary></indexterm>
+ <indexterm><primary>orphan instances, warning</primary></indexterm>
+ <indexterm><primary>orphan rules, warning</primary></indexterm>
+
+ <para>These flags cause a warning to be emitted whenever the
+ module contains an "orphan" instance declaration or rewrite rule.
+ An instance declaration is an orphan if it appears in a module in
+ which neither the class nor the type being instanced are declared
+ in the same module. A rule is an orphan if it is a rule for a
+ function declared in another module. A module containing any
+ orphans is called an orphan module.</para>
+ <para>The trouble with orphans is that GHC must pro-actively read the interface
+ files for all orphan modules, just in case their instances or rules
+ play a role, whether or not the module's interface would otherwise
+ be of any use. See <xref linkend="orphan-modules"/> for details.
</para>
<para>The flag <option>-fwarn-orphans</option> warns about user-written
orphan rules or instances. The flag <option>-fwarn-auto-orphans</option>
warns about automatically-generated orphan rules, notably as a result of
specialising functions, for type classes (<literal>Specialise</literal>)
or argument values (<literal>SpecConstr</literal>).</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term>
+ <term>
<option>-fwarn-overlapping-patterns</option>:
<indexterm><primary><option>-fwarn-overlapping-patterns</option></primary></indexterm>
<indexterm><primary>overlapping patterns, warning</primary></indexterm>
<indexterm><primary>patterns, overlapping</primary></indexterm>
</term>
- <listitem>
- <para>By default, the compiler will warn you if a set of
+ <listitem>
+ <para>By default, the compiler will warn you if a set of
patterns are overlapping, e.g.,</para>
<programlisting>
@@ -1464,31 +1464,31 @@ f (_:xs) = 1
f "2" = 2
</programlisting>
- <para>where the last pattern match in <function>f</function>
+ <para>where the last pattern match in <function>f</function>
won't ever be reached, as the second pattern overlaps
it. More often than not, redundant patterns is a programmer
mistake/error, so this option is enabled by default.</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-tabs</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-tabs</option></primary></indexterm>
- <indexterm><primary>tabs, warning</primary></indexterm>
- <para>Have the compiler warn if there are tabs in your source
+ <term><option>-fwarn-tabs</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-tabs</option></primary></indexterm>
+ <indexterm><primary>tabs, warning</primary></indexterm>
+ <para>Have the compiler warn if there are tabs in your source
file.</para>
- <para>This warning is off by default.</para>
- </listitem>
+ <para>This warning is off by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-type-defaults</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-type-defaults</option></primary></indexterm>
- <indexterm><primary>defaulting mechanism, warning</primary></indexterm>
- <para>Have the compiler warn/inform you where in your source
+ <term><option>-fwarn-type-defaults</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-type-defaults</option></primary></indexterm>
+ <indexterm><primary>defaulting mechanism, warning</primary></indexterm>
+ <para>Have the compiler warn/inform you where in your source
the Haskell defaulting mechanism for numeric types kicks
in. This is useful information when converting code from a
context that assumed one default into one with another,
@@ -1500,124 +1500,124 @@ f "2" = 2
differences in performance and behaviour, hence the
usefulness of being non-silent about this.</para>
- <para>This warning is off by default.</para>
- </listitem>
+ <para>This warning is off by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-monomorphism-restriction</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-monomorphism-restriction</option></primary></indexterm>
- <indexterm><primary>monomorphism restriction, warning</primary></indexterm>
- <para>Have the compiler warn/inform you where in your source
+ <term><option>-fwarn-monomorphism-restriction</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-monomorphism-restriction</option></primary></indexterm>
+ <indexterm><primary>monomorphism restriction, warning</primary></indexterm>
+ <para>Have the compiler warn/inform you where in your source
the Haskell Monomorphism Restriction is applied. If applied silently
- the MR can give rise to unexpected behaviour, so it can be helpful
- to have an explicit warning that it is being applied.</para>
+ the MR can give rise to unexpected behaviour, so it can be helpful
+ to have an explicit warning that it is being applied.</para>
- <para>This warning is off by default.</para>
- </listitem>
+ <para>This warning is off by default.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-unused-binds</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-unused-binds</option></primary></indexterm>
- <indexterm><primary>unused binds, warning</primary></indexterm>
- <indexterm><primary>binds, unused</primary></indexterm>
- <para>Report any function definitions (and local bindings)
+ <term><option>-fwarn-unused-binds</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-unused-binds</option></primary></indexterm>
+ <indexterm><primary>unused binds, warning</primary></indexterm>
+ <indexterm><primary>binds, unused</primary></indexterm>
+ <para>Report any function definitions (and local bindings)
which are unused. For top-level functions, the warning is
only given if the binding is not exported.</para>
- <para>A definition is regarded as "used" if (a) it is exported, or (b) it is
- mentioned in the right hand side of another definition that is used, or (c) the
- function it defines begins with an underscore. The last case provides a
- way to suppress unused-binding warnings selectively. </para>
- <para> Notice that a variable
- is reported as unused even if it appears in the right-hand side of another
- unused binding. </para>
- </listitem>
+ <para>A definition is regarded as "used" if (a) it is exported, or (b) it is
+ mentioned in the right hand side of another definition that is used, or (c) the
+ function it defines begins with an underscore. The last case provides a
+ way to suppress unused-binding warnings selectively. </para>
+ <para> Notice that a variable
+ is reported as unused even if it appears in the right-hand side of another
+ unused binding. </para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-unused-imports</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-unused-imports</option></primary></indexterm>
- <indexterm><primary>unused imports, warning</primary></indexterm>
- <indexterm><primary>imports, unused</primary></indexterm>
-
- <para>Report any modules that are explicitly imported but
- never used. However, the form <literal>import M()</literal> is
- never reported as an unused import, because it is a useful idiom
- for importing instance declarations, which are anonymous in Haskell.</para>
- </listitem>
+ <term><option>-fwarn-unused-imports</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-unused-imports</option></primary></indexterm>
+ <indexterm><primary>unused imports, warning</primary></indexterm>
+ <indexterm><primary>imports, unused</primary></indexterm>
+
+ <para>Report any modules that are explicitly imported but
+ never used. However, the form <literal>import M()</literal> is
+ never reported as an unused import, because it is a useful idiom
+ for importing instance declarations, which are anonymous in Haskell.</para>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-unused-matches</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-unused-matches</option></primary></indexterm>
- <indexterm><primary>unused matches, warning</primary></indexterm>
- <indexterm><primary>matches, unused</primary></indexterm>
+ <term><option>-fwarn-unused-matches</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-unused-matches</option></primary></indexterm>
+ <indexterm><primary>unused matches, warning</primary></indexterm>
+ <indexterm><primary>matches, unused</primary></indexterm>
- <para>Report all unused variables which arise from pattern
+ <para>Report all unused variables which arise from pattern
matches, including patterns consisting of a single variable.
For instance <literal>f x y = []</literal> would report
<varname>x</varname> and <varname>y</varname> as unused. The
warning is suppressed if the variable name begins with an underscore, thus:
- <programlisting>
- f _x = True
- </programlisting>
+ <programlisting>
+ f _x = True
+ </programlisting>
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-unused-do-bind</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-unused-do-bind</option></primary></indexterm>
- <indexterm><primary>unused do binding, warning</primary></indexterm>
- <indexterm><primary>do binding, unused</primary></indexterm>
+ <term><option>-fwarn-unused-do-bind</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-unused-do-bind</option></primary></indexterm>
+ <indexterm><primary>unused do binding, warning</primary></indexterm>
+ <indexterm><primary>do binding, unused</primary></indexterm>
- <para>Report expressions occurring in <literal>do</literal> and <literal>mdo</literal> blocks
- that appear to silently throw information away.
+ <para>Report expressions occurring in <literal>do</literal> and <literal>mdo</literal> blocks
+ that appear to silently throw information away.
For instance <literal>do { mapM popInt xs ; return 10 }</literal> would report
the first statement in the <literal>do</literal> block as suspicious,
as it has the type <literal>StackM [Int]</literal> and not <literal>StackM ()</literal>, but that
<literal>[Int]</literal> value is not bound to anything. The warning is suppressed by
explicitly mentioning in the source code that your program is throwing something away:
- <programlisting>
- do { _ &lt;- mapM popInt xs ; return 10 }
- </programlisting>
- Of course, in this particular situation you can do even better:
- <programlisting>
- do { mapM_ popInt xs ; return 10 }
- </programlisting>
+ <programlisting>
+ do { _ &lt;- mapM popInt xs ; return 10 }
+ </programlisting>
+ Of course, in this particular situation you can do even better:
+ <programlisting>
+ do { mapM_ popInt xs ; return 10 }
+ </programlisting>
</para>
- </listitem>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>-fwarn-wrong-do-bind</option>:</term>
- <listitem>
- <indexterm><primary><option>-fwarn-wrong-do-bind</option></primary></indexterm>
- <indexterm><primary>apparently erroneous do binding, warning</primary></indexterm>
- <indexterm><primary>do binding, apparently erroneous</primary></indexterm>
+ <term><option>-fwarn-wrong-do-bind</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-wrong-do-bind</option></primary></indexterm>
+ <indexterm><primary>apparently erroneous do binding, warning</primary></indexterm>
+ <indexterm><primary>do binding, apparently erroneous</primary></indexterm>
- <para>Report expressions occurring in <literal>do</literal> and <literal>mdo</literal> blocks
- that appear to lack a binding.
+ <para>Report expressions occurring in <literal>do</literal> and <literal>mdo</literal> blocks
+ that appear to lack a binding.
For instance <literal>do { return (popInt 10) ; return 10 }</literal> would report
the first statement in the <literal>do</literal> block as suspicious,
as it has the type <literal>StackM (StackM Int)</literal> (which consists of two nested applications
of the same monad constructor), but which is not then &quot;unpacked&quot; by binding the result.
The warning is suppressed by explicitly mentioning in the source code that your program is throwing something away:
- <programlisting>
- do { _ &lt;- return (popInt 10) ; return 10 }
- </programlisting>
- For almost all sensible programs this will indicate a bug, and you probably intended to write:
- <programlisting>
- do { popInt 10 ; return 10 }
- </programlisting>
+ <programlisting>
+ do { _ &lt;- return (popInt 10) ; return 10 }
+ </programlisting>
+ For almost all sensible programs this will indicate a bug, and you probably intended to write:
+ <programlisting>
+ do { popInt 10 ; return 10 }
+ </programlisting>
</para>
- </listitem>
+ </listitem>
</varlistentry>
</variablelist>
@@ -1665,69 +1665,69 @@ f "2" = 2
<variablelist>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
No <option>-O*</option>-type option specified:
<indexterm><primary>-O* not specified</primary></indexterm>
</term>
- <listitem>
- <para>This is taken to mean: &ldquo;Please compile
+ <listitem>
+ <para>This is taken to mean: &ldquo;Please compile
quickly; I'm not over-bothered about compiled-code
quality.&rdquo; So, for example: <command>ghc -c
Foo.hs</command></para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-O0</option>:
<indexterm><primary><option>-O0</option></primary></indexterm>
</term>
- <listitem>
- <para>Means &ldquo;turn off all optimisation&rdquo;,
- reverting to the same settings as if no
- <option>-O</option> options had been specified. Saying
- <option>-O0</option> can be useful if
- eg. <command>make</command> has inserted a
- <option>-O</option> on the command line already.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <listitem>
+ <para>Means &ldquo;turn off all optimisation&rdquo;,
+ reverting to the same settings as if no
+ <option>-O</option> options had been specified. Saying
+ <option>-O0</option> can be useful if
+ eg. <command>make</command> has inserted a
+ <option>-O</option> on the command line already.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-O</option> or <option>-O1</option>:
<indexterm><primary>-O option</primary></indexterm>
<indexterm><primary>-O1 option</primary></indexterm>
<indexterm><primary>optimise</primary><secondary>normally</secondary></indexterm>
</term>
- <listitem>
- <para>Means: &ldquo;Generate good-quality code without
+ <listitem>
+ <para>Means: &ldquo;Generate good-quality code without
taking too long about it.&rdquo; Thus, for example:
<command>ghc -c -O Main.lhs</command></para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-O2</option>:
<indexterm><primary>-O2 option</primary></indexterm>
<indexterm><primary>optimise</primary><secondary>aggressively</secondary></indexterm>
</term>
- <listitem>
- <para>Means: &ldquo;Apply every non-dangerous
+ <listitem>
+ <para>Means: &ldquo;Apply every non-dangerous
optimisation, even if it means significantly longer
compile times.&rdquo;</para>
- <para>The avoided &ldquo;dangerous&rdquo; optimisations
+ <para>The avoided &ldquo;dangerous&rdquo; optimisations
are those that can make runtime or space
<emphasis>worse</emphasis> if you're unlucky. They are
normally turned on or off individually.</para>
- <para>At the moment, <option>-O2</option> is
+ <para>At the moment, <option>-O2</option> is
<emphasis>unlikely</emphasis> to produce better code than
<option>-O</option>.</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>We don't use a <option>-O*</option> flag for day-to-day
@@ -1755,88 +1755,88 @@ f "2" = 2
interest:</para>
<variablelist>
- <varlistentry>
- <term><option>-fexcess-precision</option>:</term>
- <listitem>
- <indexterm><primary><option>-fexcess-precision</option></primary></indexterm>
- <para>When this option is given, intermediate floating
- point values can have a <emphasis>greater</emphasis>
- precision/range than the final type. Generally this is a
- good thing, but some programs may rely on the exact
- precision/range of
- <literal>Float</literal>/<literal>Double</literal> values
- and should not use this option for their compilation.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-fignore-asserts</option>:</term>
- <listitem>
- <indexterm><primary><option>-fignore-asserts</option></primary></indexterm>
- <para>Causes GHC to ignore uses of the function
- <literal>Exception.assert</literal> in source code (in
- other words, rewriting <literal>Exception.assert p
- e</literal> to <literal>e</literal> (see <xref
- linkend="assertions"/>). This flag is turned on by
- <option>-O</option>.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <varlistentry>
+ <term><option>-fexcess-precision</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fexcess-precision</option></primary></indexterm>
+ <para>When this option is given, intermediate floating
+ point values can have a <emphasis>greater</emphasis>
+ precision/range than the final type. Generally this is a
+ good thing, but some programs may rely on the exact
+ precision/range of
+ <literal>Float</literal>/<literal>Double</literal> values
+ and should not use this option for their compilation.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-fignore-asserts</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fignore-asserts</option></primary></indexterm>
+ <para>Causes GHC to ignore uses of the function
+ <literal>Exception.assert</literal> in source code (in
+ other words, rewriting <literal>Exception.assert p
+ e</literal> to <literal>e</literal> (see <xref
+ linkend="assertions"/>). This flag is turned on by
+ <option>-O</option>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-fignore-interface-pragmas</option>
- <indexterm><primary><option>-fignore-interface-pragmas</option></primary></indexterm>
+ <indexterm><primary><option>-fignore-interface-pragmas</option></primary></indexterm>
</term>
- <listitem>
- <para>Tells GHC to ignore all inessential information when reading interface files.
- That is, even if <filename>M.hi</filename> contains unfolding or strictness information
- for a function, GHC will ignore that information.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <listitem>
+ <para>Tells GHC to ignore all inessential information when reading interface files.
+ That is, even if <filename>M.hi</filename> contains unfolding or strictness information
+ for a function, GHC will ignore that information.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-fliberate-case</option>
<indexterm><primary><option>-fliberate-case</option></primary></indexterm>
</term>
- <listitem>
- <para>Turn on the liberate-case transformation.</para>
- </listitem>
- </varlistentry>
+ <listitem>
+ <para>Turn on the liberate-case transformation.</para>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fno-cse</option>
<indexterm><primary><option>-fno-cse</option></primary></indexterm>
</term>
- <listitem>
- <para>Turns off the common-sub-expression elimination optimisation.
- Can be useful if you have some <literal>unsafePerformIO</literal>
- expressions that you don't want commoned-up.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <listitem>
+ <para>Turns off the common-sub-expression elimination optimisation.
+ Can be useful if you have some <literal>unsafePerformIO</literal>
+ expressions that you don't want commoned-up.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-fno-strictness</option>
<indexterm><primary><option>-fno-strictness</option></primary></indexterm>
</term>
- <listitem>
- <para>Turns off the strictness analyser; sometimes it eats
- too many cycles.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <listitem>
+ <para>Turns off the strictness analyser; sometimes it eats
+ too many cycles.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-fno-full-laziness</option>
<indexterm><primary><option>-fno-full-laziness</option></primary></indexterm>
</term>
- <listitem>
- <para>Turns off the full laziness optimisation (also known as
- let-floating). Full laziness increases sharing, which can lead
- to increased memory residency.</para>
+ <listitem>
+ <para>Turns off the full laziness optimisation (also known as
+ let-floating). Full laziness increases sharing, which can lead
+ to increased memory residency.</para>
<para>NOTE: GHC doesn't implement complete full-laziness.
When optimisation in on, and
@@ -1847,86 +1847,86 @@ f "2" = 2
implementation would do, the difference is that GHC
doesn't consistently apply full-laziness, so don't rely on
it.</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fno-float-in</option>
<indexterm><primary><option>-fno-float-in</option></primary></indexterm>
</term>
- <listitem>
- <para>Turns off the float-in transformation.</para>
- </listitem>
- </varlistentry>
+ <listitem>
+ <para>Turns off the float-in transformation.</para>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fno-specialise</option>
<indexterm><primary><option>-fno-specialise</option></primary></indexterm>
</term>
- <listitem>
- <para>Turns off the automatic specialisation of overloaded functions.</para>
- </listitem>
- </varlistentry>
+ <listitem>
+ <para>Turns off the automatic specialisation of overloaded functions.</para>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fno-state-hack</option>
<indexterm><primary><option>-fno-state-hack</option></primary></indexterm>
</term>
- <listitem>
- <para>Turn off the "state hack" whereby any lambda with a
- <literal>State#</literal> token as argument is considered to be
- single-entry, hence it is considered OK to inline things inside
- it. This can improve performance of IO and ST monad code, but it
- runs the risk of reducing sharing.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <listitem>
+ <para>Turn off the "state hack" whereby any lambda with a
+ <literal>State#</literal> token as argument is considered to be
+ single-entry, hence it is considered OK to inline things inside
+ it. This can improve performance of IO and ST monad code, but it
+ runs the risk of reducing sharing.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-fpedantic-bottoms</option>
<indexterm><primary><option>-fpedantic-bottoms</option></primary></indexterm>
</term>
- <listitem>
- <para>Make GHC be more precise about its treatment of bottom (but see also
+ <listitem>
+ <para>Make GHC be more precise about its treatment of bottom (but see also
<option>-fno-state-hack</option>). In particular, stop GHC
eta-expanding through a case expression, which is good for
- performance, but bad if you are using <literal>seq</literal> on
+ performance, but bad if you are using <literal>seq</literal> on
partial applications.</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fomit-interface-pragmas</option>
- <indexterm><primary><option>-fomit-interface-pragmas</option></primary></indexterm>
+ <indexterm><primary><option>-fomit-interface-pragmas</option></primary></indexterm>
</term>
- <listitem>
- <para>Tells GHC to omit all inessential information from the interface file
- generated for the module being compiled (say M). This means that a module
- importing M will see only the <emphasis>types</emphasis> of the functions that M exports, but not
- their unfoldings, strictness info, etc. Hence, for example,
- no function exported by M will be inlined
- into an importing module. The benefit is that modules that import M will
- need to be recompiled less often (only when M's exports change their type,
- not when they change their implementation).
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
+ <listitem>
+ <para>Tells GHC to omit all inessential information from the interface file
+ generated for the module being compiled (say M). This means that a module
+ importing M will see only the <emphasis>types</emphasis> of the functions that M exports, but not
+ their unfoldings, strictness info, etc. Hence, for example,
+ no function exported by M will be inlined
+ into an importing module. The benefit is that modules that import M will
+ need to be recompiled less often (only when M's exports change their type,
+ not when they change their implementation).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
<option>-fsimpl-tick-factor=<replaceable>n</replaceable></option>
<indexterm><primary><option>-fsimpl-tick-factor</option></primary></indexterm>
</term>
- <listitem>
- <para>GHC's optimiser can diverge if you write rewrite rules (<xref linkend="rewrite-rules"/>)
+ <listitem>
+ <para>GHC's optimiser can diverge if you write rewrite rules (<xref linkend="rewrite-rules"/>)
that don't terminate, or (less satisfactorily) if you
code up recursion through data types
(<xref linkend="bugs-ghc"/>). To avoid making the compiler fall into an infinite
- loop, the optimiser carries a "tick count" and stops inlining and applying rewrite rules
+ loop, the optimiser carries a "tick count" and stops inlining and applying rewrite rules
when this count is exceeded. The limit is set as a multiple of the program size, so
bigger programs get more ticks. The <option>-fsimpl-tick-factor</option> flag lets
you change the multiplier. The default is 100; numbers larger than 100 give more ticks,
@@ -1934,99 +1934,99 @@ f "2" = 2
<para>If the tick-count expires, GHC summarises what simplifier steps it has done;
you can use <option>-fddump-simpl-stats</option> to generate a much more detailed list.
Usually that identifies the loop quite accurately, because some numbers are very large.
- </para>
- </listitem>
- </varlistentry>
+ </para>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fstatic-argument-transformation</option>
<indexterm><primary><option>-fstatic-argument-transformation</option></primary></indexterm>
</term>
- <listitem>
- <para>Turn on the static argument transformation.</para>
- </listitem>
- </varlistentry>
+ <listitem>
+ <para>Turn on the static argument transformation.</para>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fspec-constr</option>
<indexterm><primary><option>-fspec-constr</option></primary></indexterm>
</term>
- <listitem>
- <para>Turn on call-pattern specialisation.</para>
- </listitem>
- </varlistentry>
+ <listitem>
+ <para>Turn on call-pattern specialisation.</para>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-funbox-strict-fields</option>:
- <indexterm><primary><option>-funbox-strict-fields</option></primary></indexterm>
- <indexterm><primary>strict constructor fields</primary></indexterm>
- <indexterm><primary>constructor fields, strict</primary></indexterm>
+ <indexterm><primary><option>-funbox-strict-fields</option></primary></indexterm>
+ <indexterm><primary>strict constructor fields</primary></indexterm>
+ <indexterm><primary>constructor fields, strict</primary></indexterm>
</term>
- <listitem>
- <para>This option causes all constructor fields which are
+ <listitem>
+ <para>This option causes all constructor fields which are
marked strict (i.e. &ldquo;!&rdquo;) to be unboxed or
unpacked if possible. It is equivalent to adding an
<literal>UNPACK</literal> pragma to every strict
constructor field (see <xref
linkend="unpack-pragma"/>).</para>
- <para>This option is a bit of a sledgehammer: it might
- sometimes make things worse. Selectively unboxing fields
- by using <literal>UNPACK</literal> pragmas might be
- better. An alternative is to use
+ <para>This option is a bit of a sledgehammer: it might
+ sometimes make things worse. Selectively unboxing fields
+ by using <literal>UNPACK</literal> pragmas might be
+ better. An alternative is to use
<option>-funbox-strict-fields</option> to turn on
unboxing by default but disable it for certain constructor
fields using the <literal>NOUNPACK</literal> pragma
(see <xref linkend="nounpack-pragma"/>).
</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-funfolding-creation-threshold=<replaceable>n</replaceable></option>:
- <indexterm><primary><option>-funfolding-creation-threshold</option></primary></indexterm>
- <indexterm><primary>inlining, controlling</primary></indexterm>
- <indexterm><primary>unfolding, controlling</primary></indexterm>
+ <indexterm><primary><option>-funfolding-creation-threshold</option></primary></indexterm>
+ <indexterm><primary>inlining, controlling</primary></indexterm>
+ <indexterm><primary>unfolding, controlling</primary></indexterm>
</term>
- <listitem>
- <para>(Default: 45) Governs the maximum size that GHC will
+ <listitem>
+ <para>(Default: 45) Governs the maximum size that GHC will
allow a function unfolding to be. (An unfolding has a
&ldquo;size&rdquo; that reflects the cost in terms of
&ldquo;code bloat&rdquo; of expanding that unfolding
at a call site. A bigger function would be assigned a
bigger cost.) </para>
- <para> Consequences: (a) nothing larger than this will be
- inlined (unless it has an INLINE pragma); (b) nothing
- larger than this will be spewed into an interface
- file. </para>
+ <para> Consequences: (a) nothing larger than this will be
+ inlined (unless it has an INLINE pragma); (b) nothing
+ larger than this will be spewed into an interface
+ file. </para>
<para> Increasing this figure is more likely to result in longer
compile times than faster code. The next option is more
useful:</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
- <varlistentry>
- <term><option>-funfolding-use-threshold=<replaceable>n</replaceable></option></term>
- <listitem>
- <indexterm><primary><option>-funfolding-use-threshold</option></primary></indexterm>
- <indexterm><primary>inlining, controlling</primary></indexterm>
- <indexterm><primary>unfolding, controlling</primary></indexterm>
+ <varlistentry>
+ <term><option>-funfolding-use-threshold=<replaceable>n</replaceable></option></term>
+ <listitem>
+ <indexterm><primary><option>-funfolding-use-threshold</option></primary></indexterm>
+ <indexterm><primary>inlining, controlling</primary></indexterm>
+ <indexterm><primary>unfolding, controlling</primary></indexterm>
- <para>(Default: 8) This is the magic cut-off figure for
+ <para>(Default: 8) This is the magic cut-off figure for
unfolding: below this size, a function definition will be
unfolded at the call-site, any bigger and it won't. The
size computed for a function depends on two things: the
actual size of the expression minus any discounts that
apply (see <option>-funfolding-con-discount</option>).</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
</variablelist>
</sect2>
@@ -2047,7 +2047,7 @@ f "2" = 2
special option or libraries compiled in a certain way. To get access to
the support libraries for Concurrent Haskell, just import
<ulink
- url="&libraryBaseLocation;/Control-Concurrent.html"><literal>Control.Concurrent</literal></ulink>. More information on Concurrent Haskell is provided in the documentation for that module.</para>
+ url="&libraryBaseLocation;/Control-Concurrent.html"><literal>Control.Concurrent</literal></ulink>. More information on Concurrent Haskell is provided in the documentation for that module.</para>
<para>
Optionally, the program may be linked with
@@ -2083,17 +2083,17 @@ f "2" = 2
<variablelist>
<varlistentry>
- <term><option>-C<replaceable>s</replaceable></option></term>
- <listitem>
- <para><indexterm><primary><option>-C<replaceable>s</replaceable></option></primary><secondary>RTS option</secondary></indexterm>
- Sets the context switch interval to <replaceable>s</replaceable>
- seconds. A context switch will occur at the next heap block
- allocation after the timer expires (a heap block allocation occurs
- every 4k of allocation). With <option>-C0</option> or
- <option>-C</option>, context switches will occur as often as
- possible (at every heap block allocation). By default, context
- switches occur every 20ms.</para>
- </listitem>
+ <term><option>-C<replaceable>s</replaceable></option></term>
+ <listitem>
+ <para><indexterm><primary><option>-C<replaceable>s</replaceable></option></primary><secondary>RTS option</secondary></indexterm>
+ Sets the context switch interval to <replaceable>s</replaceable>
+ seconds. A context switch will occur at the next heap block
+ allocation after the timer expires (a heap block allocation occurs
+ every 4k of allocation). With <option>-C0</option> or
+ <option>-C</option>, context switches will occur as often as
+ possible (at every heap block allocation). By default, context
+ switches occur every 20ms.</para>
+ </listitem>
</varlistentry>
</variablelist>
</sect1>
@@ -2122,16 +2122,16 @@ f "2" = 2
is also possible to obtain performance improvements with parallelism
on programs that do not use concurrency. This section describes how to
use GHC to compile and run parallel programs, in <xref
- linkend="lang-parallel" /> we describe the language features that affect
+ linkend="lang-parallel" /> we describe the language features that affect
parallelism.</para>
<sect2 id="parallel-compile-options">
<title>Compile-time options for SMP parallelism</title>
<para>In order to make use of multiple CPUs, your program must be
- linked with the <option>-threaded</option> option (see <xref
- linkend="options-linker" />). Additionally, the following
- compiler options affect parallelism:</para>
+ linked with the <option>-threaded</option> option (see <xref
+ linkend="options-linker" />). Additionally, the following
+ compiler options affect parallelism:</para>
<variablelist>
<varlistentry>
@@ -2179,18 +2179,18 @@ f "2" = 2
program, or use the RTS <option>-N</option> option.</para>
<variablelist>
- <varlistentry>
- <term><option>-N<optional><replaceable>x</replaceable></optional></option></term>
- <listitem>
- <para><indexterm><primary><option>-N<replaceable>x</replaceable></option></primary><secondary>RTS option</secondary></indexterm>
- Use <replaceable>x</replaceable> simultaneous threads when
- running the program. Normally <replaceable>x</replaceable>
- should be chosen to match the number of CPU cores on the
- machine<footnote><para>Whether hyperthreading cores should be counted or not is an
- open question; please feel free to experiment and let us know what
- results you find.</para></footnote>. For example,
- on a dual-core machine we would probably use
- <literal>+RTS -N2 -RTS</literal>.</para>
+ <varlistentry>
+ <term><option>-N<optional><replaceable>x</replaceable></optional></option></term>
+ <listitem>
+ <para><indexterm><primary><option>-N<replaceable>x</replaceable></option></primary><secondary>RTS option</secondary></indexterm>
+ Use <replaceable>x</replaceable> simultaneous threads when
+ running the program. Normally <replaceable>x</replaceable>
+ should be chosen to match the number of CPU cores on the
+ machine<footnote><para>Whether hyperthreading cores should be counted or not is an
+ open question; please feel free to experiment and let us know what
+ results you find.</para></footnote>. For example,
+ on a dual-core machine we would probably use
+ <literal>+RTS -N2 -RTS</literal>.</para>
<para>Omitting <replaceable>x</replaceable>,
i.e. <literal>+RTS -N -RTS</literal>, lets the runtime
@@ -2211,30 +2211,30 @@ f "2" = 2
via <literal>Control.Concurrent.getNumCapabilities</literal>, and
it may be changed while the program is running by
calling <literal>Control.Concurrent.setNumCapabilities</literal>.</para>
- </listitem>
- </varlistentry>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>The following options affect the way the runtime schedules
threads on CPUs:</para>
<variablelist>
- <varlistentry>
- <term><option>-qa</option></term>
+ <varlistentry>
+ <term><option>-qa</option></term>
<indexterm><primary><option>-qa</option></primary><secondary>RTS
option</secondary></indexterm>
- <listitem>
+ <listitem>
<para>Use the OS's affinity facilities to try to pin OS
threads to CPU cores. This is an experimental feature,
and may or may not be useful. Please let us know
whether it helps for you!</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term><option>-qm</option></term>
+ <varlistentry>
+ <term><option>-qm</option></term>
<indexterm><primary><option>-qm</option></primary><secondary>RTS
option</secondary></indexterm>
- <listitem>
+ <listitem>
<para>Disable automatic migration for load balancing.
Normally the runtime will automatically try to schedule
threads across the available CPUs to make use of idle
@@ -2257,12 +2257,12 @@ f "2" = 2
<title>Hints for using SMP parallelism</title>
<para>Add the <literal>-s</literal> RTS option when
- running the program to see timing stats, which will help to tell you
- whether your program got faster by using more CPUs or not. If the user
- time is greater than
- the elapsed time, then the program used more than one CPU. You should
- also run the program without <literal>-N</literal> for
- comparison.</para>
+ running the program to see timing stats, which will help to tell you
+ whether your program got faster by using more CPUs or not. If the user
+ time is greater than
+ the elapsed time, then the program used more than one CPU. You should
+ also run the program without <literal>-N</literal> for
+ comparison.</para>
<para>The output of <literal>+RTS -s</literal> tells you how
many &ldquo;sparks&rdquo; were created and executed during the
@@ -2291,19 +2291,19 @@ f "2" = 2
<variablelist>
<varlistentry>
- <term><option>-msse2</option>:</term>
- <listitem>
+ <term><option>-msse2</option>:</term>
+ <listitem>
<para>
- (x86 only, added in GHC 7.0.1) Use the SSE2 registers and
- instruction set to implement floating point operations when using
- the <link linkend="native-code-gen">native code generator</link>.
- This gives a substantial performance improvement for floating
- point, but the resulting compiled code
- will only run on processors that support SSE2 (Intel Pentium 4 and
- later, or AMD Athlon 64 and later). The
- <link linkend="llvm-code-gen">LLVM backend</link> will also use SSE2
- if your processor supports it but detects this automatically so no
- flag is required.
+ (x86 only, added in GHC 7.0.1) Use the SSE2 registers and
+ instruction set to implement floating point operations when using
+ the <link linkend="native-code-gen">native code generator</link>.
+ This gives a substantial performance improvement for floating
+ point, but the resulting compiled code
+ will only run on processors that support SSE2 (Intel Pentium 4 and
+ later, or AMD Athlon 64 and later). The
+ <link linkend="llvm-code-gen">LLVM backend</link> will also use SSE2
+ if your processor supports it but detects this automatically so no
+ flag is required.
</para>
<para>
SSE2 is unconditionally used on x86-64 platforms.
@@ -2312,17 +2312,17 @@ f "2" = 2
</varlistentry>
<varlistentry>
- <term><option>-msse4.2</option>:</term>
- <listitem>
+ <term><option>-msse4.2</option>:</term>
+ <listitem>
<para>
- (x86 only, added in GHC 7.4.1) Use the SSE4.2 instruction set to
- implement some floating point and bit operations when using the
- <link linkend="native-code-gen">native code generator</link>. The
- resulting compiled code will only run on processors that
- support SSE4.2 (Intel Core i7 and later). The
- <link linkend="llvm-code-gen">LLVM backend</link> will also use
- SSE4.2 if your processor supports it but detects this automatically
- so no flag is required.
+ (x86 only, added in GHC 7.4.1) Use the SSE4.2 instruction set to
+ implement some floating point and bit operations when using the
+ <link linkend="native-code-gen">native code generator</link>. The
+ resulting compiled code will only run on processors that
+ support SSE4.2 (Intel Core i7 and later). The
+ <link linkend="llvm-code-gen">LLVM backend</link> will also use
+ SSE4.2 if your processor supports it but detects this automatically
+ so no flag is required.
</para>
</listitem>
</varlistentry>
@@ -2354,15 +2354,15 @@ f "2" = 2
<variablelist>
- <varlistentry>
- <term>
+ <varlistentry>
+ <term>
<option>-fext-core</option>
<indexterm><primary><option>-fext-core</option></primary></indexterm>
</term>
- <listitem>
- <para>Generate <literal>.hcr</literal> files.</para>
- </listitem>
- </varlistentry>
+ <listitem>
+ <para>Generate <literal>.hcr</literal> files.</para>
+ </listitem>
+ </varlistentry>
</variablelist>