summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-02-25 12:11:01 +0100
committerZubin Duggal <zubin.duggal@gmail.com>2022-05-09 13:14:37 +0530
commit509ed1a9b8c5a507e3d0886a6d3a933e492b9e4c (patch)
tree806c924b14313bc19486594e74ecfd7a46186dad /docs
parent19d2143a6d41951f2cec8a5d7033584d99161359 (diff)
downloadhaskell-509ed1a9b8c5a507e3d0886a6d3a933e492b9e4c.tar.gz
GHCi: don't normalise partially instantiated types
This patch skips performing type normalisation when we haven't fully instantiated the type. That is, in tcRnExpr (used only for :type in GHCi), skip normalisation if the result type responds True to isSigmaTy. Fixes #20974 (cherry picked from commit 4ad8ce0b5c741862e2f94fd362077068b9b669d3)
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/ghci.rst8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index ebafc7fda5..6585d297a3 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -2981,13 +2981,19 @@ commonly used commands.
Infers and prints the type of ⟨expression⟩. For polymorphic types
it instantiates the 'inferred' forall quantifiers (but not the
- 'specified' ones; see :ref:`inferred-vs-specified`), solves constraints, and re-generalises.
+ 'specified' ones; see :ref:`inferred-vs-specified`), solves constraints,
+ re-generalises, and then reduces type families as much as possible.
.. code-block:: none
*X> :type length
length :: Foldable t => t a -> Int
+ Type family reduction is skipped if the function is not fully instantiated,
+ as this has been observed to give more intuitive results.
+ You may want to use :ghci-cmd:`:info` if you are not applying any arguments,
+ as that will return the original type of the function without instantiating.
+
.. ghci-cmd:: :type +v; ⟨expression⟩
Infers and prints the type of ⟨expression⟩, binding inferred type variables