Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Helper functions relating to State.
- get1 :: Monad m => (s -> a) -> StateT s m a
- get2 :: Monad m => (s -> a) -> (s -> b) -> StateT s m (a, b)
- get3 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> StateT s m (a, b, c)
- get4 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> StateT s m (a, b, c, d)
- get5 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> (s -> e) -> StateT s m (a, b, c, d, e)
- get6 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> (s -> e) -> (s -> f) -> StateT s m (a, b, c, d, e, f)
- get7 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> (s -> e) -> (s -> f) -> (s -> g) -> StateT s m (a, b, c, d, e, f, g)
- get8 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> (s -> e) -> (s -> f) -> (s -> g) -> (s -> h) -> StateT s m (a, b, c, d, e, f, g, h)
Convenience functions for handling state
These can be convenient when one wishes to to extract a number of elements from the current state via pattern -matching, e.g.
data State = State{f::a,g::b,h::c} ... do (x,z) <- get2 f h ...do something with x and z...
get1 :: Monad m => (s -> a) -> StateT s m a Source #
Extracts a result from the current state.
Defined as get1 f = liftM f get
.
get2 :: Monad m => (s -> a) -> (s -> b) -> StateT s m (a, b) Source #
Extracts two results from the current state.
get3 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> StateT s m (a, b, c) Source #
Extracts three results from the current state.
get4 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> StateT s m (a, b, c, d) Source #
Extracts four results from the current state.
get5 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> (s -> e) -> StateT s m (a, b, c, d, e) Source #
Extracts five results from the current state.
get6 :: Monad m => (s -> a) -> (s -> b) -> (s -> c) -> (s -> d) -> (s -> e) -> (s -> f) -> StateT s m (a, b, c, d, e, f) Source #
Extracts six results from the current state.