@@ -9,6 +9,7 @@
99module Control.Monad.Trans.Ether.Reader where
1010
1111import Data.Proxy (Proxy(Proxy))
12+import Data.Functor.Identity (Identity(..))
1213import Data.Coerce (coerce)
1314import Control.Applicative (Alternative)
1415import Control.Monad (MonadPlus)
@@ -30,6 +31,8 @@ newtype EtherReaderT tag r m a = EtherReaderT (R.ReaderT r m a)
3031 deriving ( Functor, Applicative, Alternative, Monad, MonadPlus
3132 , MonadFix, MonadTrans, MonadIO )
3233
34+type EtherReader tag r = EtherReaderT tag r Identity
35+
3336instance Monad m => MonadEther (EtherReaderT tag r m) where
3437 type EtherTags (EtherReaderT tag r m) = tag ': EtherTags m
3538
@@ -39,6 +42,9 @@ etherReaderT _proxy = EtherReaderT . R.ReaderT
3942runEtherReaderT :: proxy tag -> EtherReaderT tag r m a -> r -> m a
4043runEtherReaderT _proxy (EtherReaderT (R.ReaderT s)) = s
4144
45+runEtherReader :: proxy tag -> EtherReader tag r a -> r -> a
46+runEtherReader proxy m r = runIdentity (runEtherReaderT proxy m r)
47+
4248mapEtherReaderT :: proxy tag -> (m a -> n b) -> EtherReaderT tag r m a -> EtherReaderT tag r n b
4349mapEtherReaderT _proxy f m = EtherReaderT $ R.mapReaderT f (coerce m)
4450
@@ -48,6 +54,12 @@ liftCatch _proxy f m h = EtherReaderT $ R.liftCatch f (coerce m) (coerce h)
4854liftCallCC :: proxy tag -> Sig.CallCC m a b -> Sig.CallCC (EtherReaderT tag r m) a b
4955liftCallCC _proxy callCC f = EtherReaderT $ R.liftCallCC callCC (coerce f)
5056
57+runReaderT' :: EtherReaderT r r m a -> r -> m a
58+runReaderT' = runEtherReaderT Proxy
59+
60+runReader' :: EtherReader r r a -> r -> a
61+runReader' m r = runIdentity (runEtherReaderT Proxy m r)
62+
5163-- Instances for mtl classes
5264
5365instance Class.MonadCont m => Class.MonadCont (EtherReaderT tag r m) where