
#12549: Panic on ":t datatypeName" ---------------------------------+-------------------------------------- Reporter: johnleo | Owner: johnleo Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by simonpj): Right you are. Here's what to do: * Make `deeply_instantiate` take a substitution that it extends: {{{ deeply_instantiate :: CtOrigin -> TCvSubst -- new! -> TcSigmaType -> TcM (HsWrapper, TcRhoType) }}} Its semantics are: {{{ deeply_instantiate subst ty = deeplyInstantiate (substTy subst ty) }}} * Define `deeplyInstantiate` (externally called) initialise the substitution with a suitable in-scope set, like this: {{{ deeplyInstantiate ty = deeply_instantiate (mkEmptyTcSubst (tyCoVarsOfType ty)) ty }}} * The impl of `deeply_instantiate` is just as `deeplyInstantiate` today, except: * Use `newMetaTyVarsX` to extend the substitution * The unchecked-ness can go away * The recursive call is to `deeply_instantiate`, and does not substitute in `rho`. Make sense? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12549#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler