[commit: ghc] ghc-7.4: Documentation for -XDataKinds (3bbb7e5)
Ian Lynagh
igloo at earth.li
Wed Jan 25 15:28:58 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/3bbb7e5842b18c93238a9fc402cb86b4f9596bbe
>---------------------------------------------------------------
commit 3bbb7e5842b18c93238a9fc402cb86b4f9596bbe
Author: Jose Pedro Magalhaes <jpm at cs.uu.nl>
Date: Mon Jan 16 15:02:31 2012 +0100
Documentation for -XDataKinds
>---------------------------------------------------------------
docs/users_guide/glasgow_exts.xml | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 96685bc..2c4cd0c 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -5152,10 +5152,12 @@ is not what we intend when defining length-indexed vectors.
</para>
<para>
-With the <option>-XPolyKinds</option> flag, users can specify better kinds for
-their programs. This flag enables two orthogonal but related features: kind
-polymorphism and user defined kinds through datatype promotion. With
-<option>-XPolyKinds</option>, the example above can then be rewritten to:
+With the flags <option>-XPolyKinds</option> and <option>-XDataKinds</option>,
+users get access to a richer kind language.
+<option>-XPolyKinds</option> enables kind polymorphism, while
+<option>-XDataKinds</option> enables user defined kinds through datatype
+promotion. With <option>-XDataKinds</option>, the example above can then be
+rewritten to:
<programlisting>
data Nat = Ze | Su Nat
@@ -5193,7 +5195,8 @@ class Typeable2 (t :: * -> * -> *) where
</para>
<para>
-Kind polymorphism allows us to merge all these classes into one:
+Kind polymorphism (with <option>-XPolyKinds</option>)
+allows us to merge all these classes into one:
<programlisting>
data Proxy t = Proxy
@@ -5212,8 +5215,8 @@ Note that the datatype <literal>Proxy</literal> has kind
<para>
There are some restrictions in the current implementation:
<itemizedlist>
- <listitem><para>You cannot explicitly abstract over kinds, or mention kind
- variables. So the following are all rejected:
+ <listitem><para>You cannot (yet) explicitly abstract over kinds, or mention
+ kind variables. So the following are all rejected:
<programlisting>
data D1 (t :: k)
@@ -5237,8 +5240,7 @@ type instance F Int = Maybe
<sect2 id="promotion">
<title>Datatype promotion</title>
<para>
-Along with kind polymorphism comes the ability to define custom named kinds.
-With <option>-XPolyKinds</option>, GHC automatically promotes every suitable
+With <option>-XDataKinds</option>, GHC automatically promotes every suitable
datatype to be a kind, and its (value) constructors to be type constructors.
The following types
<programlisting>
More information about the Cvs-ghc
mailing list