mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-30 19:51:51 -07:00
Move modifyXS
to X.U.ExtensibleState
This commit is contained in:
@@ -21,6 +21,7 @@ module XMonad.Util.ExtensibleState (
|
||||
, remove
|
||||
, get
|
||||
, gets
|
||||
, modified
|
||||
) where
|
||||
|
||||
import Data.Typeable (typeOf,cast)
|
||||
@@ -115,3 +116,10 @@ gets = flip fmap get
|
||||
-- | Remove the value from the extensible state field that has the same type as the supplied argument
|
||||
remove :: ExtensionClass a => a -> X ()
|
||||
remove wit = modifyStateExts $ M.delete (show . typeOf $ wit)
|
||||
|
||||
modified :: (ExtensionClass a, Eq a) => (a -> a) -> X Bool
|
||||
modified f = do
|
||||
v <- get
|
||||
case f v of
|
||||
v' | v' == v -> return False
|
||||
| otherwise -> put v' >> return True
|
||||
|
Reference in New Issue
Block a user