Monix: Version 2.0-RC8 Released

This release candidate is probably the last one before 2.0, assuming new bugs aren’t found. Amongst others, it introduces an awesome Consumer type which makes it possible to describe composable consumers. For a teaser:

// For processing sums in parallel, useless of course, but can become 
// really helpful for logic sprinkled with I/O bound stuff
val consumer = Consumer
  .loadBalance(parallelism=10, Consumer.foldLeft(Coeval(0L))(_ + _))
  .map(_.sum)

val observable: Observable[Int] = ???
// Our consumer turns our observable into a Task processing sums, w00t!
val task: Task[Long] = observable.runWith(consumer)

// Consume the whole stream and get the result
task.runAsync.foreach(println)

See the published API Documentation.

Critical bug fix:

  • BUG #181: the default operators on CancelableFuture are triggering StackOverflow exceptions

New Features:

  • Issue #184: introducing the Consumer type, a factory of subscribers that makes it easier to specify reusable and composable consumers and for example, it makes it possible, out of the box, to load-balance the workload between multiple subscribers in parallel; see the description
  • Issue #186 (related to issue #168): adds the Observable.interleave2 operator, similar with the one in FS2 (former scalaz-streams)
  • Issue #180: the Observer.feed function now has an overload that does not take a cancelable, because it’s awkward coming up with one if it isn’t needed; there’s also a onNextAll extension for both Observer and Subscriber which can push a whole collection of events
  • Issue #187: integrates the MonadCombine type-class from Cats, being similar to the Scalaz MonadPlus, as somehow this was missed in the initial integration
  • Issue #177 reviews exposed traits and abstract classes, making sure they inherit from Serializable
  • Issue #85: small change,
    clarifies the ScalaDoc on the RefCountCancelable type
  • Issue #162: implements the Observable.takeUntil(trigger: Observable[Any]) operator, an operator that takes from the source until another observable triggers an event
  • Issue #189: for Observable operators that return a single item (e.g. sumF, foldLeftF, etc.) adds variants that do the same thing, but return Task results instead, so now we have foldLeftL, sumL, etc. that return tasks
  • Issue #190: changes many observable operators, that were taking by-name parameters or initial state parameters (e.g. headOrElseF, foldLeftF, etc), to take Coeval params instead, in order to have fine control over the evaluation model
  • Issue #191: introduces by default an implicit conversion from Any to Coeval.Now, to make it easier to use Coeval as function parameters - the default will thus simply be strict evaluation, strictness being usually the default in Scala

This release we’ve got a new contributor: @leakyabstraction; W00t!

Enjoy!