From f8344d4a0c662f90e61501d9d8535b0e81fb3535 Mon Sep 17 00:00:00 2001 From: b0oh Date: Thu, 20 Mar 2025 12:32:58 +0700 Subject: [PATCH] Remove unused import in sync prelude --- hbs2-sync/src/HBS2/Sync/Prelude.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hbs2-sync/src/HBS2/Sync/Prelude.hs b/hbs2-sync/src/HBS2/Sync/Prelude.hs index 872639b6..94e9e63f 100644 --- a/hbs2-sync/src/HBS2/Sync/Prelude.hs +++ b/hbs2-sync/src/HBS2/Sync/Prelude.hs @@ -65,7 +65,6 @@ import System.Directory import System.Exit qualified as Exit import System.IO qualified as IO import UnliftIO as Exported -import HBS2.CLI.Prelude (IsTimeout) {- HLINT ignore "Functor law" -} {- HLINT ignore "Eta reduce" -} @@ -453,6 +452,8 @@ die what = liftIO do hPutDoc stderr (pretty what) Exit.exitFailure + +animateSpinner :: IO (Async ()) animateSpinner = async $ forM_ (cycle "|/-\\") $ \c -> do IO.putChar c @@ -460,6 +461,7 @@ animateSpinner = IO.cursorBackward 1 pause (TimeoutSec 0.25) + waitForRefchan :: ( HasClientAPI PeerAPI UNIX m , HasClientAPI RefChanAPI UNIX m @@ -477,16 +479,13 @@ waitForRefchan refchan timeout = do liftIO $ putStr "waiting for refchan " spinner <- liftIO animateSpinner - res <- race (pause timeout) (wait 1) + result <- race (pause timeout) (wait 1) cancel spinner liftIO $ do IO.setCursorColumn 0 IO.clearLine - case res of - Right x -> pure (Just x) - _ -> pure Nothing - + pure $ eitherToMaybe result where wait seconds = do fetchRefChanHead @UNIX refchan