diff options
author | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2013-09-27 08:55:44 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2013-09-27 08:55:44 +0200 |
commit | c4ffdbad3d40887b9b1e8287c90966649ea8571f (patch) | |
tree | d5e8785271a4230819d08f664f3e34d396ac414a /docs | |
parent | f71275155da69339a58eb470d59f5cc5d1a5071c (diff) | |
download | haskell-c4ffdbad3d40887b9b1e8287c90966649ea8571f.tar.gz |
Fix manual regarding current state of implicit quantification
See also #4426
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/glasgow_exts.xml | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 43fa155e72..d8189040ce 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -6941,7 +6941,11 @@ explicit context. For example in the first argument of the constructor <function>MkSwizzle</function>, an implicit "<literal>forall a.</literal>" is prefixed to the argument type. The implicit <literal>forall</literal> quantifies all type variables that are not already in scope, and are -mentioned in the type quantified over. +mentioned in the type quantified over. (Arguably, it would be better +to <emphasis>require</emphasis> explicit quantification on constructor arguments +where that is what is wanted. +See <ulink url="http://ghc.haskell.org/trac/ghc/ticket/4426">Trac #4426</ulink>.) + </para> <para> @@ -6949,19 +6953,17 @@ As for type signatures, implicit quantification happens for non-overloaded types too. So if you write this: <programlisting> - data T a = MkT (Either a b) (b -> b) + f :: (a -> a) -> a </programlisting> it's just as if you had written this: <programlisting> - data T a = MkT (forall b. Either a b) (forall b. b -> b) + f :: forall a. (a -> a) -> a </programlisting> -That is, since the type variable <literal>b</literal> isn't in scope, it's -implicitly universally quantified. (Arguably, it would be better -to <emphasis>require</emphasis> explicit quantification on constructor arguments -where that is what is wanted. Feedback welcomed.) +That is, since the type variable <literal>a</literal> isn't in scope, it's +implicitly universally quantified. </para> <para> |