-
Notifications
You must be signed in to change notification settings - Fork 269
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
ability check failure with list of functions/thunks #5128
Comments
I suspect this is just because data types are invariant in Unison. List happens to be covariant, so we could special case it in the typechecker, and I could also imagine inferring variance of type params for user defined data types. It could hook in at a similar place as kind inference. Then the typechecker would need maintain and use this variance info in various places. Summary: this isn’t an easy “bugfix”, it’s more like a new type system feature, but I think it could be worth doing at some point. |
@pchiusano it doesn't seem to me like you should need lists to be treated as covariant for this code to compile. But I'm not a type system expert, and I'd like to better understand how I'm wrong.
In my case If I change my
But this still fails:
To me this seems off. The code works fine with |
I think Paul is right. The sort of thing that's going to happen is that Your second example doesn't help because it's just going to solve for The one where you apply |
Describe and demonstrate the bug
In the following example when I try to use a
'{} ()
as type'{Exception} ()
, I get a type checker error. But I believe thata -> {} b
is supposed to conform to typea -> {g} b
for allg
.Input:
Output:
Screenshots
It isn't visible in the transcript output, but if you do the same in a scratch file, the error message is confusing. It highlights
thunks
in green and the associated green type is[Unit ->{𝕖51, Exception} Unit]
. But that is surprising to me sincethunks
is explicitly[Unit -> {} Unit]
.Environment (please complete the following information):
ucm --version
7172bb8The text was updated successfully, but these errors were encountered: