avoid insertWith' depreaction warning

Switch to Data.Map.Strict everywhere that used it.

There are still lots of lazy maps in git-annex. I think switching these
is safe. The risk is that there might be a map that is used in a way
that relies on the values not being evaluated to WHNF, and switching to
strict might result in bad performance or memory use. So, I have not
switched everything.
This commit is contained in:
Joey Hess 2018-04-22 13:28:31 -04:00
parent 558a0a9328
commit 256d8f07e8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 24 additions and 26 deletions

View file

@ -73,7 +73,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.
@ -262,17 +262,17 @@ withState modifier = do
{- Sets a flag to True -}
setFlag :: String -> Annex ()
setFlag flag = changeState $ \s ->
s { flags = M.insertWith' const flag True $ flags 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 }
s { cleanup = M.insert k a $ cleanup s }
{- Sets the type of output to emit. -}
setOutput :: OutputType -> Annex ()