ReactiveX / RxScala

RxScala – Reactive Extensions for Scala – a library for composing asynchronous and event-based programs using observable sequences
Apache License 2.0
888 stars 121 forks source link

Can't find Observable.compose(), any alternatives? #230

Closed grant-guo closed 4 years ago

samuelgruetter commented 6 years ago

There's a guide which should answer all questions of this kind. compose was intentionally left out because it is considered non-Scala-idiomatic. As the guide suggests, I'd use extension methods.

grant-guo commented 6 years ago

@samuelgruetter Thanks! you mean I have to use implicit class to wrap a rxjava Observable inside?

samuelgruetter commented 6 years ago

Yes, but I'd wrap the RxScala Observable inside the implicit class, not the RxJava Observable.

dhoepelman commented 6 years ago

I personally find compose much clearer, as a workaround, it's not difficult to add compose yourself as an extension method:

implicit class ObservableCompose[T](val obs: Observable[T]) extends AnyVal {
  def compose[U](transformer: Observable[T] => Observable[U]): Observable[U] = f(obs)
}
dhoepelman commented 4 years ago

Due to project EOL status, no new operators will be added.