module Control.Monad.Trans.MSF.RWS
( module Control.Monad.Trans.MSF.RWS
, module Control.Monad.Trans.RWS.Strict
) where
import Control.Monad.Trans.RWS.Strict
hiding (liftCallCC, liftCatch)
import Data.Monoid
import Data.Functor ((<$>))
import Data.MonadicStreamFunction
rwsS :: (Functor m, Monad m, Monoid w)
=> MSF m (r, s, a) (w, s, b)
-> MSF (RWST r w s m) a b
rwsS = morphGS $ \f a -> RWST $ \r s -> (\((w, s', b), c) -> ((b, c), s', w))
<$> f (r, s, a)
runRWSS :: (Functor m, Monad m, Monoid w)
=> MSF (RWST r w s m) a b
-> MSF m (r, s, a) (w, s, b)
runRWSS = morphGS $ \f (r, s, a) -> (\((b, c), s', w) -> ((w, s', b), c))
<$> runRWST (f a) r s