summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/flags.xml14
-rw-r--r--docs/users_guide/glasgow_exts.xml26
-rw-r--r--docs/users_guide/using.xml18
3 files changed, 43 insertions, 15 deletions
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index 5e2e52d38d..bc583acabc 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -1061,6 +1061,12 @@
<entry><option>-XNoDeriveDataTypeable</option></entry>
</row>
<row>
+ <entry><option>-XAutoDeriveTypeable</option></entry>
+ <entry>Automatically derive Typeable instances for every datatype and type class declaration.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoAutoDeriveTypeable</option></entry>
+ </row>
+ <row>
<entry><option>-XDeriveGeneric</option></entry>
<entry>Enable <link linkend="deriving-typeable">deriving for the Generic class</link>.</entry>
<entry>dynamic</entry>
@@ -1447,6 +1453,14 @@
<entry><option>-fno-warn-warnings-deprecations</option></entry>
</row>
+ <row>
+ <entry><option>-fwarn-typeable-instances</option></entry>
+ <entry>warn if there are any handwritten <literal>Typeable</literal>
+ instances (see <xref linkend="deriving-typeable"/>)</entry>
+ <entry>dynamic</entry>
+ <entry><option>-fno-warn-typeable-instances</option></entry>
+ </row>
+
</tbody>
</tgroup>
</informaltable>
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index e1d21c3506..2a0917c039 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -3379,19 +3379,19 @@ GHC extends this list with several more classes that may be automatically derive
<literal>Typeable</literal>, and <literal>Data</literal>, defined in the library
modules <literal>Data.Typeable</literal> and <literal>Data.Generics</literal> respectively.
</para>
-<para>An instance of <literal>Typeable</literal> can only be derived if the
-data type has seven or fewer type parameters, all of kind <literal>*</literal>.
-The reason for this is that the <literal>Typeable</literal> class is derived using the scheme
-described in
-<ulink url="http://research.microsoft.com/%7Esimonpj/papers/hmap/gmap2.ps">
-Scrap More Boilerplate: Reflection, Zips, and Generalised Casts
-</ulink>.
-(Section 7.4 of the paper describes the multiple <literal>Typeable</literal> classes that
-are used, and only <literal>Typeable1</literal> up to
-<literal>Typeable7</literal> are provided in the library.)
-In other cases, there is nothing to stop the programmer writing a <literal>TypeableX</literal>
-class, whose kind suits that of the data type constructor, and
-then writing the data type instance by hand.
+<para>Since GHC 7.8.1, <literal>Typeable</literal> is kind-polymorphic (see
+<xref linkend="kind-polymorphism"/>) and can be derived for any datatype and
+type class. Instances for datatypes can be derived by attaching a
+<literal>deriving Typeable</literal> clause to the datatype declaration, or by
+using standalone deriving (see <xref linkend="stand-alone-deriving"/>).
+Instances for type classes can only be derived using standalone deriving.
+Additionally, <option>-XAutoDeriveTypeable</option> will trigger the generation
+of derived <literal>Typeable</literal> instances for every datatype and type
+class declaration in the module it is used.
+</para>
+<para>
+Also since GHC 7.8.1, handwritten (ie. not derived) instances of
+<literal>Typeable</literal> are forbidden, and will be ignored with a warning.
</para>
</listitem>
diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml
index 6574e9ecf3..be7e3da2ce 100644
--- a/docs/users_guide/using.xml
+++ b/docs/users_guide/using.xml
@@ -956,8 +956,9 @@ test.hs:(5,4)-(6,7):
<option>-fwarn-missing-methods</option>,
<option>-fwarn-lazy-unlifted-bindings</option>,
<option>-fwarn-wrong-do-bind</option>,
- <option>-fwarn-unsupported-calling-conventions</option>, and
- <option>-fwarn-dodgy-foreign-imports</option>. The following
+ <option>-fwarn-unsupported-calling-conventions</option>,
+ <option>-fwarn-dodgy-foreign-imports</option>, and
+ <option>-fwarn-typeable-instances</option>. The following
flags are
simple ways to select standard &ldquo;packages&rdquo; of warnings:
</para>
@@ -1682,6 +1683,19 @@ f "2" = 2
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-fwarn-typeable-instances</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-typeable-instances</option></primary></indexterm>
+ <indexterm><primary>typeable instances, warning</primary></indexterm>
+
+ <para>Report handwritten (ie. not derived) instances of the
+ <literal>Typeable</literal> class. These are ignore by the compiler;
+ only derived instances of <literal>Typeable</literal> are allowed.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
<para>If you're feeling really paranoid, the