Commit 232f1a27 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Add notes about type-family overlap in GHCi (see Trac #7102)

parent 33d0f499
......@@ -614,7 +614,7 @@ Prelude>
<sect2 id="ghci-decls">
<title>Type, class and other declarations</title>
<para>[<emphasis role="bold">New in version 7.4.1</emphasis>] At the GHCi
<para>At the GHCi
prompt you can also enter any top-level Haskell declaration,
including <literal>data</literal>, <literal>type</literal>, <literal>newtype</literal>, <literal>class</literal>, <literal>instance</literal>, <literal>deriving</literal>,
and <literal>foreign</literal> declarations. For
......@@ -662,6 +662,10 @@ Prelude>
an attempt to distinguish it from the new <literal>T</literal>,
which is displayed as simply <literal>T</literal>.</para>
<para>Class and type-family instance declarations are simply added to the list of available isntances, with one
exception. Since type-family instances are not permitted to overlap, but you might want to re-define one,
a type-family instance <emphasis>replaces</emphasis> any earlier type instance with an identical left hand side.
(See <xref linkend="type-families"/>.)</para>
</sect2>
<sect2 id="ghci-scope">
......
......@@ -4891,6 +4891,7 @@ type instance G (a, Int) = [a]
type instance G (Char, a) = [a] -- ILLEGAL overlap, as [Char] /= [Int]
</programlisting>
</para>
<para> However see <xref linkend="ghci-decls"/> for the overlap rules in GHCi.</para>
</sect3>
<sect3 id="type-family-decidability">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment