wip, cli refchan head get - minor opt

This commit is contained in:
Dmitry Zuikov 2023-07-14 20:38:11 +03:00
parent 2a9b43397e
commit c1ea68bb1b
1 changed files with 6 additions and 6 deletions

View File

@ -103,17 +103,17 @@ readBlob hr = do
sto <- getStorage sto <- getStorage
let readBlock h = liftIO $ getBlock sto h let readBlock h = liftIO $ getBlock sto h
chunks <- S.toList_ $
deepScan ScanDeep (const $ S.yield Nothing) (fromHashRef hr) readBlock $ \ha -> do
unless (fromHashRef hr == ha) do
readBlock ha >>= S.yield
let mfo acc el = case (acc, el) of let mfo acc el = case (acc, el) of
(Nothing, Just s) -> Just [s] (Nothing, Just s) -> Just [s]
(_, Nothing) -> Nothing (_, Nothing) -> Nothing
(Just ss, Just s) -> Just (s:ss) (Just ss, Just s) -> Just (s:ss)
pure $ LBS.concat . reverse <$> foldl mfo Nothing chunks chunks <- S.fold_ mfo Nothing id $
deepScan ScanDeep (const $ S.yield Nothing) (fromHashRef hr) readBlock $ \ha -> do
unless (fromHashRef hr == ha) do
readBlock ha >>= S.yield
pure $ LBS.concat . reverse <$> chunks
refChanWorker :: forall e s m . ( MonadIO m refChanWorker :: forall e s m . ( MonadIO m
, MonadUnliftIO m , MonadUnliftIO m