effet-0.4.0.0: An Effect System based on Type Classes
Copyright(c) Michael Szvetits 2020
LicenseBSD3 (see the file LICENSE)
Maintainertypedbyte@qualified.name
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Control.Effect.RWS.Strict

Description

Strict interpretations of the RWS' effect.

If you don't require disambiguation of multiple RWS effects (i.e., you only have one RWS effect in your monadic context), you usually need the untagged interpretations.

Synopsis

Interpreter Type

data RWST r w s m a Source #

The strict interpreter of the RWS effect. This type implements the RWS' type class in a strict manner.

When interpreting the effect, you usually don't interact with this type directly, but instead use one of its corresponding interpretation functions.

Instances

Instances details
(Monad m, Monoid w) => RWS' (tag :: k) r w s (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Monad m => Reader' (tag :: k) r (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

ask' :: RWST r w s m r Source #

local' :: (r -> r) -> RWST r w s m a -> RWST r w s m a Source #

reader' :: (r -> a) -> RWST r w s m a Source #

Monad m => State' (tag :: k) s (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

get' :: RWST r w s m s Source #

put' :: s -> RWST r w s m () Source #

state' :: (s -> (s, a)) -> RWST r w s m a Source #

(Monad m, Monoid w) => Writer' (tag :: k) w (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

tell' :: w -> RWST r w s m () Source #

listen' :: RWST r w s m a -> RWST r w s m (w, a) Source #

censor' :: (w -> w) -> RWST r w s m a -> RWST r w s m a Source #

MonadBase b m => MonadBase b (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

liftBase :: b α -> RWST r w s m α #

(MonadBaseControl b m, Monoid w) => MonadBaseControl b (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Associated Types

type StM (RWST r w s m) a #

Methods

liftBaseWith :: (RunInBase (RWST r w s m) b -> b a) -> RWST r w s m a #

restoreM :: StM (RWST r w s m) a -> RWST r w s m a #

MonadTrans (RWST r w s) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

lift :: Monad m => m a -> RWST r w s m a #

Monoid w => MonadTransControl (RWST r w s) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Associated Types

type StT (RWST r w s) a #

Methods

liftWith :: Monad m => (Run (RWST r w s) -> m a) -> RWST r w s m a #

restoreT :: Monad m => m (StT (RWST r w s) a) -> RWST r w s m a #

Monad m => Monad (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

(>>=) :: RWST r w s m a -> (a -> RWST r w s m b) -> RWST r w s m b #

(>>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b #

return :: a -> RWST r w s m a #

Functor m => Functor (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

fmap :: (a -> b) -> RWST r w s m a -> RWST r w s m b #

(<$) :: a -> RWST r w s m b -> RWST r w s m a #

Monad m => Applicative (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

pure :: a -> RWST r w s m a #

(<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b #

liftA2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c #

(*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b #

(<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a #

MonadIO m => MonadIO (RWST r w s m) Source # 
Instance details

Defined in Control.Effect.RWS.Strict

Methods

liftIO :: IO a -> RWST r w s m a #

type StT (RWST r w s) a Source # 
Instance details

Defined in Control.Effect.RWS.Strict

type StT (RWST r w s) a = (a, s, w)
type StM (RWST r w s m) a Source # 
Instance details

Defined in Control.Effect.RWS.Strict

type StM (RWST r w s m) a = ComposeSt (RWST r w s) m a

Tagged Interpretations

evalRWS' Source #

Arguments

:: forall tag r w s m a. (Functor m, Monoid w) 
=> r

The initial environment.

-> s

The initial state.

-> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a

The program whose RWS effect should be handled.

-> m (w, a)

The program with its RWS effect handled, producing the final output w and the result a.

Runs the RWS effect and discards the final state.

execRWS' Source #

Arguments

:: forall tag r w s m a. (Functor m, Monoid w) 
=> r

The initial environment.

-> s

The initial state.

-> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a

The program whose RWS effect should be handled.

-> m (w, s)

The program with its RWS effect handled, producing the final output w and the final state s.

Runs the RWS effect and discards the result of the interpreted program.

runRWS' Source #

Arguments

:: forall tag r w s m a. (Functor m, Monoid w) 
=> r

The initial environment.

-> s

The initial state.

-> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a

The program whose RWS effect should be handled.

-> m (w, s, a)

The program with its RWS effect handled, producing the final output w, the final state s and the result a.

Runs the RWS effect and returns the final output, the final state and the result of the interpreted program.

Untagged Interpretations

evalRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a) Source #

execRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s) Source #

runRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a) Source #