Skip to content

Commit 298413a

Browse files
committed
fix scala 3 build for collection factory methods
1 parent 8ac6997 commit 298413a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

colibri/src/main/scala/colibri/Observable.scala

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,11 +1316,13 @@ object Observable {
13161316
}
13171317
}
13181318

1319-
@inline def bufferTimed[Col[_]](duration: FiniteDuration)(implicit factory: Factory[A, Col[A]]): Observable[Col[A]] = bufferTimedMillis(
1319+
@inline def bufferTimed[Col[a] <: Iterable[a]](duration: FiniteDuration)(implicit factory: Factory[A, Col[A]]): Observable[Col[A]] =
1320+
bufferTimedMillis(
13201321
duration.toMillis.toInt,
13211322
)
13221323

1323-
def bufferTimedMillis[Col[_]](duration: Int)(implicit factory: Factory[A, Col[A]]): Observable[Col[A]] = new Observable[Col[A]] {
1324+
def bufferTimedMillis[Col[a] <: Iterable[a]](duration: Int)(implicit factory: Factory[A, Col[A]]): Observable[Col[A]] =
1325+
new Observable[Col[A]] {
13241326
def unsafeSubscribe(sink: Observer[Col[A]]): Cancelable = {
13251327
var isCancel = false
13261328
var builder = factory.newBuilder
@@ -1470,13 +1472,14 @@ object Observable {
14701472
def foldIO[B](seed: B)(f: (B, A) => B): IO[B] = scan(seed)(f).lastIO
14711473
def unsafeFoldFuture[B](seed: B)(f: (B, A) => B): Future[B] = scan(seed)(f).unsafeLastFuture()
14721474

1473-
def foldAllF[F[_]: Async, Col[_]](implicit factory: Factory[A, Col[A]]): F[Col[A]] = foldF(factory.newBuilder) { (buff, next) =>
1475+
def foldAllF[F[_]: Async, Col[a] <: Iterable[a]](implicit factory: Factory[A, Col[A]]): F[Col[A]] = foldF(factory.newBuilder) {
1476+
(buff, next) =>
14741477
buff += next
14751478
buff
14761479
}.map(_.result())
1477-
def foldAllIO[Col[_]](implicit factory: Factory[A, Col[A]]): IO[Col[A]] = foldAllF[IO, Col]
1478-
def foldAll[Col[_]](implicit factory: Factory[A, Col[A]]): Observable[Col[A]] = Observable.fromEffect(foldAllIO[Col])
1479-
def unsafeFoldToFuture[Col[_]]()(implicit factory: Factory[A, Col[A]]): Future[Col[A]] =
1480+
def foldAllIO[Col[a] <: Iterable[a]](implicit factory: Factory[A, Col[A]]): IO[Col[A]] = foldAllF[IO, Col]
1481+
def foldAll[Col[a] <: Iterable[a]](implicit factory: Factory[A, Col[A]]): Observable[Col[A]] = Observable.fromEffect(foldAllIO[Col])
1482+
def unsafeFoldToFuture[Col[a] <: Iterable[a]]()(implicit factory: Factory[A, Col[A]]): Future[Col[A]] =
14801483
foldAllIO[Col].unsafeToFuture()(cats.effect.unsafe.IORuntime.global)
14811484

14821485
@inline def prependEffect[F[_]: RunEffect](value: F[A]): Observable[A] = concatEffect[F, A](value, source)

0 commit comments

Comments
 (0)