diff options
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/State.hs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/Utility/State.hs b/Utility/State.hs deleted file mode 100644 index ad38db542..000000000 --- a/Utility/State.hs +++ /dev/null @@ -1,26 +0,0 @@ -{- state monad support - - - - Copyright 2012 Joey Hess <joey@kitenet.net> - - - - Licensed under the GNU GPL version 3 or higher. - -} - -module Utility.State where - -import "mtl" Control.Monad.State.Strict - -{- Modifies Control.Monad.State's state, forcing a strict update. - - This avoids building thunks in the state and leaking. - - Why it's not the default, I don't know. - - - - Example: changeState $ \s -> s { foo = bar } - -} -changeState :: MonadState s m => (s -> s) -> m () -changeState f = do - x <- get - put $! f x - -{- Gets a value from the internal state, selected by the passed value - - constructor. -} -getState :: MonadState s m => (s -> a) -> m a -getState = gets |