zio.blocks.maybe

Members list

Type members

Classlikes

object Absent

Top-level singleton representing absence. case Absent matches via a stable-identifier pattern; both plain objects and case objects qualify as stable identifiers, so a plain object is used simply to avoid implying an Absent() extractor.

Top-level singleton representing absence. case Absent matches via a stable-identifier pattern; both plain objects and case objects qualify as stable identifiers, so a plain object is used simply to avoid implying an Absent() extractor.

Attributes

Source
Maybe.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Absent.type
case object BuildInfo

This object was generated by sbt-buildinfo.

This object was generated by sbt-buildinfo.

Attributes

Source
BuildInfo.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
BuildInfo.type
object Maybe

Attributes

Source
Maybe.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Maybe.type

Attributes

Source
MaybeCompat.scala
Supertypes
class Object
trait Matchable
class Any
trait MaybeSyntax[A]

Attributes

Source
MaybeSyntax.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Source
MaybeSyntax.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait MaybeCompat
final class Present[+A](val value: A)

Wraps a value so that "present of absent" is distinguishable from absent.

Wraps a value so that "present of absent" is distinguishable from absent.

Maybe[+A] is an opaque type alias for A | Absent.type | Present[A]. A plain non-absent value of type A is a present Maybe[A] with zero allocation; the Absent singleton is Maybe.absent; and Present(a) is a present Maybe[A] whose value is a — used to represent "present of absent" in nested Maybes (e.g. Maybe.present(Maybe.absent)), which a bare Absent cannot express.

NOTE on soundness: Maybe.present (and only present) wraps a user-supplied Present[_] argument in an extra Present layer (present(Present(x)) == Present(Present(x))). This ensures unsafeGet (used by codecs) returns the correct inner Present(x) without double-unwrapping. The public case Present(v) / case Absent matching idiom is unaffected.

Attributes

Companion
object
Source
Maybe.scala
Supertypes
class Object
trait Matchable
class Any
object Present

Attributes

Companion
class
Source
Maybe.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Present.type

Types

opaque type Maybe[+A]

Attributes

Source
Maybe.scala

Inherited types

Attributes

Inherited from:
MaybeCompat
Source
MaybeCompat.scala