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

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

package loggerf.instances

import _root_.cats.Monad
import effectie.core.FxCtor
import loggerf.core.Log
import loggerf.logger.CanLog

/** @author Kevin Lee
  * @since 2020-04-10
  */
trait cats {

  given logF[F[*]](
    using EF: FxCtor[F],
    canLog: CanLog,
    MF: Monad[F],
  ): Log[F] =
    new LogF[F](EF, canLog, MF)

  final class LogF[F[*]](
    override val EF: FxCtor[F],
    override val canLog: CanLog,
    val MF: Monad[F],
  ) extends Log[F] {

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

    override def flatMap0[A, B](fa: F[A])(f: A => F[B]): F[B] = MF.flatMap(fa)(f)
  }

}

object cats extends cats




© 2015 - 2025 Weber Informatics LLC | Privacy Policy