A combination of Error and state monad like ErrorT State
in Haskell.
Author: Bjoern Peemoeller
Version: September 2014
evalES
:: (a -> Either b (c,a)) -> a -> Either b c
Evaluate an ES
monad
|
returnES
:: a -> b -> Either c (a,b)
Lift a value into the ES
monad
|
failES
:: a -> b -> Either a (c,b)
Failing computation in the ES
monad
|
(>+=)
:: (a -> Either b (c,a)) -> (c -> a -> Either b (d,a)) -> a -> Either b (d,a)
Bind of the ES
monad
|
(>+)
:: (a -> Either b (c,a)) -> (a -> Either b (d,a)) -> a -> Either b (d,a)
Sequence operator of the ES
monad
|
(<$>)
:: (a -> b) -> (c -> Either d (a,c)) -> c -> Either d (b,c)
Apply a pure function onto a monadic value. |
(<*>)
:: (a -> Either b (c -> d,a)) -> (a -> Either b (c,a)) -> a -> Either b (d,a)
Apply a function yielded by a monadic action to a monadic value. |
gets
:: a -> Either b (a,a)
Retrieve the current state |
puts
:: a -> a -> Either b ((),a)
Replace the current state |
modify
:: (a -> a) -> a -> Either b ((),a)
Modify the current state |
mapES
:: (a -> b -> Either c (d,b)) -> [a] -> b -> Either c ([d],b)
Map a monadic function on all elements of a list by sequencing the effects. |
concatMapES
:: (a -> b -> Either c ([d],b)) -> [a] -> b -> Either c ([d],b)
Same as concatMap , but for a monadic function.
|
mapAccumES
:: (a -> b -> c -> Either d ((a,e),c)) -> a -> [b] -> c -> Either d ((a,[e]),c)
Same as mapES
but with an additional accumulator threaded through.
|
Error state monad.
Type synonym: ES a b c = b -> Either a (c,b)
Evaluate an |
Lift a value into the
|
Failing computation in the
|
Bind of the
|
Sequence operator of the
|
Apply a pure function onto a monadic value.
|
Apply a function yielded by a monadic action to a monadic value.
|
Retrieve the current state
|
Replace the current state
|
Modify the current state |
Map a monadic function on all elements of a list by sequencing the effects. |
Same as |
Same as |