harness.core.OptionEitherOps.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
extension [A](self: Option[A]) {
def cata[B](none: => B, some: A => B): B =
self match {
case Some(o) => some(o)
case None => none
}
}
extension [A, B](self: Either[A, B]) {
def cata[C](left: A => C, right: B => C): C =
self match {
case Right(value) => right(value)
case Left(value) => left(value)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy