pipes-3.1.0: Compositional pipelines

Safe HaskellSafe-Inferred

Control.Proxy.Trans.State

Contents

Description

This module provides the proxy transformer equivalent of StateT.

Synopsis

StateP

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

The State proxy transformer

Constructors

StateP 

Fields

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

Instances

ProxyTrans (StateP s) 
PFunctor (StateP s) 
(Proxy (StateP s p), MonadIOP p) => MonadIOP (StateP s p) 
(Proxy (StateP s p), MonadPlusP p) => MonadPlusP (StateP s p) 
Proxy p => Proxy (StateP s p) 
Proxy p => MonadTrans (StateP s p a' a b' b) 
Proxy p => MFunctor (StateP s p a' a b' b) 
(Proxy p, Monad m) => Monad (StateP s p a' a b' b m) 
(Proxy p, Monad m) => Functor (StateP s p a' a b' b m) 
(Monad (StateP s p a' a b' b m), MonadPlusP p, Monad m) => MonadPlus (StateP s p a' a b' b m) 
(Functor (StateP s p a' a b' b m), Proxy p, Monad m) => Applicative (StateP s p a' a b' b m) 
(Applicative (StateP s p a' a b' b m), MonadPlusP p, Monad m) => Alternative (StateP s p a' a b' b m) 
(Monad (StateP s p a' a b' b m), MonadIOP p, MonadIO 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 :: (Proxy p, Monad 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 :: (Proxy p, Monad 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 :: (Proxy p, Monad 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 :: (Proxy p, Monad 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 :: (Proxy p, Monad m) => StateP s p a' a b' b m sSource

Get the current state

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

Set the current state

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

Modify the current state using a function

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

Get the state filtered through a function