Option

scalus.prelude.Option
See theOption companion enum
object Option

Attributes

Companion
enum
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Option.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

inline def apply[A](x: A): Option[A]

Constructs an Option from a value. If the value is null, it returns None, otherwise Some(value).

Constructs an Option from a value. If the value is null, it returns None, otherwise Some(value).

Attributes

inline def empty[A]: Option[A]

Givens

Givens

given optionEq[A](using eq: () => A): () => Option[A]
given optionToData[A : ToData]: ToData[Option[A]]

Extensions

Extensions

extension [A](self: Option[A])
def asScala: Option[A]

Converts an Option to a scala.Option

Converts an Option to a scala.Option

Attributes

def contains[B >: A](elem: B)(using eq: () => B): Boolean
def exists(p: A => Boolean): Boolean
def filter(predicate: A => Boolean): Option[A]
def filterNot(predicate: A => Boolean): Option[A]
inline def find(p: A => Boolean): Option[A]
def flatMap[B](mapper: A => Option[B]): Option[B]
def forall(p: A => Boolean): Boolean
def get: A
def getOrElse[B >: A](default: B): B
inline def getOrFail(inline message: String): A
inline def isDefined: Boolean
def isEmpty: Boolean
def map[B](mapper: A => B): Option[B]
inline def nonEmpty: Boolean
def orElse[B >: A](alternative: Option[B]): Option[B]
infix inline def orFail(inline message: String): Unit
extension [A](self: Option[Option[A]])
def flatten: Option[A]
extension [A](self: Option[A])
def asScalus: Option[A]

Converts a scala.Option to an Option

Converts a scala.Option to an Option

Attributes