Gabriel439/Haskell-Pipes-Safe-Library — pull request #3 by DanBurton (2013-06-12 01:00:08+00:00)
Title: MonadSafeIO typeclass refactoring

The `MonadSafeIO` typeclass turns the rank 2 argument `forall x. SafeIO x -> m x` into the constraint `MonadSafeIO m`. My original intent was to eliminate `Rank2Types`, but alas, these are still needed for `recover`.

Still, I think that this refactoring cleans up the type signatures and call sites of `bracket` and friends. The word `morph` pollutes the original code; passing it around implicitly through the typeclass really cleans up the code and the documentation (laws) even becomes less distracting to read, too.

Admittedly, the typeclass solution is a bit *pushier*, by making it easier to implicitly go along with `trySafeIO`. But you can always use your own morphism via newtypes, as `UninterruptedIO` demonstrates.