Skip to content

Commit

Permalink
let empty return Observable[Nothing]/Rx[Nothing]
Browse files Browse the repository at this point in the history
  • Loading branch information
cornerman committed Nov 20, 2023
1 parent 6f87959 commit 17f3ff3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions colibri/src/main/scala/colibri/Observable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ object Observable {
@inline def unsafeSubscribe(sink: Observer[Nothing]): Cancelable = Cancelable.empty
}

@inline def empty[A]: Observable[A] = Empty
val unit: Observable[Unit] = Observable.pure(())
@inline def empty: Observable[Nothing] = Empty
val unit: Observable[Unit] = Observable.pure(())

def pure[T](value: T): Observable[T] = new Observable[T] {
def unsafeSubscribe(sink: Observer[T]): Cancelable = {
Expand Down
4 changes: 2 additions & 2 deletions reactive/src/main/scala/colibri/reactive/Reactive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ trait RxEvent[+A] extends RxSource[A] with RxSourceSelf[RxEvent, RxEvent, A] {

object RxEvent extends RxPlatform {
private val _empty: RxEvent[Nothing] = observableUnshared(Observable.empty)
@inline def empty[A]: RxEvent[A] = _empty
@inline def empty: RxEvent[Nothing] = _empty

@inline def apply[A](values: A*): RxEvent[A] = iterable(values)

Expand Down Expand Up @@ -148,7 +148,7 @@ trait RxLater[+A] extends RxState[A] with RxSourceSelf[RxLater, RxLater, A] {
}

object RxLater {
@inline def empty[A]: RxLater[A] = RxLaterEmpty
@inline def empty: RxLater[Nothing] = RxLaterEmpty

def future[A](future: => Future[A]): RxLater[A] = observable(Observable.fromFuture(future))
def effect[F[_]: RunEffect, A](effect: F[A]): RxLater[A] = observable(Observable.fromEffect(effect))
Expand Down

0 comments on commit 17f3ff3

Please sign in to comment.