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

scalaz.effect.FinalizerHandle.scala Maven / Gradle / Ivy

package scalaz
package effect

/**
 * A handle to a finalizer that allows you to duplicate it to a parent region using "dup".
 * Duplicating a finalizer means that instead of being performed when the current region
 * terminates, it is performed when the parent region terminates.
 */
sealed abstract class FinalizerHandle[R[_]] {
  val finalizer: RefCountedFinalizer
}

object FinalizerHandle {
  def apply[R[_]](r: RefCountedFinalizer): FinalizerHandle[R] = finalizerHandle[R](r)

  def finalizerHandle[R[_]](r: RefCountedFinalizer): FinalizerHandle[R] =
    new FinalizerHandle[R] {
      val finalizer = r
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy