@@ -7,6 +7,7 @@
7module Control.Monad.Trans.Ether.Reader where
7module Control.Monad.Trans.Ether.Reader where
9import Data.Proxy (Proxy(Proxy))
9import Data.Proxy (Proxy(Proxy))
10+import Data.Coerce (coerce)
10import Control.Applicative (Alternative)
11import Control.Applicative (Alternative)
11import Control.Monad (MonadPlus)
12import Control.Monad (MonadPlus)
12import Control.Monad.Fix (MonadFix)
13import Control.Monad.Fix (MonadFix)
@@ -34,17 +35,13 @@ runEtherReaderT :: proxy tag -> EtherReaderT tag m a -> EtherData tag -> m a
34runEtherReaderT _proxy (EtherReaderT (R.ReaderT s)) = s
35runEtherReaderT _proxy (EtherReaderT (R.ReaderT s)) = s
36mapEtherReaderT :: proxy tag -> (m a -> n b) -> EtherReaderT tag m a -> EtherReaderT tag n b
37mapEtherReaderT :: 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)
39liftCatch :: proxy tag -> Sig.Catch e m a -> Sig.Catch e (EtherReaderT tag m) a
40liftCatch :: proxy tag -> Sig.Catch e m a -> Sig.Catch e (EtherReaderT tag m) a
40−liftCatch proxy f m h = etherReaderT proxy
41+liftCatch _proxy f m h = coerce $ R.liftCatch f (coerce m) (coerce h)
41− $ \r -> f (runEtherReaderT proxy m r)
42− $ \e -> runEtherReaderT proxy (h e) r
44liftCallCC :: proxy tag -> Sig.CallCC m a b -> Sig.CallCC (EtherReaderT tag m) a b
43liftCallCC :: proxy tag -> Sig.CallCC m a b -> Sig.CallCC (EtherReaderT tag m) a b
45−liftCallCC proxy callCC f = etherReaderT proxy
44+liftCallCC _proxy callCC f = coerce $ R.liftCallCC callCC (coerce f)
47− $ \c -> runEtherReaderT proxy (f (etherReaderT proxy . const . c)) r
49-- Instances for mtl classes
46-- Instances for mtl classes