diff options
author | Xavier Denis <xldenis@gmail.com> | 2020-06-15 11:37:16 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-23 22:48:56 -0400 |
commit | a2a9006b068ba9af9d41711307a8d597d2bb03d7 (patch) | |
tree | 1db6f5afc2eac3ceac844c6a9613be3990911a26 /docs | |
parent | cad62ef11972490b180fad3cd4a5c7754fa218e4 (diff) | |
download | haskell-a2a9006b068ba9af9d41711307a8d597d2bb03d7.tar.gz |
Fix issue #18262 by zonking constraints after solving
Zonk residual constraints in checkForExistence to reveal user type
errors.
Previously when `:instances` was used with instances that have TypeError
constraints the result would look something like:
instance [safe] s0 => Err 'A -- Defined at ../Bug2.hs:8:10
whereas after zonking, `:instances` now sees the `TypeError` and
properly eliminates the constraint from the results.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/ghci.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index ce0734cfc2..390719ff80 100644 --- a/docs/users_guide/ghci.rst +++ b/docs/users_guide/ghci.rst @@ -2518,6 +2518,25 @@ commonly used commands. instance Show _ => Show (Maybe _) -- Defined in ‘GHC.Show’ instance Read _ => Read (Maybe _) -- Defined in ‘GHC.Read’ + Only instances which could potentially be used will be displayed in the results. + Instances which require unsatisfiable constraints such as ``TypeError`` will not be + included. In the following example, the instance for ``A`` is not shown because it cannot + be used. + + .. code-block:: none + ghci>:set -XDataKinds -XUndecidableInstances + ghci>import GHC.TypeLits + ghci>class A a + ghci>instance (TypeError (Text "Not possible")) => A Bool + ghci>:instances Bool + instance Eq Bool -- Defined in ‘GHC.Classes’ + instance Ord Bool -- Defined in ‘GHC.Classes’ + instance Enum Bool -- Defined in ‘GHC.Enum’ + instance Show Bool -- Defined in ‘GHC.Show’ + instance Read Bool -- Defined in ‘GHC.Read’ + instance Bounded Bool -- Defined in ‘GHC.Enum’ + + .. ghci-cmd:: :issafe; [⟨module⟩] Displays Safe Haskell information about the given module (or the |