scalaz/scalaz — pull request #843 by djspiewak (2014-11-07 23:43:27+00:00)
Title: Added "inverse attempt" function to Task

I got tired of reimplementing this function (inefficiently) over and over again. If there's a pre-existing way of doing this, please let me know.

Basically, this PR adds a `rethrow` function to `Task`, which serves as the direct inverse of `attempt`. This is enormously useful whenever you want to have a "try/finally-style" pattern inside bind chain. For example:

```scala
for {
either <- somethingDangerous.attempt
_ <- cleanup(resources)
back <- either.rethrow
} yield back
```