
Hi Simon, I just commented (https://ghc.haskell.org/trac/ghc/ticket/14331#comment:35) about a situation where we call splitFunTys on a type that might be a metavariable. (You don't have to read the comment -- that's just to set the context.) Now that I think of it, we should never call the splitXXX functions on metavariables -- any time we do so is wrong. I suppose it's OK if we, say, call splitTyConApp_maybe on (T alpha beta gamma), because we never look through the metavariables there. But it can't possible be write to call splitTyConApp_maybe on alpha. Do you agree? Should we ASSERT that we don't do this? The tcXXX variants are no different in this regard. Actually, I wonder if we can put the check in just one spot: coreView. Whenever we use coreView, we're about to inspect a type. And we should never be inspecting a metavariable in this way. Richard