iteratee alternatives to MonadCatchIO

Bas van Dijk v.dijk.bas at gmail.com
Thu Feb 10 13:28:46 GMT 2011


BTW, note that it is currently also impossible to define a
MonadTransControl instance for ContT (and probably Iteratee as well)
because the types conflict. For example if I define:

instance MonadTransControl (ContT r) where
    liftControl f = ContT $ \k →
                      let run t = liftM return (runContT t k)
                      in f run >>= k

I get the following type errors:

* Could not deduce (m ~ n)

This is because k ∷ a → m r, for some m, while run requires to work
for all n, not just m:

type Run t = ∀ n o b. (Monad n, Monad o, Monad (t o))
           ⇒ t n b → n (t o b)

* Could not deduce (a ~ b)
* Could not deduce (r ~ b)

Because of the same reason as the former, run requires to work for all
b, not just a or r.

I think it's also impossible to define a MonadTransPeel instance for
ContT and Iteratee because of similar reasons.

Whether these restrictions are a blessing or a curse, is not yet
totally clear to me.

Regards,

Bas



More information about the Iteratee mailing list