summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2016-09-30 15:52:02 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2016-09-30 15:52:02 -0400
commitb3d55e20d20344bfc09f4ca4a554a819c4ecbfa8 (patch)
tree82835fbae36500ddd2f930d251314c3a409d41cb
parent28a00eafd7abc474e6e5c3d92d3c0ec561906c0b (diff)
downloadhaskell-b3d55e20d20344bfc09f4ca4a554a819c4ecbfa8.tar.gz
Document Safe Haskell restrictions on Generic instances
Commit 578fbeca31dd3d755e24e910c3a7327f92bc4ee3 disallowed hand-written `Generic` instances in Safe Haskell, but this wasn't documented anywhere.
-rw-r--r--docs/users_guide/safe_haskell.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/users_guide/safe_haskell.rst b/docs/users_guide/safe_haskell.rst
index 3914820ebe..6ce8b8fc26 100644
--- a/docs/users_guide/safe_haskell.rst
+++ b/docs/users_guide/safe_haskell.rst
@@ -278,6 +278,15 @@ Furthermore, we restrict the following features:
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
+ the structure of the data type for which the instance is defined, and
+ allowing manually implemented ``Generic`` instances would break that
+ invariant. Derived instances (through the :ghc-flag:`-XDeriveGeneric`
+ extension) are still allowed. Refer to the
+ :ref:`generic programming <generic-programming>` section for more details.
+
.. _safe-overlapping-instances:
Safe Overlapping Instances