All Downloads are FREE. Search and download functionalities are using the official Maven repository.

loggerf.instances.future.scala Maven / Gradle / Ivy

There is a newer version: 2.2.0-beta2
Show newest version
package loggerf.instances

import effectie.core.FxCtor
import loggerf.core.Log
import loggerf.logger.CanLog

import scala.concurrent.{ExecutionContext, Future}

/** @author Kevin Lee
  * @since 2022-02-09
  */
object future {

  given logFuture(
    using canLog: CanLog,
    EC: ExecutionContext,
  ): Log[Future] =
    new LogFuture(canLog, EC)

  final class LogFuture(
    override val canLog: CanLog,
    val EC: ExecutionContext,
  ) extends Log[Future] {

    override val EF: FxCtor[Future] = effectie.instances.future.fxCtor.fxCtorFuture(EC)

    override def map0[A, B](fa: Future[A])(f: A => B): Future[B] = fa.map(f)(EC)

    override def flatMap0[A, B](fa: Future[A])(f: A => Future[B]): Future[B] = fa.flatMap(f)(using EC)
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy