We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I find myself writing this all the time:
maybe.flatMap(x => Maybe.fromFalsy(x.value)).
It would be very useful to have an
maybe.flatMapFromFalsy(x => x.value)
or
maybe.flatMap(x => x.value, Maybe.fromFalsy) // Which can also be used with other constructors: maybe.flatMap(x => x.value, Maybe.fromNull)
Does this make sense, or am I perhaps using the library a bit wrong?
The text was updated successfully, but these errors were encountered:
@tvedtorama - your request is for sure a thing. I also find myself composing flat map with fromNull
fromNull
Without need to access nested properties solution would be using the constructor as a passed lambda:
maybe.flatMap(Maybe.fromFalsy)
but for mentioned above case there are no tools in monet. You can always use compose from any other functional library:
maybe.flatMap(compose(Maybe.fromFalsy, x => x.value))
But as this seems to be quite a common use case, I'd think about how it can be enhanced in a nicest way :)
Sorry, something went wrong.
@tvedtorama please see #258
No branches or pull requests
I find myself writing this all the time:
It would be very useful to have an
or
Does this make sense, or am I perhaps using the library a bit wrong?
The text was updated successfully, but these errors were encountered: