k0001 commented on this pull request.
> — where
— tick :: StateT (WalletWorkerState b) IO ()
— tick = lift (readChan chan) >>= \case
— Shutdown -> return ()
— msg -> interp ops msg >> tick
+— | Connect a wallet action interpreter to a source actions. This function
+— returns as soon as the given action returns ‘Shutdown’.
+ :: Ex.MonadMask m
+ => WalletActionInterp m b
+ -> m (WalletAction b)
+ -> m ()
+walletWorker wai getWA = Ex.bracket_
+ (emit wai «Starting wallet worker.»)
+ (fix $ \next -> lift getWA >>= \case
Hmm, no, there’s no memory efficiency reason involved. Just normal recursive monadic code.