summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2019-01-20 20:48:13 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-08-07 10:18:07 -0400
commit2073745c70d830373c67b908e5c42d3cd18c057a (patch)
tree5f89a76cc92a05c75183223c3878d7446945758c /docs/users_guide
parent6f116005a144b3f09381e0a5967a364eb57a5aa5 (diff)
downloadhaskell-2073745c70d830373c67b908e5c42d3cd18c057a.tar.gz
Add a -fprint-axiom-incomps option (#15546)
Supply branch incomps when building an IfaceClosedSynFamilyTyCon `pprTyThing` now has access to incomps. This also causes them to be written out to .hi files, but that doesn't pose an issue other than a more faithful bijection between `tyThingToIfaceDecl` and `tcIfaceDecl`. The machinery for displaying axiom incomps was already present but not in use. Since this is now a thing that pops up in ghci's :info the format was modified to look like a haskell comment. Documentation and a test for the new feature included. Test Plan: T15546 Reviewers: simonpj, bgamari, goldfire Reviewed By: simonpj Subscribers: rwbarton, carter GHC Trac Issues: #15546 Differential Revision: https://phabricator.haskell.org/D5097
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/glasgow_exts.rst3
-rw-r--r--docs/users_guide/using.rst31
2 files changed, 34 insertions, 0 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index c46812baeb..513a787de2 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -8047,6 +8047,9 @@ other hand, the two equations are compatible. Thus, GHC can ignore the
first equation when looking at the second. So, ``G a`` will simplify to
``a``.
+Incompatibilities between closed type family equations can be displayed
+in :ghci-cmd:`:info` when :ghc-flag:`-fprint-axiom-incomps` is enabled.
+
However see :ref:`ghci-decls` for the overlap rules in GHCi.
.. _type-family-decidability:
diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst
index 23e0e1d1b8..d2983c4b1a 100644
--- a/docs/users_guide/using.rst
+++ b/docs/users_guide/using.rst
@@ -821,6 +821,37 @@ messages and in GHCi:
kinds, GHC uses type-level coercions. Users will rarely need to
see these, as they are meant to be internal.
+.. ghc-flag:: -fprint-axiom-incomps
+ :shortdesc: Display equation incompatibilities in closed type families
+ :type: dynamic
+ :reverse: -fno-print-axiom-incomps
+ :category: verbosity
+
+ Using :ghc-flag:`-fprint-axiom-incomps` tells GHC to display
+ incompatibilities between closed type families' equations, whenever they
+ are printed by :ghci-cmd:`:info` or :ghc-flag:`--show-iface ⟨file⟩`.
+
+ .. code-block:: none
+
+ ghci> :i Data.Type.Equality.==
+ type family (==) (a :: k) (b :: k) :: Bool
+ where
+ (==) (f a) (g b) = (f == g) && (a == b)
+ (==) a a = 'True
+ (==) _1 _2 = 'False
+ ghci> :set -fprint-axiom-incomps
+ ghci> :i Data.Type.Equality.==
+ type family (==) (a :: k) (b :: k) :: Bool
+ where
+ (==) (f a) (g b) = (f == g) && (a == b)
+ (==) a a = 'True
+ -- incompatible indices: 0
+ (==) _1 _2 = 'False
+ -- incompatible indices: 1, 0
+
+ The comment after each equation refers to the indices (0-indexed) of
+ preceding equations it is incompatible with.
+
.. ghc-flag:: -fprint-equality-relations
:shortdesc: Distinguish between equality relations when printing
:type: dynamic