-
Notifications
You must be signed in to change notification settings - Fork 18
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
Basic streaming, request for comments #527
base: master
Are you sure you want to change the base?
Conversation
libraries/common/stream.effekt
Outdated
def emit(value) = resume(action(value)) | ||
} | ||
|
||
// TODO what if the number is negative? undefined behavior? |
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.
I'd want the program to either panic or act as if it is 0. (This is not something where I'd expect forever, and this is a place where I could see myself accidentally passing a negative number when e.g. implementing pad*
).
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.
Yes, please check and panic
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.
If we panic, we have to call it unsafeRepeat
. I'm doing nothing for now. I wish we had Nat
.
|
||
record Indexed[A](index: Int, value: A) | ||
|
||
// In Effekt lower bounds are inclusive and upper bounds are exclusive |
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.
Same for this, this should be in effekt.effekt
somewhere in the toplevel documentation.
It would be really nice to have a couple of examples showcasing the various features so that I can get an idea of how to use it :) |
By the way, here's Unison's Each.toList do
use Nat <
a = Each.range 0 5
b = each [1, 2, 3]
guard (a < b)
(a, b) |
Can we maybe translate some Unison examples to Effekt to compare? That would be nice. @phischu could you please look into the Unison implementation as well? |
If you comment out the broken functions you can actually write an example which might look like this:
Please note the explicit type arguments which are necessary because I need to say WHICH stream I want to handle. This prints:
As you might guess, I really do not like having to annotate the types... I also don't like binding and ignoring unit in this example. It is very easy to get this example to something like:
using a bit of phantom magic. |
How about
Or we try to fix this at the language level. |
This is planned in Phase 3 |
I am looking at the |
on the language level probably means fixing type inference which is planned but will take a while |
No description provided.