
#9046: Panic in GHCi when using :print -------------------------------------+------------------------------------ Reporter: quchen | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.4 Component: GHCi | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by bravit): All right, removing of enclosing foralls during `:print` was intentional according to this commit:
In a8ac471d435214dbdc1fa70f938c63128993a1db/ghc: Fix the deugger (fixing Trac #8557)
The runtime debugger (which has not received any love from anyone for many years) looks wrong to me; it was failing to instantiate the outer foralls of a variable when called from :force, which calls cvObtainTermFromId, which calls cvObtainTerm
I simplified the code too. But I'm flaky on how this debugger stuff is really supposed to work, so I'm partly guessing. Tests pass though.
SPJ particularly wrote in `compiler/ghci/RtClosureInspect.hs`: {{{ +-- Generalize the type: find all free and forall'd tyvars +-- and return them, together with the type inside, which +-- should not be a forall type. }}} So now it looks like typechecking issue with free bounded polymorphic tyvars: free type variable is built by `TyVar` constructor of `Var` and it stays the same during typechecking. In the presence of constraints (if tyvar is bounded) we try to solve them and then get this GHC panic: we need `TcTyVar` constructor there. I suppose solution could be to replace free tyvar with `TcTyVar` before solving constraints though I need some guidance to implement it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9046#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler