[commit: ghc] master: Document implicit quantification better (da4bc0c)
git at git.haskell.org
git at git.haskell.org
Fri Mar 25 10:30:10 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/da4bc0cff142225ed7fda7101cb6e559f025ebc1/ghc
>---------------------------------------------------------------
commit da4bc0cff142225ed7fda7101cb6e559f025ebc1
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Mar 25 10:32:13 2016 +0000
Document implicit quantification better
Addresses Trac #11726
>---------------------------------------------------------------
da4bc0cff142225ed7fda7101cb6e559f025ebc1
docs/users_guide/glasgow_exts.rst | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index 0128f33..7ecc929 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -9166,7 +9166,9 @@ the following pairs are equivalent: ::
h x y = y
in ...
-Notice that GHC does *not* find the inner-most possible quantification
+Notice that GHC always adds implicit quantfiers *at the outermost level*
+of a user-written type; it
+does *not* find the inner-most possible quantification
point. For example: ::
f :: (a -> a) -> Int
@@ -9177,13 +9179,12 @@ point. For example: ::
g :: (Ord a => a -> a) -> Int
- -- MEANS the illegal type
+ -- MEANS
g :: forall a. (Ord a => a -> a) -> Int
-- NOT
g :: (forall a. Ord a => a -> a) -> Int
-The latter produces an illegal type, which you might think is silly, but
-at least the rule is simple. If you want the latter type, you can write
+If you want the latter type, you can write
your ``forall``\s explicitly. Indeed, doing so is strongly advised for
rank-2 types.
More information about the ghc-commits
mailing list