Companion

object Companion

Functions

Link copied to clipboard
fun <S> codiagonal(): Optional<Either<S, S>, S>

POptional that takes either S or S and strips the choice of S.

Link copied to clipboard
fun <S> POptional.Companion.filter(predicate: (S) -> Boolean): Optional<S, S>

Focuses on the value only if the predicate is true. This optics The optic is perfectly OK when used to get values using getOrNull or getAll; but requires some caution using modify with it.

Link copied to clipboard
fun <S> id(): Iso<S, S>
Link copied to clipboard
operator fun <S, T, A, B> invoke(getOrModify: (source: S) -> Either<T, A>, set: (source: S, focus: B) -> T): POptional<S, T, A, B>

Invoke operator overload to create a POptional of type S with focus A. Can also be used to construct Optional

Link copied to clipboard

Optional to safely operate on the head of a list

Link copied to clipboard

Optional to safely operate on the tail of a list

Link copied to clipboard

Optional to safely operate in a nullable value.

Link copied to clipboard

Optional to safely operate in a nullable value.

Link copied to clipboard
fun <A, B> void(): Optional<A, B>

POptional that never sees its focus