commonMain.arrow.optics.dsl.either.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of arrow-optics Show documentation
Show all versions of arrow-optics Show documentation
Functional companion to Kotlin's Standard Library
The newest version!
package arrow.optics.dsl
import arrow.core.Either
import arrow.optics.Lens
import arrow.optics.Optional
import arrow.optics.PPrism
import arrow.optics.Prism
import arrow.optics.Traversal
/**
* DSL to compose a [Prism] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]>
*
* @receiver [Prism] with a focus in [Either]
* @return [Prism] with a focus in [L]
*/
public inline val Prism>.left: Prism inline get() = this.compose(PPrism.left())
/**
* DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]>
*
* @receiver [Lens] or [Optional] with a focus in [Either]
* @return [Optional] with a focus in [L]
*/
public inline val Optional>.left: Optional inline get() = this.compose(PPrism.left())
/**
* DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]>
*
* @receiver [Traversal] with a focus in [Either]
* @return [Traversal] with a focus in [L]
*/
public inline val Traversal>.left: Traversal inline get() = this.compose(PPrism.left())
/**
* DSL to compose a [Prism] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]>
*
* @receiver [Prism] with a focus in [Either]
* @return [Prism] with a focus in [R]
*/
public inline val Prism>.right: Prism inline get() = this.compose(PPrism.right())
/**
* DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]>
*
* @receiver [Lens] or [Optional] with a focus in [Either]
* @return [Optional] with a focus in [R]
*/
public inline val Optional>.right: Optional inline get() = this.compose(PPrism.right())
/**
* DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]>
*
* @receiver [Traversal] with a focus in [Either]
* @return [Traversal] with a focus in [R]
*/
public inline val Traversal>.right: Traversal inline get() = this.compose(PPrism.right())
© 2015 - 2025 Weber Informatics LLC | Privacy Policy