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

Effects need to be fully known #663

Closed
omentic opened this issue Nov 3, 2024 · 3 comments
Closed

Effects need to be fully known #663

omentic opened this issue Nov 3, 2024 · 3 comments

Comments

@omentic
Copy link

omentic commented Nov 3, 2024

I have hit the second half of the issue in #661 again (and figured I'd open a second issue since it was very unrelated to the original issue). This commented-out code fails to compile: https://gist.github.com/omentic/58b553920b4c8402b04c2873901291df#file-iter-scala-L464

It produces a very long "failed to typecheck overload" error, but it seems like the core issue is

Possible overload: iter::take of type [T](Int){() => Unit / { Yield[T] }} => Unit / { Yield[T] }
  Effects need to be fully known: Yield[T]

I suppose this is probably another case needing a heuristic?

@b-studios
Copy link
Collaborator

Yes that's right. At take it is not possible to know which effect to handle.

While you probably mean Int, in general it could be anything.

You can always annotate the type argument to work around it: take[Int] { ... }.

@omentic
Copy link
Author

omentic commented Nov 4, 2024

Ah - thanks a bunch! 😃

[effekt]$ java -jar bin/effekt examples/iter.effekt 
hello!
Cons(3, Cons(2, Cons(1, Cons(1, Cons(0, Nil())))))
Cons(144, Cons(34, Cons(8, Cons(2, Cons(0, Nil())))))

@b-studios
Copy link
Collaborator

Since you work on streams you might be interested in #527. Maybe you have some insights that you would like to share?

phischu pushed a commit that referenced this issue Nov 7, 2024
Addresses #663 (even though it doesn't remove the root cause).

We improve the message by 

1. mentioning the…… unknown types and 
2. providing a hint what to do.

<img width="1479" alt="image"
src="https://github.com/user-attachments/assets/78dec94d-888b-429b-af3a-a0d6c9c86364">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants