harness.core.Lazy.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of harness-core_sjs1_3 Show documentation
Show all versions of harness-core_sjs1_3 Show documentation
Miscellaneous libraries/utilities for Scala.
The newest version!
package harness.core
final class Lazy[A](_value: => A) {
lazy val value: A = _value
def map[B](f: A => B): Lazy[B] = Lazy(f(value))
def flatMap[B](f: A => Lazy[B]): Lazy[B] = Lazy(f(value)).flatten
def flatten[B](implicit ev: A <:< Lazy[B]): Lazy[B] = Lazy(ev(value).value)
override def toString: String = s"Lazy($value)"
}
object Lazy {
def apply[A](value: => A): Lazy[A] = new Lazy[A](value)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy