Commit 0f965da5 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-12-16 15:17:29 by simonpj]

Document that type variables in instance context must be distinct; merge to stable
parent 4dd415e9
......@@ -1866,16 +1866,21 @@ For example, this is OK:
<listitem>
<para>All of the types in the <emphasis>context</emphasis> of
an instance declaration <emphasis>must</emphasis> be type variables.
an instance declaration <emphasis>must</emphasis> be type variables, and
there must be no repeated type variables in any one constraint.
Thus
<programlisting>
instance C a b => Eq (a,b) where ...
</programlisting>
is OK, but
<programlisting>
instance C Int b => Foo b where ...
instance C Int b => Foo [b] where ...
</programlisting>
is not OK.
is not OK (because of the non-type-variable <literal>Int</literal> in the context), and nor is
<programlisting>
instance C b b => Foo [b] where ...
</programlisting>
(because of the repeated type variable).
</para>
</listitem>
</orderedlist>
......
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