ekmett/free — pull request #35 by fizruk (2013-11-30 23:48:28+00:00)
Title: MonadError instances for FreeT, IterT, FT

Here are some more instances...

The `FT` instance here uses `FreeT` implementation. I can't see any different solution because of this:

```haskell
throwError e `catchError` f
-- by definitions of throwError and lift
= FT (\a _ -> throwError e >>= a) `catchError` f
```

For ``throwError e `catchError` f` == f e``, the above should become `f e`. Thus when defining `catchError` we cannot do something like ``FT m `catchError` f = FT $ \kp kf -> m kp ...`` because once we supply `kp` to `m` we can no longer catch error in `throwError e` (or we will catch error "in the future"). So we should supply pure wrappers that can't add more effects. But the second argument to `m` would be of type `f (m r) -> m r` and only `kf` knows how to deal with `f`. So the only solution (I think) is to do `catchError` through `FreeT` (just like `Eq` and `Ord` instances).