From 2903fd39c39357168a7cbb8b6821a0c99ed1e5a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 26 Dec 2021 22:22:34 +0100 Subject: Generalize local state helper functions --- src/Main.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 9dcbae9..1515648 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -99,7 +99,7 @@ main = do Nothing -> error "ref does not exist" Just ref -> print $ storedGeneration (wrappedLoad ref :: Stored Object) - ["update-identity"] -> updateSharedIdentity =<< loadLocalStateHead st + ["update-identity"] -> runReaderT updateSharedIdentity =<< loadLocalStateHead st ("update-identity" : srefs) -> do sequence <$> mapM (readRef st . BC.pack) srefs >>= \case @@ -290,8 +290,7 @@ cmdHistory = void $ do cmdUpdateIdentity :: Command cmdUpdateIdentity = void $ do - ehead <- asks ciHead - liftIO $ updateSharedIdentity ehead + runReaderT updateSharedIdentity =<< asks ciHead cmdAttach :: Command cmdAttach = join $ attachToOwner -- cgit v1.2.3