Optional

smithy4s.optics.Optional
trait Optional[S, A]

Optional can be seen as the weak intersection between a Lens and a Prism. It contains the same replace function as a Lens and the same project function of a Prism.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Lens[S, A]
trait Prism[S, A]
Self type
Optional[S, A]

Members list

Value members

Abstract methods

def project(s: S): Option[A]

Returns a Some of A from S if it is able to obtain an A. Else returns None.

Returns a Some of A from S if it is able to obtain an A. Else returns None.

Attributes

def replace(a: A): S => S

Provides a function to replace the target of the Lens

Provides a function to replace the target of the Lens

Attributes

Concrete methods

final def andThen[A0](that: Optional[A, A0]): Optional[S, A0]

Compose this Optional with another Optional.

Compose this Optional with another Optional.

Attributes

def modify(f: A => A): S => S

Modify the target of the Optional with a function from A => A

Modify the target of the Optional with a function from A => A

Attributes

def some[A0](implicit ev1: A =:= Option[A0]): Optional[S, A0]

Allows abstracting over an optional target by pointing to the inside of the optional value (the value inside of the Some).

Allows abstracting over an optional target by pointing to the inside of the optional value (the value inside of the Some).

Attributes

def value[A0](implicit bijection: Bijection[A0, A]): Optional[S, A0]

Helper function for targeting the value inside of a smithy4s.Newtype or other type with an implicit Bijection available.

Helper function for targeting the value inside of a smithy4s.Newtype or other type with an implicit Bijection available.

Attributes