Skip to content
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

Handling of type parameters for effects #281

Closed
marzipankaiser opened this issue Aug 31, 2023 · 4 comments · Fixed by #381
Closed

Handling of type parameters for effects #281

marzipankaiser opened this issue Aug 31, 2023 · 4 comments · Fixed by #381
Labels
area:typer bug Something isn't working

Comments

@marzipankaiser
Copy link
Contributor

marzipankaiser commented Aug 31, 2023

If we declare an effect with type parameters, e.g.

effect Eff[A] {
  def use(): A
}

Then the number of type parameters is not checked at the usage site, so all of those compile:

def foo(): Int / Eff = <>
def foo2(): Int / Eff[Int, Unit] = <>

Only if we ever use do use, it will complain that Eff[Int] is not allowed in that context, or that the number of type parameters does not match up for the use call.
EDIT: If we ever try to define a handler with try ... with ..., then we get the appropriate error message there.

@marzipankaiser marzipankaiser added the bug Something isn't working label Aug 31, 2023
@b-studios
Copy link
Collaborator

Really??? I would have assumed that the kind checker would catch this

@marzipankaiser
Copy link
Contributor Author

I would have assumed so, too, but apparently not:
Screenshot 2023-09-01 at 10 33 34

@marzipankaiser
Copy link
Contributor Author

marzipankaiser commented Sep 1, 2023

Ah, interesting: At a try ... with ..., this check is made (we get a Interface ... expects ... parameters, but ... with something like try {...} with Eff { ... } if Eff was declared with type parameters)

@b-studios
Copy link
Collaborator

We could add a pretyper phase (at one point we had it) to establish wellformedness before typing. There is Wellformedness but it only runs after typer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants