Questions tagged [scalaz-stream]

scalaz-stream is a streaming I/O library. The design goals are compositionality, expressiveness, resource safety, and speed. The design is meant to supersede or replace older iteratee or iteratee-style libraries.

The library supports a number of other interesting use cases:

  • Zipping and merging of streams: A streaming computations may read from multiple sources in a streaming fashion, zipping or merging their elements using a arbitrary Tee. In general, clients have a great deal of flexibility in what sort of topologies they can define--source, sinks, and effectful channels are all first-class concepts in the library.
  • Dynamic resource allocation: A streaming computation may allocate resources dynamically (for instance, reading a list of files to process from a stream built off a network socket), and the library will ensure these resources get released in the event of normal termination or when errors occur.
  • Nondeterministic and concurrent processing: A computation may read from multiple input streams simultaneously, using whichever result comes back first, and a pipeline of transformation can allow for nondeterminism and queueing at each stage.
  • Streaming parsing (UPCOMING): A separate layer handles constructing streaming parsers, for instance, for streaming JSON, XML, or binary parsing. See the roadmap for more information on this and other upcoming work.
83 questions
0
votes
1 answer

How to convert scalaz-stream Process[F, Option[T]] to Process[F, T]?

I have a scalaz-stream process: val src = Process.repeatEval(Task(in.take())) : Process[Task, Option[T]] How do I get rid of Option? So far I've used collect but it doesn't feel elegant: src.collect { case Some(x) => x } : Process[Task, T] Is…
piotrga
  • 1,214
  • 11
  • 11
0
votes
1 answer

scalaz stream structure for growing lists

I have a hunch that I can (should?) be using scalaz-streams for solving my problem which is like this. I have a starting item A. I have a function that takes an A and returns a list of A. def doSomething(a : A) : List[A] I have a work queue that…
blotto
  • 3
  • 1
0
votes
2 answers

side-effects for `wye` combinators when using `halt` from scalaz-stream

filter (which uses halt inside) terminates other branch even if it has some side-effects: scala> val p = Process("1","2", "3") scala> val p1 = p.filter(_ => true).map(_ + "p1").observe(io.stdOutLines) scala> val p2 = p.filter(_ => false).map(_ +…
dk14
  • 21,273
  • 4
  • 45
  • 81
0
votes
0 answers

With Scalaz streams, how can I evaluate a Process based on the contents of a previous Process?

I have a stream that will look something like: A B A B A B A B A B A B .... Where A and B are made up of one or more Process's. Based on the contents of a A, we want to do something with a B, either passing it to a sink or drain. I need to be able…
Jonoabroad
  • 439
  • 2
  • 15
0
votes
1 answer

Apply a Channel N times from an initial value

I have a function f and a channel c def f(i: Int) = Task.now(i + 1) val c = channel.lift(f) I would like to continuously apply the function f an arbitrary number of times (or indefinitely) to the output of the previous computation. I'm providing…
synapski
  • 313
  • 2
  • 12
0
votes
1 answer

Mysterious Scalaz NoClassDefFoundError and scalaz.InvariantFunctor errors

I have the following build.sbt, and am running Scala 2.10.4 with IntelliJ managing sbt, and refreshing the project based on the sbt build file. Everything was working fine, until i added scalaz-streams -- I cannot seem to be able to use…
flubba
  • 75
  • 1
  • 6
0
votes
1 answer

Stream processing

Have a requirement that when user is uploading a file it should work in a following manner 1)File upload dialog (in browser) is presented to the user. User picks a file. 2) Application should load only first x number of records (e.g. lets say total…
user2066049
  • 1,311
  • 1
  • 12
  • 24
-1
votes
1 answer

Ideal chunk in scala fs2 stream performance gain in production

was wondering if the increase in chunk size in scala fs2 stream will give the performance gain? import cats.effect.{IO, Sync} import fs2.{io, text} import java.nio.file.Paths def fahrenheitToCelsius(f: Double): Double = (f - 32.0) *…
vkt
  • 1,111
  • 1
  • 12
  • 32
1 2 3 4 5
6