summaryrefslogtreecommitdiff
path: root/src/Contact.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-07-17 22:51:32 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-07-26 21:55:45 +0200
commit6c13b1285605020bb3c510dd1862d2d8d9828337 (patch)
treed851f7c3ef20ff8016a778e01f2321e00526cbeb /src/Contact.hs
parent97427b2f49daa9d86661ad999d4da17ac7a4acb4 (diff)
Generalize head updates to provided MonadIO instances
Diffstat (limited to 'src/Contact.hs')
-rw-r--r--src/Contact.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/Contact.hs b/src/Contact.hs
index 70e79b9..1dc926e 100644
--- a/src/Contact.hs
+++ b/src/Contact.hs
@@ -153,12 +153,11 @@ contactReject :: (MonadIO m, MonadError String m) => Peer -> m ()
contactReject = pairingReject @ContactAccepted Proxy
finalizeContact :: MonadHead LocalState m => UnifiedIdentity -> m ()
-finalizeContact identity = do
+finalizeContact identity = updateSharedState_ $ \contacts -> do
st <- getStorage
- updateSharedState_ $ \contacts -> do
- cdata <- wrappedStore st ContactData
- { cdPrev = []
- , cdIdentity = idDataF $ finalOwner identity
- , cdName = Nothing
- }
- storeSetAdd st (mergeSorted @Contact [cdata]) contacts
+ cdata <- wrappedStore st ContactData
+ { cdPrev = []
+ , cdIdentity = idDataF $ finalOwner identity
+ , cdName = Nothing
+ }
+ storeSetAdd st (mergeSorted @Contact [cdata]) contacts