Open ArsenArsen opened 2 years ago
This functionality is useful, of course, but it'd rather have it in a separate function (other than map()
) such that the function that is passed in can always be assumed to return a frg::expected
.
Agreed, that's what I meant by "While this behavior is probably fine, it would be desirable to be able to chain expecteds for monadic operations". A sensible name might be then
or chain
While this behavior is probably fine, it would be desirable to be able to chain expecteds for monadic operations.
For an example of such see Haskell's
Either
In essence, this means that
>>=
propagates error and does not evaluatek
(type:a -> Either e b
) unless theEither
is aRight
(success case)EDIT: similarly, there's no way to implicitly convert to a different expected result of same error (one would have to do
if (!e) { {co_}return e.error(); }
)