diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-03-04 11:59:47 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-03-04 12:00:21 +0000 |
commit | f66e0e695b0377c469fbe877d4850fc0ebca2010 (patch) | |
tree | f20d6e81e1d79e3e1d6e6cff923203e460f73d96 /docs/users_guide/glasgow_exts.xml | |
parent | d058bc9ce04e8397c8fd0a32a8654b83f3ef4af1 (diff) | |
download | haskell-f66e0e695b0377c469fbe877d4850fc0ebca2010.tar.gz |
A raft of small changes associated with -XConstrainedClassMethods
See Trac #7854. Specifically:
* Major clean up and simplification of check_op in checkValidClass;
specifically
- use checkValidType on the entire method-selector type to detect
ambiguity
- put a specific test for -XConstrainedClassMethods
* Make -XConstrainedClassMethods be implied by -XMultiParamTypeClasses
(a bit ad-hoc but see #7854), and document in the user manual.
* Do the checkAmbiguity test just once in TcValidity.checkValidType,
rather than repeatedly at every level. See Note [When to call checkAmbiguity]
* Add -XAllowAmbiguousTypes in GHC.IP, since 'ip' really is ambiguous.
(It's a rather magic function.)
* Improve location info for check_op in checkValidClass
* Update quite a few tests, which had genuinely-ambiguous class
method signatures. Some I fixed by making them unambiguous; some
by adding -XAllowAmbiguousTypes
Diffstat (limited to 'docs/users_guide/glasgow_exts.xml')
-rw-r--r-- | docs/users_guide/glasgow_exts.xml | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index edfdc849bf..8a1c9ec468 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -4442,15 +4442,16 @@ class type variable, thus: 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 +contains the constraint <literal>Eq a</literal>, which constrains only the class type variable (in this case <literal>a</literal>). -GHC lifts this restriction (flag <option>-XConstrainedClassMethods</option>). </para> - - +<para> +GHC lifts this restriction with language extension <option>-XConstrainedClassMethods</option>. +The restriction is a pretty stupid one in the first place, +so <option>-XConstrainedClassMethods</option> is implied by <option>-XMultiParamTypeClasses</option>. +</para> </sect3> - <sect3 id="class-default-signatures"> <title>Default method signatures</title> |