module Control.Monad.Trans.MSF.Reader
( module Control.Monad.Trans.Reader
, readerS
, runReaderS
, runReaderS_
)
where
import Control.Arrow (arr, (>>>))
import Control.Monad.Trans.Reader hiding (liftCallCC, liftCatch)
import Data.MonadicStreamFunction (MSF, morphGS)
readerS :: Monad m => MSF m (r, a) b -> MSF (ReaderT r m) a b
readerS :: forall (m :: * -> *) r a b.
Monad m =>
MSF m (r, a) b -> MSF (ReaderT r m) a b
readerS = forall (m2 :: * -> *) a1 (m1 :: * -> *) b1 a2 b2.
Monad m2 =>
(forall c. (a1 -> m1 (b1, c)) -> a2 -> m2 (b2, c))
-> MSF m1 a1 b1 -> MSF m2 a2 b2
morphGS forall a b. (a -> b) -> a -> b
$ \(r, a) -> m (b, c)
f a
a -> forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT forall a b. (a -> b) -> a -> b
$ \r
r -> (r, a) -> m (b, c)
f (r
r, a
a)
runReaderS :: Monad m => MSF (ReaderT r m) a b -> MSF m (r, a) b
runReaderS :: forall (m :: * -> *) r a b.
Monad m =>
MSF (ReaderT r m) a b -> MSF m (r, a) b
runReaderS = forall (m2 :: * -> *) a1 (m1 :: * -> *) b1 a2 b2.
Monad m2 =>
(forall c. (a1 -> m1 (b1, c)) -> a2 -> m2 (b2, c))
-> MSF m1 a1 b1 -> MSF m2 a2 b2
morphGS forall a b. (a -> b) -> a -> b
$ \a -> ReaderT r m (b, c)
f (r
r, a
a) -> forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (a -> ReaderT r m (b, c)
f a
a) r
r
runReaderS_ :: Monad m => MSF (ReaderT s m) a b -> s -> MSF m a b
runReaderS_ :: forall (m :: * -> *) s a b.
Monad m =>
MSF (ReaderT s m) a b -> s -> MSF m a b
runReaderS_ MSF (ReaderT s m) a b
msf s
s = forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (\a
a -> (s
s, a
a)) forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> forall (m :: * -> *) r a b.
Monad m =>
MSF (ReaderT r m) a b -> MSF m (r, a) b
runReaderS MSF (ReaderT s m) a b
msf