@@ -7,6 +7,7 @@
77module Control.Monad.Trans.Ether.Reader where
88
99import Data.Proxy (Proxy(Proxy))
10+import Data.Coerce (coerce)
1011import Control.Applicative (Alternative)
1112import Control.Monad (MonadPlus)
1213import Control.Monad.Fix (MonadFix)
@@ -34,17 +35,13 @@ runEtherReaderT :: proxy tag -> EtherReaderT tag m a -> EtherData tag -> m a
3435runEtherReaderT _proxy (EtherReaderT (R.ReaderT s)) = s
3536
3637mapEtherReaderT :: proxy tag -> (m a -> n b) -> EtherReaderT tag m a -> EtherReaderT tag n b
37−mapEtherReaderT proxy f m = etherReaderT proxy $ f . runEtherReaderT proxy m
38+mapEtherReaderT _proxy f m = coerce $ R.mapReaderT f (coerce m)
3839
3940liftCatch :: proxy tag -> Sig.Catch e m a -> Sig.Catch e (EtherReaderT tag m) a
40−liftCatch proxy f m h = etherReaderT proxy
41− $ \r -> f (runEtherReaderT proxy m r)
42− $ \e -> runEtherReaderT proxy (h e) r
41+liftCatch _proxy f m h = coerce $ R.liftCatch f (coerce m) (coerce h)
4342
4443liftCallCC :: proxy tag -> Sig.CallCC m a b -> Sig.CallCC (EtherReaderT tag m) a b
45−liftCallCC proxy callCC f = etherReaderT proxy
46− $ \r -> callCC
47− $ \c -> runEtherReaderT proxy (f (etherReaderT proxy . const . c)) r
44+liftCallCC _proxy callCC f = coerce $ R.liftCallCC callCC (coerce f)
4845
4946-- Instances for mtl classes
5047