Recycler

skunk.util.Recycler
See theRecycler companion object
final case class Recycler[F[_], A](run: A => F[Boolean]) extends A => F[Boolean]

Encapsulates a function that consumes a value and produces a computation that peforms some operation and yields true on success and false on failure. Intended use is with resource pools, where you may wish to do a health check or reset some state when a value is handed back in (or yield false, indicating that the value should be discarded). The only point to this encapsulation is that it allows us to define a monoid!

Attributes

Companion
object
Source
Recycler.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait A => F[Boolean]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def andAlso(other: Recycler[F, A])(implicit ev: Monad[F]): Recycler[F, A]

Compose this Recycler sequentially with other.

Compose this Recycler sequentially with other. The returned Recycler will short-circuit and yield false immediately on failure, without running other. This allows recyclers to fail quickly.

Attributes

Source
Recycler.scala
def apply(a: A): F[Boolean]

Attributes

Source
Recycler.scala
def contramap[B](f: B => A): Recycler[F, B]

Attributes

Source
Recycler.scala
def mapK[G[_]](fk: FunctionK[F, G]): Recycler[G, A]

Attributes

Source
Recycler.scala

Inherited methods

def andThen[A](g: F[Boolean] => A): T1 => A

Attributes

Inherited from:
Function1
def compose[A](g: A => A): A => R

Attributes

Inherited from:
Function1
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1