cats icon indicating copy to clipboard operation
cats copied to clipboard

MonadError missing a raiseWhen method

Open qwbarch opened this issue 3 years ago • 0 comments

Is there a reason for IO#raiseWhen being omitted from MonadError?
MonadError has ensure, but if [A] is Unit, this is more verbose compared to raiseWhen.

For example using raiseWhen:

IO.raiseWhen(condition)(expression)

Versus using ensure:

MonadThrow[F].unit.ensure(exception)(_ => condition)

If adding this method to MonadError is a welcome change, I'd like to make a PR for it!

qwbarch avatar May 29 '21 00:05 qwbarch