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>
<term>Class method types:</term>
<para><xref LinkEnd="classs-method-types"></para>
<term>Multi-parameter type classes:</term>
......@@ -628,6 +635,27 @@ qualifier list has just one element, a boolean expression.
<sect1 id="class-method-types">
<title>Class method types
Haskell 98 prohibits class method types to mention constraints on the
class type variable, thus:
class Seq s a where
fromList :: [a] -> s a
elem :: Eq a => a -> s a -> Bool
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>).
With the <option>-fglasgow-exts</option> GHC lifts this restriction.
<sect1 id="multi-param-type-classes">
<title>Multi-parameter type classes
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