<option>-fwarn-deprecated-flags</option>,
<option>-fwarn-duplicate-exports</option>,
<option>-fwarn-missing-fields</option>,
- <option>-fwarn-missing-methods</option>, and
+ <option>-fwarn-missing-methods</option>,
+ <option>-fwarn-lazy-unlifted-bindings</option>,
+ <option>-fwarn-wrong-do-bind</option>, and
<option>-fwarn-dodgy-foreign-imports</option>. The following
flags are
simple ways to select standard “packages” of warnings:
<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-simple-patterns</option>,
<option>-fwarn-tabs</option>,
<option>-fwarn-incomplete-record-updates</option>,
- <option>-fwarn-monomorphism-restriction</option>, and
+ <option>-fwarn-monomorphism-restriction</option>,
+ <option>-fwarn-unused-do-bind</option>, and
<option>-fwarn-implicit-prelude</option>.</para>
</listitem>
</varlistentry>
</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
+ <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
+ re-exported, but that module exports nothing.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-fwarn-dodgy-imports</option>:</term>
<listitem>
<indexterm><primary><option>-fwarn-dodgy-imports</option></primary>
</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
+ 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 6.14.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-fwarn-duplicate-exports</option>:</term>
<listitem>
<indexterm><primary><option>-fwarn-duplicate-exports</option></primary></indexterm>
</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>
+
+ <para>Report expressions occuring 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 { _ <- 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>
+ </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>
+
+ <para>Report expressions occuring 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 "unpacked" by binding the result.
+ The warning is suppressed by explicitly mentioning in the source code that your program is throwing something away:
+ <programlisting>
+ do { _ <- 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>
+ </varlistentry>
+
</variablelist>
<para>If you're feeling really paranoid, the
</sect1>
&phases;
-
+
+ &shared_libs;
+
<sect1 id="using-concurrent">
<title>Using Concurrent Haskell</title>
<indexterm><primary>Concurrent Haskell</primary><secondary>using</secondary></indexterm>