repl-toolkit-0.5.0.0: Toolkit for quickly whipping up config files and command-line interfaces.

Safe HaskellSafe-Inferred
LanguageHaskell2010

System.REPL.State

Contents

Description

Helper functions relating to State.

Synopsis

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.

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) Source

Extracts seven results from the current state.

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) Source

Extracts eight results from the current state.