monad-validate icon indicating copy to clipboard operation
monad-validate copied to clipboard

Get access to errors AND result value

Open johannesgerer opened this issue 1 year ago • 0 comments

It would be great to have access to 'tolerated' errors AND the result value in cases where there is no catastrophic failure:

runValidateTtolerate :: Functor f => ValidateT a f b -> f (Maybe a, Maybe b)
runValidateTtolerate m = unValidateT MNothing m <&> \case
  Left e              -> (Just e, Nothing)
  Right (MJust e, v)  -> (Just e, Just v)
  Right (MNothing, v) -> (Nothing, Just v)

Does it makes sense to add a function like this?

johannesgerer avatar Mar 13 '24 12:03 johannesgerer