Module

Pipes.Collect

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

#traverse Source

traverse :: forall a b m. MonadRec m => (b -> a -> m b) -> b -> Producer a m Unit -> m b

Fold every value produced with a monadic action

Uses MonadRec, supporting producers of arbitrary length.

#fold Source

fold :: forall a b m. MonadRec m => (b -> a -> b) -> b -> Producer a m Unit -> m b

Fold every value produced

Uses MonadRec, supporting producers of arbitrary length.

#foreach Source

foreach :: forall a m. MonadRec m => (a -> m Unit) -> Producer a m Unit -> m Unit

Execute a monadic action on every item in a producer.

Uses MonadRec, supporting producers of arbitrary length.

#toMonoid Source

toMonoid :: forall a m. Monoid a => MonadRec m => MonadEffect m => Producer a m Unit -> m a

append all emitted values to mempty

#toStringWith Source

toStringWith :: forall m. MonadRec m => MonadEffect m => Encoding -> Producer Buffer m Unit -> m String

Concatenate all buffers to a single buffer, then decode with the provided encoding.

#toBuffer Source

toBuffer :: forall m. MonadRec m => MonadEffect m => Producer Buffer m Unit -> m Buffer

Concatenate all produced buffers to a single buffer

#toArray Source

toArray :: forall a m. MonadRec m => MonadEffect m => Producer a m Unit -> m (Array a)

Collect all values from a Producer into an array.

#toList Source

toList :: forall a m. MonadRec m => MonadEffect m => Producer a m Unit -> m (List a)

Collect all values from a Producer into a list.

Reverses the list after collecting, so that values will be in the order they were emitted.

#toListRev Source

toListRev :: forall a m. MonadRec m => MonadEffect m => Producer a m Unit -> m (List a)

Collect all values from a Producer into a list.

Does not reverse the list after collecting.

#toObject Source

toObject :: forall a m. MonadRec m => MonadEffect m => Producer (String /\ a) m Unit -> m (Object a)

Collect all values from a Producer into a Javascript Object.

#toHashMap Source

toHashMap :: forall k v m. Hashable k => MonadRec m => Producer (k /\ v) m Unit -> m (HashMap k v)

Collect all values from a Producer into a HashMap

#toMap Source

toMap :: forall k v m. Ord k => MonadRec m => Producer (k /\ v) m Unit -> m (Map k v)

Collect all values from a Producer into a Map