-
Notifications
You must be signed in to change notification settings - Fork 55
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
Question: is runCatching the equivalent to F#'s result "computational expression"? #11
Comments
I'm not familiar with F# so I don't really understand what's going on in the code linked
|
I'm back to my previous question on using unwrap. :) I'm not an F# user either, but if I think I understand the explanation SW gives in his book, which is:
The closest match I can think of with kotlin-result is unwrap() on each line, all surrounded by runCatching. I know in a previous issue, you suggested not using unwrap() in this way, but I can't think of another way (other than continuing to expand zip). |
Maybe this comment helps? |
@mbucc just read this and your previous issue. I believe the exact thing you are looking for is called a monad comprehension. |
Example computational expression from Scott Wlaschin's book:
https://github.com/swlaschin/DomainModelingMadeFunctional/blob/master/src/OrderTakingEvolved/PlaceOrder.Dto.fs#L71-L81
The alternative (adding more versions of zip with more and more arguments) smells wrong. I noticed in your example service code you use runCatching in a very similar way to the code linked above.
The text was updated successfully, but these errors were encountered: