Conversation
This allows other objects to be used that convert to results, like Try, Failure, etc. from Dry Monads.
|
OK, this PR is ready to go again, I think. I've also added new documentation alongside it: a "Other monads" page with high-level examples of how you can use other monads from Dry Monads and where they are helpful. This is now possible thanks to our |
|
cc'ing @dry-rb/maintainers for review of the docs |
waiting-for-dev
left a comment
There was a problem hiding this comment.
I love it. Thanks a lot for this simple but powerful addition to the gem!!
There's a typo in the index.html.md file that I think would prevent the link to the new docs from being found.
docsite/source/index.html.md
Outdated
| - configuration | ||
| - extensions | ||
| - design-pattern | ||
| - other-moands |
There was a problem hiding this comment.
| - other-moands | |
| - other-monads |
lib/dry/operation/errors.rb
Outdated
| super <<~MSG | ||
| Your step must return `Success(..)` or `Failure(..)`, \ | ||
| from `Dry::Monads::Result`. Instead, it was `#{result.inspect}`. | ||
| Your step must return `Success(..)` or `Failure(..)`, or an object with `.to_result`. Instead, it was `#{result.inspect}`. |
There was a problem hiding this comment.
Actually a #to_result is not enough because of the #value_or requirement. I'd like to get rid of #to_value and have pattern matching implemented as a requirement instead, allowing other to bring their #to_result types, but that's not possible because of this.
There was a problem hiding this comment.
I've covered this in the docs, but as I explained above, I felt it was better to keep this exception message simpler.
|
Thanks for all the feedback everybody! This is looking ready to go. Will merge this in now. I don't plan to release this until at least a week from now, so if you have any further feedback, please feel free to share it :) |
|
Great! Thank you |
This allows other objects to be used that convert to results, like
Try,Maybe, etc. from Dry Monads.I'll be working on making those available to operation classes via an extension in another PR.