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

izumi.functional.bio.impl.PrimitivesMZio.scala Maven / Gradle / Ivy

There is a newer version: 1.2.16
Show newest version
package izumi.functional.bio.impl

import izumi.functional.bio.{Mutex2, PrimitivesM2, RefM2}
import izumi.fundamentals.platform.language.Quirks.Discarder
import zio.internal.stacktracer.Tracer
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.{Ref, ZIO}

object PrimitivesMZio extends PrimitivesMZio[Any]

open class PrimitivesMZio[R] extends PrimitivesM2[ZIO[R, +_, +_]] {
  override def mkRefM[A](a: A): ZIO[R, Nothing, RefM2[ZIO[R, +_, +_], A]] = {
    implicit val trace: zio.Trace = Tracer.newTrace

    Ref.Synchronized.make(a).map(RefM2.fromZIO)
  }
  override def mkMutex: ZIO[R, Nothing, Mutex2[ZIO[R, +_, +_]]] = {
    Mutex2.createFromBIO[ZIO[R, +_, +_]]
  }

  disableAutoTrace.discard()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy