summaryrefslogtreecommitdiff
path: root/main/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-08-05 21:28:55 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-08-05 21:28:55 +0200
commitcbdbc0a176736b3be970f263f2319a0f6bd123bd (patch)
treed2356bda2a22fabc8103d3157c1fa4c2869445e1 /main/Main.hs
parent1cab80953eda5547ee5ef2599a622fc8329e81ea (diff)
Use MonadStorage for createIdentity
Changelog: API: `Identity.createIdentity` uses `MonadStorage`
Diffstat (limited to 'main/Main.hs')
-rw-r--r--main/Main.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/main/Main.hs b/main/Main.hs
index a3b74b1..5bda7e7 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -287,7 +287,7 @@ main = do
["update-identity"] -> do
withTerminal noCompletion $ \term -> do
either (fail . showErebosError) return <=< runExceptT $ do
- runReaderT (updateSharedIdentity term) =<< loadLocalStateHead term st
+ runReaderT (updateSharedIdentity term) =<< runReaderT (loadLocalStateHead term) st
("update-identity" : srefs) -> do
withTerminal noCompletion $ \term -> do
@@ -329,9 +329,10 @@ main = do
interactiveLoop :: Storage -> Options -> IO ()
interactiveLoop st opts = withTerminal commandCompletion $ \term -> do
- erebosHead <- case optCreateIdentity opts of
- Nothing -> loadLocalStateHead term st
- Just ( devName, names ) -> createLocalStateHead st (names ++ [ devName ])
+ erebosHead <- either (fail . showErebosError) return <=< runExceptT . flip runReaderT st $ do
+ case optCreateIdentity opts of
+ Nothing -> loadLocalStateHead term
+ Just ( devName, names ) -> createLocalStateHead (names ++ [ devName ])
void $ printLine term $ T.unpack $ displayIdentity $ headLocalIdentity erebosHead
let tui = hasTerminalUI term
@@ -703,8 +704,7 @@ cmdJoin = joinChatroom =<< getSelectedChatroom
cmdJoinAs :: Command
cmdJoinAs = do
name <- asks ciLine
- st <- getStorage
- identity <- liftIO $ createIdentity st (Just $ T.pack name) Nothing
+ identity <- createIdentity (Just $ T.pack name) Nothing
joinChatroomAs identity =<< getSelectedChatroom
cmdLeave :: Command