ekmett / exceptions

mtl friendly exceptions
Other
49 stars 32 forks source link

Add instances for MonadCatch and MonadMask for Either #56

Closed snoyberg closed 8 years ago

snoyberg commented 8 years ago

Came up in a discussion with @bitonic. There's no downside I can see to the MonadCatch instance. However, the MonadMask instance is a little bit more controversial, in that it's not actually doing any masking. However, it's impossible to know that it's not masking the async exceptions since there are no side-effects from the Either monad.

Of course, by using unsafePerformIO, we could observe the difference, but I think that's a valid trade-off.

One final argument against MonadMask for Either: it's probably not terribly useful.

RyanGlScott commented 8 years ago

Looks generally good. These instances are basically identical to the ones for CatchT, yes? If so, perhaps it's worth repeating the disclaimer that's currently attached to the MonadMask instance for CatchT?

RyanGlScott commented 8 years ago

LGTM

snoyberg commented 8 years ago

The reason that there's no cautionary note on Either like CatchT is that Either is not a monad transformer, and therefore is always using Identity (implicitly) under the surface.

RyanGlScott commented 8 years ago

Uploaded exceptions-0.8.3 to Hackage.

snoyberg commented 8 years ago

Awesome, thank you!

On Wed, Jul 20, 2016, 9:55 AM Ryan Scott notifications@github.com wrote:

Uploaded exceptions-0.8.3 http://hackage.haskell.org/package/exceptions-0.8.3 to Hackage.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ekmett/exceptions/pull/56#issuecomment-234011165, or mute the thread https://github.com/notifications/unsubscribe-auth/AADBBzFzeBdxPZcNewYICl-_bapVdjsDks5qXlMMgaJpZM4I4I2y .