From e05c74f42fe12585b46c64ed7c8abd1c950bb3d9 Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Mon, 13 May 2024 15:04:34 -0500 Subject: [PATCH] fix: minor fixes --- src/Pipes.Node.Stream.purs | 1 + src/Pipes.Util.purs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Pipes.Node.Stream.purs b/src/Pipes.Node.Stream.purs index 2de43db..f67626a 100644 --- a/src/Pipes.Node.Stream.purs +++ b/src/Pipes.Node.Stream.purs @@ -96,6 +96,7 @@ fromTransform t = pure $ Done unit yieldFromReadableHalf = flip tailRecM unit $ const do + liftAff $ delay $ wrap 0.0 res <- liftEffect (O.read t) case res of O.ReadJust a -> do diff --git a/src/Pipes.Util.purs b/src/Pipes.Util.purs index 635196d..563bca4 100644 --- a/src/Pipes.Util.purs +++ b/src/Pipes.Util.purs @@ -85,9 +85,10 @@ chunked size = do Rec.whileJust $ runMaybeT do a <- MaybeT await chunkPut a - len <- chunkLength + len <- lift chunkLength when (len >= size) $ lift $ yield =<< Just <$> chunkTake - yield =<< Just <$> chunkTake + len <- chunkLength + when (len > 0) $ yield =<< Just <$> chunkTake yield Nothing -- | Equivalent of unix `uniq`, filtering out duplicate values passed to it.