purescript-hareactive icon indicating copy to clipboard operation
purescript-hareactive copied to clipboard

Add a way to flatten a stream of arrays of events into a stream of events

Open werner291 opened this issue 5 years ago • 0 comments

Hello!

Currently, I have this thing in my code:

flattenArrayStream :: forall a. Stream (Array a) -> Now (Stream a)
flattenArrayStream input = do
  ss <- liftEffect sinkStream'
  liftEffect $ subscribe (foldMap (\x -> pushSink x ss.sink)) input
  pure ss.stream

Perhaps a new combinator that does something like this the "proper" way (perhaps without using Effect?) would be useful?

werner291 avatar Oct 09 '19 12:10 werner291