Created
July 16, 2014 14:45
-
-
Save fthomas/9ab18fc9e0aadc534dd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scalaz.stream.examples | |
import scala.util.Random | |
import scalaz.concurrent.Task | |
import scalaz.stream._ | |
object Manifesto extends App { | |
val reactivemanifestowords = "Application requirements have changed dramatically in recent years. Only a few years ago a large application had tens of servers, seconds of response time, hours of offline maintenance and gigabytes of data. Today applications are deployed on everything from mobile devices to cloud-based clusters running thousands of multicore processors. Users expect millisecond or even microsecond response times and 100% uptime. Data needs are expanding into the petabytes.".split(" ").toIndexedSeq | |
val randomWord: Process[Task, String] = | |
Process.repeatEval(Task.delay(Random.shuffle(reactivemanifestowords).head)) | |
val aggregateWords: Process1[String, String] = | |
process1.chunk(2).map(_.mkString(" ")) | |
val process = randomWord.pipe(aggregateWords).through(io.stdOutLines) | |
process.run.run | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment