diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-10-06 15:03:48 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-08 05:12:58 -0400 |
commit | 8a2e840893bf5a1f775385713fbf0756f96c470d (patch) | |
tree | 6475b5e3eefa71099e8df048981f164ba54be120 /docs/users_guide/glasgow_exts.rst | |
parent | 397c6ed5ca5329408db33a64e45102fff23c969a (diff) | |
download | haskell-8a2e840893bf5a1f775385713fbf0756f96c470d.tar.gz |
users-guide: Refer to language extension flags via :extension:
Previously several were referred to via :ghc-flag:`-X...`.
Diffstat (limited to 'docs/users_guide/glasgow_exts.rst')
-rw-r--r-- | docs/users_guide/glasgow_exts.rst | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 60f708284a..372e0bd189 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -2450,7 +2450,7 @@ explicit kind annotation must be used (see :ref:`kinding`). Such data types have only one value, namely bottom. Nevertheless, they can be useful when defining "phantom types". -In conjunction with the :ghc-flag:`-XEmptyDataDeriving` extension, empty data +In conjunction with the :extension:`EmptyDataDeriving` extension, empty data declarations can also derive instances of standard type classes (see :ref:`empty-data-deriving`). @@ -3935,10 +3935,10 @@ Deriving instances for empty data types Allow deriving instances of standard type classes for empty data types. One can write data types with no constructors using the -:ghc-flag:`-XEmptyDataDecls` flag (see :ref:`nullary-types`), which is on by +:extension:`EmptyDataDecls` flag (see :ref:`nullary-types`), which is on by default in Haskell 2010. What is not on by default is the ability to derive type class instances for these types. This ability is enabled through use of -the :ghc-flag:`-XEmptyDataDeriving` flag. For instance, this lets one write: :: +the :extension:`EmptyDataDeriving` flag. For instance, this lets one write: :: data Empty deriving (Eq, Ord, Read, Show) @@ -3956,16 +3956,16 @@ This would generate the following instances: :: instance Show Empty where showsPrec _ x = case x of {} -The :ghc-flag:`-XEmptyDataDeriving` flag is only required to enable deriving +The :extension:`EmptyDataDeriving` flag is only required to enable deriving of these four "standard" type classes (which are mentioned in the Haskell Report). Other extensions to the ``deriving`` mechanism, which are explained -below in greater detail, do not require :ghc-flag:`-XEmptyDataDeriving` to be +below in greater detail, do not require :extension:`EmptyDataDeriving` to be used in conjunction with empty data types. These include: -* :ghc-flag:`-XStandaloneDeriving` (see :ref:`stand-alone-deriving`) +* :extension:`StandaloneDeriving` (see :ref:`stand-alone-deriving`) * Type classes which require their own extensions to be enabled to be derived, - such as :ghc-flag:`-XDeriveFunctor` (see :ref:`deriving-extra`) -* :ghc-flag:`-XDeriveAnyClass` (see :ref:`derive-any-class`) + such as :extension:`DeriveFunctor` (see :ref:`deriving-extra`) +* :extension:`DeriveAnyClass` (see :ref:`derive-any-class`) .. _deriving-inferred: @@ -5300,10 +5300,10 @@ In that case, GHC chooses the strategy as follows: 2. For other any type class: - 1. When ``DeriveAnyClass`` is enabled, use ``anyclass``. + 1. When :extension:`DeriveAnyClass` is enabled, use ``anyclass``. - 2. When ``GeneralizedNewtypeDeriving`` is enabled and we are deriving for a - newtype, then use ``newytype``. + 2. When :extension:`GeneralizedNewtypeDeriving` is enabled and we are + deriving for a newtype, then use ``newtype``. If both rules apply to a deriving clause, then ``anyclass`` is used and the user is warned about the ambiguity. The warning can be avoided by explicitly |