[project @ 2005-03-08 08:48:35 by simonpj]
[ghc-hetmet.git] / ghc / docs / users_guide / glasgow_exts.xml
index b986247..efd7a13 100644 (file)
@@ -1731,7 +1731,7 @@ means
 <sect2 id="instance-decls">
 <title>Instance declarations</title>
 
-<sect3>
+<sect3 id="instance-overlap">
 <title>Overlapping instances</title>
 <para>
 In general, <emphasis>GHC requires that that it be unambiguous which instance
@@ -1787,6 +1787,11 @@ So GHC rejects the program.  If you add the flag <option>-fallow-incoherent-inst
 GHC will instead pick (C), without complaining about 
 the problem of subsequent instantiations.
 </para>
+<para>
+Because overlaps are checked and reported lazily, as described above, you need
+the <option>-fallow-overlapping-instances</option> in the module that <emphasis>calls</emphasis> 
+the overloaded function, rather than in the module that <emphasis>defines</emphasis> it.</para>
+
 </sect3>
 
 <sect3>
@@ -3221,7 +3226,7 @@ class to the new type:
 <para>
 
 As a result of this extension, all derived instances in newtype
-declarations are treated uniformly (and implemented just by reusing
+ declarations are treated uniformly (and implemented just by reusing
 the dictionary for the representation type), <emphasis>except</emphasis>
 <literal>Show</literal> and <literal>Read</literal>, which really behave differently for
 the newtype and its representation.
@@ -3302,6 +3307,14 @@ then we would not have been able to derive an instance for the
 classes usually have one "main" parameter for which deriving new
 instances is most interesting.
 </para>
+<para>Lastly, all of this applies only for classes other than
+<literal>Read</literal>, <literal>Show</literal>, <literal>Typeable</literal>, 
+and <literal>Data</literal>, for which the built-in derivation applies (section
+4.3.3. of the Haskell Report).
+(For the standard classes <literal>Eq</literal>, <literal>Ord</literal>,
+<literal>Ix</literal>, and <literal>Bounded</literal> it is immaterial whether
+the standard method is used or the one described here.)
+</para>
 </sect3>
 
 </sect2>