-
Notifications
You must be signed in to change notification settings - Fork 33
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
Do with filter (if) #51
Comments
This would probably work for monads that are https://gcanti.github.io/fp-ts/modules/Filterable.ts.html |
It seems a |
I made an experimental implementation of For notation. However, I can not figure out how to reuse code from the DoClass so I had to use copy/paste to make it work. Other than that it seems to work. See https://github.com/cyberixae/fp-ts-contrib/commits/implement_for_notation |
Oh wow! Nice job! For(option)
.bind('n', some(12))
.filter(2 > 3)
.filterL(({ n }) => n < 10)
.return(({ n }) => n) But I don't see cases where filter isn't lazy. |
The |
I always thought that in I have no problem with not adding |
Perhaps it was used for lazy in |
🚀 Feature request
In Scala, you can do a for-comprehension with a
if
:Would it be possible to do this with a
Do
?Maybe with this syntax:
In Scala, the for-comprehension checks that the given Monad has a
withFilter
method.Either
Future
, the failed value is:Task
or aTaskEither
. Maybe with aTaskOption
?The text was updated successfully, but these errors were encountered: