diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-02-25 12:11:01 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-25 21:10:22 -0500 |
commit | 4ad8ce0b5c741862e2f94fd362077068b9b669d3 (patch) | |
tree | 9cae0fdf40b957e9b39b07ebedf48e7cb4b27ed6 /docs/users_guide | |
parent | 8387dfbe6e468083c472ea019be8af79d489cbc8 (diff) | |
download | haskell-4ad8ce0b5c741862e2f94fd362077068b9b669d3.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
Diffstat (limited to 'docs/users_guide')
-rw-r--r-- | docs/users_guide/ghci.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index cb98b15f6a..c26dedb5c3 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 +d; ⟨expression⟩ Infers and prints the type of ⟨expression⟩, instantiating *all* the forall |