Commit 7fc19edc authored by simonpj's avatar simonpj
Browse files

[project @ 2002-03-08 16:03:13 by simonpj]

Documentation for more liberal class-method types
parent e9acdb5b
......@@ -38,6 +38,13 @@ Executive summary of our extensions:
type system. Specifically:</para>
<variablelist>
<varlistentry>
<term>Class method types:</term>
<listitem>
<para><xref LinkEnd="classs-method-types"></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Multi-parameter type classes:</term>
<listitem>
......@@ -628,6 +635,27 @@ qualifier list has just one element, a boolean expression.
</sect1>
<sect1 id="class-method-types">
<title>Class method types
</title>
<para>
Haskell 98 prohibits class method types to mention constraints on the
class type variable, thus:
<programlisting>
class Seq s a where
fromList :: [a] -> s a
elem :: Eq a => a -> s a -> Bool
</programlisting>
The type of <literal>elem</literal> is illegal in Haskell 98, because it
contains the constraint <literal>Eq a</literal>, constrains only the
class type variable (in this case <literal>a</literal>).
</para>
<para>
With the <option>-fglasgow-exts</option> GHC lifts this restriction.
</para>
</sect1>
<sect1 id="multi-param-type-classes">
<title>Multi-parameter type classes
</title>
......
Supports Markdown
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