splitting metavariables
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
| 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. Yes, that's right. Maybe that makes a useful distinction between coreView and tcView; the former should never see a meta-variable. I'm not sure we are fully consistent on when we call each, but it'd be a good start. Go for it Simon | -----Original Message----- | From: Richard Eisenberg [mailto:rae@cs.brynmawr.edu] | Sent: 20 October 2017 22:44 | To: Simon Peyton Jones <simonpj@microsoft.com> | Cc: ghc-devs <ghc-devs@haskell.org> | Subject: splitting metavariables | | 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
participants (2)
-
Richard Eisenberg -
Simon Peyton Jones