maintains internally, so you'll be desperately disappointed if
you try to glob etc. inside <literal>OPTIONS_GHC</literal>.</para>
- <para>NOTE: the contents of OPTIONS_GHC are prepended to the
- command-line options, so you <emphasis>do</emphasis> have the
- ability to override OPTIONS_GHC settings via the command
- line.</para>
+ <para>NOTE: the contents of OPTIONS_GHC are appended to the
+ command-line options, so options given in the source file
+ override those given on the command-line.</para>
<para>It is not recommended to move all the contents of your
Makefiles into your source files, but in some circumstances, the
<varlistentry>
<term>
<cmdsynopsis>
+ <command>ghc --show-iface <replaceable>file</replaceable></command>
+ </cmdsynopsis>
+ <indexterm><primary><option>––--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>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>ghc --supported-languages</command>
+ </cmdsynopsis>
+ <indexterm><primary><option>––supported-languages</option></primary></indexterm>
+ </term>
+ <listitem>
+ <para>Print the supported language extensions.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>ghc --info</command>
+ </cmdsynopsis>
+ <indexterm><primary><option>––info</option></primary></indexterm>
+ </term>
+ <listitem>
+ <para>Print information about the compiler.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
<command>ghc --version</command>
<command>ghc -V</command>
</cmdsynopsis>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>ghc --print-docdir</command>
+ </cmdsynopsis>
+ <indexterm><primary><option>––print-docdir</option></primary></indexterm>
+ </term>
+ <listitem>
+ <para>Print the path to GHC's documentation directory. Note that
+ some distributions do no include the documentation, in which case
+ this directory may be empty or may not exist.</para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
<sect2 id="make-mode">
<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 overriden using the
+ depends on its suffix. This behaviour can be overridden using the
<option>-x</option> option:</para>
<variablelist>
<indexterm><primary>-W option</primary></indexterm>
<para>Provides the standard warnings plus
<option>-fwarn-incomplete-patterns</option>,
+ <option>-fwarn-dodgy-imports</option>,
<option>-fwarn-unused-matches</option>,
<option>-fwarn-unused-imports</option>, and
<option>-fwarn-unused-binds</option>.</para>
</varlistentry>
<varlistentry>
- <term><option>-w</option>:</term>
- <listitem>
- <indexterm><primary><option>-w</option></primary></indexterm>
- <para>Turns off all warnings, including the standard ones.</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:</para>
- <itemizedlist>
- <listitem><option>-fwarn-simple-patterns</option></listitem>
- <listitem><option>-fwarn-tabs</option></listitem>
- <listitem><option>-fwarn-incomplete-record-updates</option></listitem>
- <listitem><option>-fwarn-monomorphism-restriction</option></listitem>
- <listitem><option>-fwarn-implicit-prelude</option></listitem>
- </itemizedlist>
+ are
+ <option>-fwarn-simple-patterns</option>,
+ <option>-fwarn-tabs</option>,
+ <option>-fwarn-incomplete-record-updates</option>,
+ <option>-fwarn-monomorphism-restriction</option>, and
+ <option>-fwarn-implicit-prelude</option>.</para>
+ </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
+ those that <literal>-Wall</literal> doesn't enable.</para>
</listitem>
</varlistentry>
</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
+ <option>-Werror</option> flag.</para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
<para>The full set of warning options is described below. To turn
function or type is used. Entities can be marked as
deprecated using a pragma, see <xref
linkend="deprecated-pragma"/>.</para>
+
+ <para>This option is on by default.</para>
+ </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 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>
</varlistentry>
g [] = 2
</programlisting>
- <para>This option isn't enabled be default because it can be
+ <para>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.</para>
f foo = foo { x = 6 }
</programlisting>
- <para>This option isn't enabled be 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>
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.,
- in the inadvertent cyclic definition <literal>let x = ... x
- ... in</literal>.</para>
-
- <para>Consequently, this option
- <emphasis>will</emphasis> complain about cyclic recursive
- definitions.</para>
+ in the inadvertent capture of what would be a recursive call in
+ <literal>f = ... let f = id in ... f ...</literal>.</para>
</listitem>
</varlistentry>
<para>This option causes a warning to be emitted whenever the
module contains an "orphan" instance declaration or rewrite rule.
- An instance declartion is an orphan if it appears in a module in
+ 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
</term>
<listitem>
<para>By default, the compiler will warn you if a set of
- patterns are overlapping, i.e.,</para>
+ patterns are overlapping, e.g.,</para>
<programlisting>
f :: String -> Int
patterns that can fail, eg. <literal>\(x:xs)->...</literal>.
Normally, these aren't treated as incomplete patterns by
<option>-fwarn-incomplete-patterns</option>.</para>
- <para>``Lambda-bound patterns'' includes all places where there is a single pattern,
+ <para>“Lambda-bound patterns” includes all places where there is a single pattern,
including list comprehensions and do-notation. In these cases, a pattern-match
failure is quite legitimate, and triggers filtering (list comprehensions) or
the monad <literal>fail</literal> operation (monads). For example:
</programlisting>
Switching on <option>-fwarn-simple-patterns</option> will elicit warnings about
these probably-innocent cases, which is why the flag is off by default. </para>
- <para> The <literal>deriving( Read )</literal> mechanism produces monadic code with
- pattern matches, so you will also get misleading warnings about the compiler-generated
- code. (This is arguably a Bad Thing, but it's awkward to fix.)</para>
-
</listitem>
</varlistentry>
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,
- e.g., the `default default' for Haskell 1.4 caused the
+ e.g., the ‘default default’ for Haskell 1.4 caused the
otherwise unconstrained value <constant>1</constant> to be
given the type <literal>Int</literal>, whereas Haskell 98
defaults it to <literal>Integer</literal>. This may lead to
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 desribe the language features that affect
+ linkend="lang-parallel" /> we describe the language features that affect
parallelism.</para>
<sect2 id="parallel-options">