Daniel Spiewak on scalaz-streams (TimesOpen: Reactive Programming)

TimesOpen · 3K views · 2014 · 48:52

Open on YouTube

Functional programmingSoftware architecture & designtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when explaining what scalaz-streams is, how its pull-based design differs from push-based RxJava, and how to use it for IO pipelines.

Recommended by 2 people across 2 different months, 2014 to 2015.

What it is

A 2014 conference talk by Daniel Spiewak at a New York Times developer event on reactive programming, introducing scalaz-streams and how to use it on practical problems. It covers the benefits and drawbacks of its pull-based model compared with more mainstream stream frameworks.

What people said

Recommends Xiaohe Dong · 2015-05 · Stack Overflow · on “Idiomatic (functional) file processing pipeline in Scala”

Perhaps you can use Scalaz-stream. The library provides compositionality, expressiveness, resource safety, and speed to process IO. Also, It uses instant memory which will be very useful for handling large data. Here is github for that: [LINK] Youtube talk about it: [LINK] [this video]

Recommends Adel Nizamuddin · 2015-07 · Stack Overflow · on “Scalaz Streams vs Rx Java”

They both do offer resource management (see RxJava's unsubscription model) The main difference between them is that scalaz-streams are pull based and RxJava is push based. With pull based streams consumers control the action, in push based it's producers. With push based streams you'll have to handle backpressure somehow (for example 1000s of open websocket connections that push data to your server), whereas with pull based streams backpressure is not a problem, the consumer is controlling the action. More on push vs pull in this talk: [this video]

Cites oxbow_lakes · 2014-11 · Stack Overflow · on “Merging scalaz-stream input processes seems to "wait" on stdin”

I have a simple program: import scalaz._ import stream._ object Play extends App { val in1 = io.linesR("C:/tmp/as.txt") val in2 = io.linesR("C:/tmp/bs.txt") val p = (in1 merge in2) to io.stdOutLines p.run.run } The file as.txt contains five a s and the file bs.txt contain 3 b s. I see this sort of output: a b b a a b a a a However, when I change the declaration of in2 as follows: val in2 = io.stdInLines Then I get what I think is unexpected behaviour. According to the documentation 1 [this video] , the program should pull data non-deterministically from each stream according to whichever stream is quicker to supply stuff. This should mean that I see a bunch of a s immediately printed to the conso