Skip to content

Commit

Permalink
Fix manual regarding current state of implicit quantification
Browse files Browse the repository at this point in the history
See also #4426
  • Loading branch information
monoidal committed Sep 27, 2013
1 parent f712751 commit c4ffdba
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions docs/users_guide/glasgow_exts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6941,27 +6941,29 @@ 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>
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>
Expand Down

0 comments on commit c4ffdba

Please sign in to comment.