-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add 'do' syntax for <RACStream> #109
Comments
I don't think a traditional If all you're doing is chaining What really hurts readability as it is now, is splitting and merging streams through |
This is a little bit of a red herring, because: do
x <- M
… maps to something like the following Objective-C: [M bind:^(id x) {
…
}]; That said, I agree with your overall point. I don't think |
I think the value of So, compare: do
x <- f1
y <- f2 x
z <- f3 x y
return x + y + z vs. [[self f1] bind:^(id x) {
return [[self f2:x] bind:^(id y) {
return [[self f3:x and:y] bind:^(id z) {
return [self.class return:[[x plus:y] plus:z]];
}];
}];
}]; Nesting aspolsion. The question in my mind is whether a macro could be better enough to make it worthwhile. |
A do(
x, [self f1],
y, [self f2],
z, [self f3:x and:y],
[self.class return:[[x plus:y] plus:z]]
) I just don't think people will be binding that often/intensely. |
Yeah, I agree. Not much better and probably rare. |
It'd be totally possible to add a
do
syntax for the<RACStream>
monad, though it'd have to work a bit more like Clojure's domonad than Haskell'sdo
statement.But I'm wondering whether this would even be useful. How often would people be repeatedly binding in a way that this would be valuable?
The text was updated successfully, but these errors were encountered: