You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common pattern shows up in our code that doesn't seem to have an elegant solution: we'd like to log before raising an error (usually from an Option).
Currently, there are a couple ways to accomplish this for Option values (in rough order of increasing subjective elegance):
I propose adding variants of ApplicativeError#from* to MonadError and their equivalent variants of the liftTo helpers in OptionSyntaxEitherSyntax and ValidatedSyntax, which would allow writing the above as:
A common pattern shows up in our code that doesn't seem to have an elegant solution: we'd like to log before raising an error (usually from an
Option
).Currently, there are a couple ways to accomplish this for
Option
values (in rough order of increasing subjective elegance):The situation for
Either
(orValidated
) is much better, but still not great:I propose adding variants of
ApplicativeError#from*
toMonadError
and their equivalent variants of theliftTo
helpers inOptionSyntax
EitherSyntax
andValidatedSyntax
, which would allow writing the above as:The text was updated successfully, but these errors were encountered: