Result

kyo.Result$package.Result
opaque object Result

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Result.type

Members list

Type members

Classlikes

sealed abstract class Error[+E]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Fail[E]
class Panic
case class Fail[+E](error: E) extends Error[E]

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Error[E]
class Object
trait Matchable
class Any
Show all
object Fail

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Fail.type
case class Panic(exception: Throwable) extends Error[Nothing]

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Error[Nothing]
class Object
trait Matchable
class Any
Show all
object Panic

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Panic.type
object Success

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Success.type

Types

opaque type Success[+A]

Value members

Concrete methods

inline def apply[A](inline expr: => A): Result[Nothing, A]
inline def attempt[A](inline expr: => A): Result[Throwable, A]
inline def fail[E, A](inline error: E): Result[E, A]
def fromEither[E, A](either: Either[E, A]): Result[E, A]
def fromTry[A](t: Try[A]): Result[Throwable, A]
inline def panic[E, A](inline exception: Throwable): Result[E, A]
inline def success[E, A](inline value: A): Result[E, A]
def unit[E]: Result[E, Unit]

Givens

Givens

given given_CanEqual_Result_Panic[E, A]: CanEqual[Result[E, A], Panic]
inline given given_CanEqual_Result_Result[E, A](using inline ce: CanEqual[A, A]): CanEqual[Result[E, A], Result[E, A]]

Extensions

Extensions

extension [E](self: Error[E])
def exception(using ev: E <:< Throwable): Throwable
extension [E, A](self: Result[E, A])
def failure: Maybe[E]
inline def filter(inline p: A => Boolean): Result[E | NoSuchElementException, A]
inline def flatMap[E2, B](inline f: A => Result[E2, B]): Result[E | E2, B]
def flatten[E2, B](using ev: A <:< Result[E2, B]): Result[E | E2, B]
inline def fold[B](inline ifFailure: Error[E] => B)(inline ifSuccess: A => B): B
def get(using ev: E =:= Nothing): A
inline def getOrElse[B >: A](inline default: => B): B
def getOrThrow(using ev: E <:< Throwable): A
def isFail: Boolean
def isPanic: Boolean
def isSuccess: Boolean
inline def map[B](inline f: A => B): Result[E, B]
def orElse[E2, B >: A](alternative: => Result[E2, B]): Result[E | E2, B]
def panic: Maybe[Throwable]
inline def recover[B >: A](pf: PartialFunction[Error[E], B]): Result[E, B]
inline def recoverWith[E2, B >: A](pf: PartialFunction[Error[E], Result[E2, B]]): Result[E | E2, B]
def show: String
def swap: Result[A, E]
def toEither: Either[E | Throwable, A]
def toMaybe: Maybe[A]
def toTry(using ev: E <:< Throwable): Try[A]
def value: Maybe[A]
inline def withFilter(inline p: A => Boolean): Result[E | NoSuchElementException, A]