diff options
author | Benjamin Barenblat <bbarenblat@gmail.com> | 2022-01-19 12:58:54 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbarenblat@gmail.com> | 2022-01-19 13:31:02 -0500 |
commit | 44df82dcbf72d01d2bbb6c0afacff329ca749854 (patch) | |
tree | 2619d3890a9e7e532f0ad19fd5fb4e6579bd0db7 /Annex.hs | |
parent | 0ded71e9a53b1482019aedaa194e913d3a021c8d (diff) |
Eliminate Data.Map.insertWith'
containers-0.6 removed insertWith' in favor of the Data.Map.Strict API.
Switch to the new API where appropriate.
Diffstat (limited to 'Annex.hs')
-rw-r--r-- | Annex.hs | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1,6 +1,7 @@ {- git-annex monad - - Copyright 2010-2018 Joey Hess <id@joeyh.name> + - Copyright 2022 Benjamin Barenblat <bbarenblat@gmail.com> - - Licensed under the GNU GPL version 3 or higher. -} @@ -73,7 +74,7 @@ import "mtl" Control.Monad.Reader import Control.Concurrent import Control.Concurrent.Async import Control.Concurrent.STM -import qualified Data.Map as M +import qualified Data.Map.Strict as M import qualified Data.Set as S {- git-annex's monad is a ReaderT around an AnnexState stored in a MVar. @@ -259,18 +260,16 @@ withState modifier = do {- Sets a flag to True -} setFlag :: String -> Annex () -setFlag flag = changeState $ \s -> - s { flags = M.insertWith' const flag True $ flags s } +setFlag flag = changeState $ \s -> s { flags = M.insert flag True $ flags s } {- Sets a field to a value -} setField :: String -> String -> Annex () setField field value = changeState $ \s -> - s { fields = M.insertWith' const field value $ fields s } + s { fields = M.insert field value $ fields s } {- Adds a cleanup action to perform. -} addCleanup :: CleanupAction -> Annex () -> Annex () -addCleanup k a = changeState $ \s -> - s { cleanup = M.insertWith' const k a $ cleanup s } +addCleanup k a = changeState $ \s -> s { cleanup = M.insert k a $ cleanup s } {- Sets the type of output to emit. -} setOutput :: OutputType -> Annex () |