pipes-2.5.0: Compositional pipelines

Safe HaskellSafe-Inferred

Control.Proxy.Trans.State

Contents

Description

This module provides the proxy transformer equivalent of StateT.

Sequencing of computations is strict.

Synopsis

StateP

newtype StateP s p a' a b' b m r Source

The strict State proxy transformer

Constructors

StateP 

Fields

unStateP :: s -> p a' a b' b m (r, s)
 

Instances

ProxyTrans (StateP s) 
Channel p => Channel (StateP s p) 
MonadTrans (p a' a b' b) => MonadTrans (StateP s p a' a b' b) 
MFunctor (p a' a b' b) => MFunctor (StateP s p a' a b' b) 
Monad (p a' a b' b m) => Monad (StateP s p a' a b' b m) 
Monad (p a' a b' b m) => Functor (StateP s p a' a b' b m) 
(Monad (StateP s p a' a b' b m), MonadPlus (p a' a b' b m)) => MonadPlus (StateP s p a' a b' b m) 
(Functor (StateP s p a' a b' b m), Monad (p a' a b' b m)) => Applicative (StateP s p a' a b' b m) 
(Applicative (StateP s p a' a b' b m), MonadPlus (p a' a b' b m)) => Alternative (StateP s p a' a b' b m) 
(Monad (StateP s p a' a b' b m), MonadIO (p a' a b' b m)) => MonadIO (StateP s p a' a b' b m) 

runStateP :: s -> StateP s p a' a b' b m r -> p a' a b' b m (r, s)Source

Run a StateP computation, producing the final result and state

runStateK :: s -> (q -> StateP s p a' a b' b m r) -> q -> p a' a b' b m (r, s)Source

Run a StateP 'K'leisli arrow, procuding the final result and state

evalStateP :: Monad (p a' a b' b m) => s -> StateP s p a' a b' b m r -> p a' a b' b m rSource

Evaluate a StateP computation, but discard the final state

evalStateK :: Monad (p a' a b' b m) => s -> (q -> StateP s p a' a b' b m r) -> q -> p a' a b' b m rSource

Evaluate a StateP 'K'leisli arrow, but discard the final state

execStateP :: Monad (p a' a b' b m) => s -> StateP s p a' a b' b m r -> p a' a b' b m sSource

Evaluate a StateP computation, but discard the final result

execStateK :: Monad (p a' a b' b m) => s -> (q -> StateP s p a' a b' b m r) -> q -> p a' a b' b m sSource

Evaluate a StateP 'K'leisli arrow, but discard the final result

State operations

get :: Monad (p a' a b' b m) => StateP s p a' a b' b m sSource

Get the current state

put :: Monad (p a' a b' b m) => s -> StateP s p a' a b' b m ()Source

Set the current state

modify :: Monad (p a' a b' b m) => (s -> s) -> StateP s p a' a b' b m ()Source

Modify the current state using a function

gets :: Monad (p a' a b' b m) => (s -> r) -> StateP s p a' a b' b m rSource

Get the state filtered through a function