diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-03-12 10:06:38 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-15 09:59:30 -0400 |
commit | 8162eab27101cddb0c822347300640f07110379a (patch) | |
tree | b0d809350dddfddbd3cc6837e175bf6dcb53fda0 /compiler/ghci | |
parent | 10a971208dcd537742fe4e15b2713eb0f3052a3a (diff) | |
download | haskell-8162eab27101cddb0c822347300640f07110379a.tar.gz |
Remove the GHCi debugger's panicking isUnliftedType check
The GHCi debugger has never been that robust in the face of
higher-rank types, or even types that are _interally_ higher-rank,
such as the types of many class methods (e.g., `fmap`). In GHC 8.2,
however, things became even worse, as the debugger would start to
_panic_ when a user tries passing the name of a higher-rank thing
to `:print`. This all ties back to a strange `isUnliftedType` check
in `Debugger` that was mysteriously added 11 years ago
(in commit 4d71f5ee6dbbfedb4a55767e4375f4c0aadf70bb) with no
explanation whatsoever.
After some experimentation, no one is quite sure what this
`isUnliftedType` check is actually accomplishing. The test suite
still passes if it's removed, and I am unable to observe any
differences in debugger before even with data types that _do_ have
fields of unlifted types (e.g., `data T = MkT Int#`). Given that
this is actively causing problems (see #14828), the prudent thing
to do seems to be just removing this `isUnliftedType` check, and
waiting to see if anyone shouts about it. This patch accomplishes
just that.
Note that this patch fix the underlying issues behind #14828, as the
debugger will still print unhelpful info if you try this:
```
λ> f :: (forall a. a -> a) -> b -> b; f g x = g x
λ> :print f
f = (_t1::t1)
```
But fixing this will require much more work, so let's start with the
simple stuff for now.
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/Debugger.hs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/ghci/Debugger.hs b/compiler/ghci/Debugger.hs index 38d1588c7d..888d00ed06 100644 --- a/compiler/ghci/Debugger.hs +++ b/compiler/ghci/Debugger.hs @@ -77,8 +77,7 @@ pprintClosureCommand bindThings force str = do let id' = id `setIdType` substTy subst (idType id) term_ <- GHC.obtainTermFromId maxBound force id' term <- tidyTermTyVars term_ - term' <- if bindThings && - (not (isUnliftedType (termType term))) + term' <- if bindThings then bindSuspensions term else return term -- Before leaving, we compare the type obtained to see if it's more specific |