summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2009-08-24 11:37:22 +0000
committersimonpj@microsoft.com <unknown>2009-08-24 11:37:22 +0000
commitd11718fa4d13519e48ef72d0b932972ce806730b (patch)
tree04deadf8b8bb3362088dcfb3728a190f35365bf0 /docs
parent2900ac71b7f36fbf2f4a89b4dd85583f694bc31c (diff)
downloadhaskell-d11718fa4d13519e48ef72d0b932972ce806730b.tar.gz
Improve docs on -XFlexibleContexts
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/glasgow_exts.xml19
1 files changed, 14 insertions, 5 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 4e541a6966..bf2e9ace80 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -3157,7 +3157,8 @@ All the extensions are enabled by the <option>-fglasgow-exts</option> flag.
<sect3>
<title>Multi-parameter type classes</title>
<para>
-Multi-parameter type classes are permitted. For example:
+Multi-parameter type classes are permitted, with flag <option>-XMultiParamTypeClasses</option>.
+For example:
<programlisting>
@@ -3169,13 +3170,17 @@ Multi-parameter type classes are permitted. For example:
</para>
</sect3>
-<sect3>
+<sect3 id="superclass-rules">
<title>The superclasses of a class declaration</title>
<para>
-There are no restrictions on the context in a class declaration
-(which introduces superclasses), except that the class hierarchy must
-be acyclic. So these class declarations are OK:
+In Haskell 98 the context of a class declaration (which introduces superclasses)
+must be simple; that is, each predicate must consist of a class applied to
+type variables. The flag <option>-XFlexibleContexts</option>
+(<xref linkend="flexible-contexts"/>)
+lifts this restriction,
+so that the only restriction on the context in a class declaration is
+that the class hierarchy must be acyclic. So these class declarations are OK:
<programlisting>
@@ -4723,7 +4728,11 @@ these type signatures are perfectly OK
g :: Eq [a] => ...
g :: Ord (T a ()) => ...
</programlisting>
+The flag <option>-XFlexibleContexts</option> also lifts the corresponding
+restriction on class declarations (<xref linkend="superclass-rules"/>) and instance declarations
+(<xref linkend="instance-rules"/>).
</para>
+
<para>
GHC imposes the following restrictions on the constraints in a type signature.
Consider the type: