Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
7fc19edc
Commit
7fc19edc
authored
Mar 08, 2002
by
simonpj
Browse files
[project @ 2002-03-08 16:03:13 by simonpj]
Documentation for more liberal class-method types
parent
e9acdb5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/docs/users_guide/glasgow_exts.sgml
View file @
7fc19edc
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment