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

scalaprops.internal.Endo.scala Maven / Gradle / Ivy

The newest version!
package scalaprops
package internal

final case class Endo[A](run: A => A) {
  def apply(a: A): A = run(a)

  def compose(other: Endo[A]): Endo[A] = Endo(run compose other.run)

  def andThen(other: Endo[A]): Endo[A] = other compose this
}

object Endo {
  private[this] val id: Endo[Any] = Endo[Any](a => a)
  def idEndo[A]: Endo[A] = id.asInstanceOf[Endo[A]]
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy