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
-- Module : Data.Either
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
-- | @since 4.4.0.0
instance Monad (Either e) where
Left l >>= _ = Left l
Right r >>= k = k r
In essence, this means that >>= propagates error and does not evaluate k (type: a -> Either e b) unless the Either is a Right (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(); })
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
EitherIn essence, this means that
>>=propagates error and does not evaluatek(type:a -> Either e b) unless theEitheris 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(); })