Module

Pipes.Util

Package
purescript-node-stream-pipes
Repository
cakekindel/purescript-node-stream-pipes

#whileJust Source

whileJust :: forall m a. MonadRec m => Pipe (Maybe a) a m Unit

Re-yield all Justs, and close when Nothing is encountered

#intersperse Source

intersperse :: forall m a. MonadEffect m => a -> Pipe (Maybe a) (Maybe a) m Unit

Yields a separator value sep between received values

toList $ (yield "a" *> yield "b" *> yield "c") >-> intersperse ","
-- "a" : "," : "b" : "," : "c" : Nil

#zip Source

zip :: forall a b m. MonadRec m => Producer a m Unit -> Producer b m Unit -> Producer (a /\ b) m Unit

#chunked Source

chunked :: forall m a. MonadEffect m => Int -> Pipe (Maybe a) (Maybe (Array a)) m Unit

Accumulate values in chunks of a given size.

If the pipe closes without yielding a multiple of size elements, the remaining elements are yielded at the end.

#buffered Source

buffered :: forall m. MonadEffect m => Int -> Pipe (Maybe Buffer) (Maybe Buffer) m Unit

Buffers input to the given size before passing to subsequent pipes

#uniqHash Source

uniqHash :: forall a m. Hashable a => MonadEffect m => MonadRec m => Pipe a a m Unit

Equivalent of unix uniq, filtering out duplicate values passed to it.

Uses a HashSet of hashes of a; for n elements awaited, this pipe will occupy O(n) space, and yield in O(1) time.

#InvokeResult Source

data InvokeResult :: Type -> Type -> (Type -> Type) -> Typedata InvokeResult a b m

The result of a single step forward of a pipe.

Constructors

#IntermediateInvokeResult Source

#invoke Source

invoke :: forall m a b. Monad m => Pipe a b m Unit -> a -> m (InvokeResult a b m)

Pass a single value to a pipe, returning the result of the pipe's invocation.