[project @ 2004-10-18 18:24:59 by igloo]
[ghc-hetmet.git] / ghc / docs / users_guide / using.xml
index f9a9fce..cc4f366 100644 (file)
@@ -660,6 +660,39 @@ ghc -c Foo.hs</screen>
        </listitem>
       </varlistentry>
 
+      <varlistentry>
+       <term><option>-ferror-spans</option>
+          <indexterm><primary><option>-ferror-spans</option></primary>
+         </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>
+
+         <para>For example:</para>
+
+<screen>test.hs:3:6: parse error on input `where'</screen>
+
+         <para>becomes:</para>
+
+<screen>test296.hs:3:6-10: parse error on input `where'</screen>
+
+         <para>And multi-line spans are possible too:</para>
+
+<screen>test.hs:(5,4)-(6,7):
+    Conflicting definitions for `a'
+    Bound at: test.hs:5:4
+              test.hs:6:7
+    In the binding group for: a, b, a</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>
+      </varlistentry>
     </variablelist>
   </sect1>
 
@@ -802,6 +835,33 @@ g [] = 2
       </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>
+
+         <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
+          enabled.</para>
+
+<programlisting>
+data Foo = Foo { x :: Int }
+         | Bar
+
+f :: Foo -> Foo
+f foo = foo { x = 6 }
+</programlisting>
+
+         <para>This option isn't enabled be default because it can be
+          very noisy, and it often doesn't indicate a bug in the
+          program.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
        <term>
           <option>-fwarn-misc</option>:
           <indexterm><primary><option>-fwarn-misc</option></primary></indexterm>