Copyright | (c) Dmitry Bogatov <KAction@gnu.org> |
---|---|
License | GPL3 |
Maintainer | Dmitry Bogatov <KAction@gnu.org> |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell98 |
Extensions |
|
Functions for saving and retriving arbitary data in windows.
This module have advantage over TagWindows
in that it
hides from you implementation details and provides simple type-safe
interface.
- stateQuery :: Query a -> StateQuery s a
- unstate :: StateQuery s a -> Query a
- runStateQuery :: StateQuery s a -> Window -> X a
- get :: MonadState s m => m s
- put :: MonadState s m => s -> m ()
- modify :: MonadState s m => (s -> s) -> m ()
Usage
stateQuery :: Query a -> StateQuery s a Source
Lift Query to StateQuery.
runStateQuery :: StateQuery s a -> Window -> X a Source
Same, as "runQuery".
get :: MonadState s m => m s
Return the state from the internals of the monad.
put :: MonadState s m => s -> m ()
Replace the state inside the monad.
modify :: MonadState s m => (s -> s) -> m ()
Monadic state transformer.
Maps an old state to a new state inside a state monad. The old state is thrown away.
Main> :t modify ((+1) :: Int -> Int) modify (...) :: (MonadState Int a) => a ()
This says that modify (+1)
acts over any
Monad that is a member of the MonadState
class,
with an Int
state.