Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type RSS r w s = RSST r w s Identity
- rss :: Monoid w => (r -> s -> (a, s, w)) -> RSS r w s a
- runRSS :: Monoid w => RSS r w s a -> r -> s -> (a, s, w)
- evalRSS :: Monoid w => RSS r w s a -> r -> s -> (a, w)
- execRSS :: Monoid w => RSS r w s a -> r -> s -> (s, w)
- withRSS :: (r' -> s -> (r, s)) -> RSS r w s a -> RSS r' w s a
- data RSST r w s m a
- runRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (a, s, w)
- evalRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (a, w)
- execRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (s, w)
- withRSST :: (r' -> s -> (r, s)) -> RSST r w s m a -> RSST r' w s m a
- liftCatch :: Catch e m (a, (s, w)) -> Catch e (RSST r w s m) a
The RWS monad
type RSS r w s = RSST r w s Identity Source #
A monad containing an environment of type r
, output of type w
and an updatable state of type s
.
rss :: Monoid w => (r -> s -> (a, s, w)) -> RSS r w s a Source #
Construct an RSS computation from a function.
(The inverse of runRSS
.)
runRSS :: Monoid w => RSS r w s a -> r -> s -> (a, s, w) Source #
Unwrap an RSS computation as a function.
(The inverse of rss
.)
:: Monoid w | |
=> RSS r w s a | RWS computation to execute |
-> r | initial environment |
-> s | initial value |
-> (a, w) | final value and output |
Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.
:: Monoid w | |
=> RSS r w s a | RWS computation to execute |
-> r | initial environment |
-> s | initial value |
-> (s, w) | final state and output |
Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.
The RSST monad transformer
A monad transformer adding reading an environment of type r
,
collecting an output of type w
and updating a state of type s
to an inner monad m
.
Instances
:: (Monoid w, Monad m) | |
=> RSST r w s m a | computation to execute |
-> r | initial environment |
-> s | initial value |
-> m (a, w) | computation yielding final value and output |
Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.
:: (Monoid w, Monad m) | |
=> RSST r w s m a | computation to execute |
-> r | initial environment |
-> s | initial value |
-> m (s, w) | computation yielding final state and output |
Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.