-
-
Notifications
You must be signed in to change notification settings - Fork 389
Wingman doesn't introduce new skolems for existentially bound variables #1689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
data Z ab = forall a b. ab ~ '(a, b) => Z (a -> b) also triggers it, so I'm guessing the theta evidence needs to be updated. |
This also fails when there are no unknown variables in sight. Another example: data A = A
data B = B
data X = X
data Y = Y
data Pairrow ax by where
Pairrow :: (a -> b) -> (x -> y) -> Pairrow '(a, x) '(b, y)
test2 :: (A -> B) -> (X -> Y) -> Pairrow '(A, X) '(B, Y)
test2 = _ The problem here appears to be in
the generated holes here have types |
I think the answer is to unify whatever newly introduced type variables we can, and then introduce the remainder as skolems in |
Looks like instantiation happens via https://hackage.haskell.org/package/ghc-8.8.1/docs/DataCon.html#v:dataConInstSig, which doesn't exist for |
So to put it all together, the play is to write But it's not clear to me how this interacts with the original example. In that case we'll get an evidence of |
Note to myself: when CONSTRUCTING a GADT that contains existential values, they are universal! You can choose anything you'd like to replace them! So there is no "skolemize any leftover newly bound variables" step. And then this answers the when to skolemize question. Yes, if you have an equality of types with a skolem, those new tyvars should be skolems assuming the unification isn't trivial. Eg, if we have ab ~ new then this is trivial and we should just rewrite But in the case that ab ~ new_f new_a new_b then yes, absolutely, now we have introduced new variables and they should be skolems. |
There's a related bug here, with the evidence that comes from dictionaries. Those should be emitted as holes, so that Wingman must solve the dictionaries in order to synthesize the term. Wingman doesn't solve dictionaries right now though. |
Using |
@masaeedu points out:
produces
But it doesn't typecheck.
What's going wrong here? When we introduce the
Z
constructor, we should generate two new skolemsa
andb
such that'(a, b) ~ ab
. But instead we generate two new unification variables, which are thus free to unify with one another, and thus produce the bogusid
.The text was updated successfully, but these errors were encountered: