Commit 914962ca authored by Chris Martin's avatar Chris Martin Committed by Ben Gamari
Browse files

Update docs to reflect changes to DeriveDataTypeable

parent b8f87363
......@@ -425,7 +425,7 @@ will print out the name of any top-level non-recursive binding with the
import Control.Monad (unless)
import Data.Data
data SomeAnn = SomeAnn deriving (Data, Typeable)
data SomeAnn = SomeAnn deriving Data
plugin :: Plugin
plugin = defaultPlugin {
......
......@@ -3590,8 +3590,7 @@ automatically derived:
``Functor``, defined in ``GHC.Base``. See :ref:`deriving-functor`.
 
- With :ghc-flag:`-XDeriveDataTypeable`, you can derive instances of the class
``Data``, defined in ``Data.Data``. See :ref:`deriving-typeable` for
deriving ``Typeable``.
``Data``, defined in ``Data.Data``. See :ref:`deriving-data`.
 
- With :ghc-flag:`-XDeriveFoldable`, you can derive instances of the class
``Foldable``, defined in ``Data.Foldable``. See
......@@ -4001,14 +4000,19 @@ For a full specification of the algorithms used in :ghc-flag:`-XDeriveFunctor`,
:ghc-flag:`-XDeriveFoldable`, and :ghc-flag:`-XDeriveTraversable`, see
:ghc-wiki:`this wiki page <Commentary/Compiler/DeriveFunctor>`.
 
.. _deriving-typeable:
.. _deriving-data:
 
Deriving ``Typeable`` instances
Deriving ``Data`` instances
-------------------------------
 
.. ghc-flag:: -XDeriveDataTypeable
 
Enable automatic deriving of instances for the ``Typeable`` typeclass
Enable automatic deriving of instances for the ``Data`` typeclass
.. _deriving-typeable:
Deriving ``Typeable`` instances
-------------------------------
 
The class ``Typeable`` is very special:
 
......@@ -4019,8 +4023,9 @@ The class ``Typeable`` is very special:
ensures that the programmer cannot subvert the type system by writing
bogus instances.
 
- Derived instances of ``Typeable`` are ignored, and may be reported as
an error in a later version of the compiler.
- Derived instances of ``Typeable`` may be declared if the
:ghc-flag:`-XDeriveDataTypeable` extension is enabled, but they are ignored,
and they may be reported as an error in a later version of the compiler.
 
- The rules for solving \`Typeable\` constraints are as follows:
 
......@@ -12450,7 +12455,6 @@ That being said, with the appropriate use of wrapper datatypes, the
above limitations induce no loss of generality: ::
 
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE StandaloneDeriving #-}
......@@ -12461,7 +12465,6 @@ above limitations induce no loss of generality: ::
import GHC.StaticPtr
 
data Dict c = c => Dict
deriving Typeable
 
g1 :: Typeable a => StaticPtr (Dict (Show a) -> a -> String)
g1 = static (\Dict -> show)
......
......@@ -273,11 +273,6 @@ Furthermore, we restrict the following features:
this reason, the ``Data.Coerce`` module is also considered unsafe. We are
hoping to find a better solution here in the future.
- ``Data.Typeable`` Hand crafted instances of the Typeable type class are not allowed
in Safe Haskell as this can easily be abused to unsafely coerce
between types. Derived instances (through the :ghc-flag:`-XDeriveDataTypeable`
extension) are still allowed.
- ``GHC.Generics`` Hand crafted instances of the ``Generic`` type class are
not allowed in Safe Haskell. Such instances aren't strictly unsafe, but
there is an important invariant that a ``Generic`` instance should adhere to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment