[commit: ghc] master: Minor improvement to user guide (d7ced09)

git at git.haskell.org git at git.haskell.org
Mon Aug 3 12:26:29 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d7ced09a0a8d9e0f3c6631e2814078145036c90a/ghc

>---------------------------------------------------------------

commit d7ced09a0a8d9e0f3c6631e2814078145036c90a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Aug 3 11:07:08 2015 +0100

    Minor improvement to user guide
    
    Specify that the type variables for a class/instance decl scope
    over the body even without a 'forall'.
    
    Provoked by Trac #10722.


>---------------------------------------------------------------

d7ced09a0a8d9e0f3c6631e2814078145036c90a
 docs/users_guide/glasgow_exts.xml | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index e3368f2..b6c01d6 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -8820,9 +8820,8 @@ consider how one would parse this:
 <para>
 
 The type variables in the head of a <literal>class</literal> or <literal>instance</literal> declaration
-scope over the methods defined in the <literal>where</literal> part.  For example:
-
-
+scope over the methods defined in the <literal>where</literal> part.  You do not even need
+an explicit <literal>forall</literal>.  For example:
 <programlisting>
   class C a where
     op :: [a] -> a
@@ -8831,6 +8830,9 @@ scope over the methods defined in the <literal>where</literal> part.  For exampl
                 ys = reverse xs
             in
             head ys
+
+  instance C b => C [b] where
+    op xs = reverse (head (xs :: [[b]]))
 </programlisting>
 </para>
 </sect3>



More information about the ghc-commits mailing list