typescript-monads
typescript-monads copied to clipboard
Add reducer funcationality to `Result`
Rather frequently, I'm collapsing collections of Result and needing a way to easily collapse values together in Ok, or toggle the Result to Fail if it exists. Using Rust as an example, there's a good abstraction with having the and and or functions built into the result class to allow for this behavior (reference to Boolean Operators in https://doc.rust-lang.org/std/result/).
I'd like to request this type reducer functionality be added to the Result type.
@chughes-pika ok I will check this out. Just read your comment today.
@chughes-pika can you post an example here?
I think my request here isn't fully formed. I'll close this issue though I might reopen it at a latter date when I have a more concrete description of how I'm hoping to solve my problem. At its root I'm wanting a simple way to do the follow
Result<T, E>[] => Result<T[], E[]>, but that feels like something that would be built on top of this library and not built into it. Thank you for your time and sorry for the malformed request.