-
Notifications
You must be signed in to change notification settings - Fork 273
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
Fixes #5293: Generate IsAbility constraint for ability sets #5300
Conversation
This is the fix for the linked issue, although I see it breaks a test that depends on the previous failure to generate a constraint:
The So, I'll leave it to you all to decide what to do about this test, but this PR simply constrains ability sets to be of kind ability, which was just an oversight when generating constraints. |
Gotcha — thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. I haven't tested it yet but probably won't get time for a while.
I loaded up the optics library and can confirm that this fix makes a lot of the library now compile! |
I think in the cloud library we rely on having a type like
Is there a way to constrain it to |
@aryairani this actually works fine: type Location g = Location Nat
ability Remote where forkAt : Location g -> '{g, Remote} a -> a
ex0 : Location {IO, Exception} -> ()
ex0 loc = ()
ex1 : Location {IO, Exception} ->{Remote} ()
ex1 loc = forkAt loc do printLine "hello world"
-- does not typecheck as expected
{- Kind mismatch arising from
12 | ex2 : Location Nat -> ()
Location expects an argument of kind: Ability; however, it is applied to Nat which has kind:
Type.
ex2 : Location Nat -> ()
ex2 loc = ()
-} So I think we're good. It looks like the PR only defaults a parameter to type Location g = Location Nat
ex0 : Location {IO, Exception} -> ()
ex0 loc = () But as soon as you add type Location g = Location Nat
ability Remote where forkAt : Location g -> '{g, Remote} a -> a
-- works
ex0 : Location {IO, Exception} -> ()
ex0 loc = () Adding a surface syntax for kind annotations seems like an independently good idea, but I'd say is out of scope for this PR. Also, even with kind annotations, that would change the hash of the type which we'd like to avoid when possible. |
Okay yes, thanks. Then I'll update the failing test with your example and go from there. |
No description provided.