commonMain.arrow.optics.dsl.at.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of arrow-optics-jvm Show documentation
Show all versions of arrow-optics-jvm Show documentation
Functional companion to Kotlin's Standard Library
package arrow.optics.dsl
import arrow.optics.Fold
import arrow.optics.Getter
import arrow.optics.Iso
import arrow.optics.Lens
import arrow.optics.Optional
import arrow.optics.Prism
import arrow.optics.Setter
import arrow.optics.Traversal
import arrow.optics.typeclasses.At
/**
* DSL to compose [At] with a [Lens] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Lens] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Lens] with a focus in [A] at given index [I].
*/
public fun Lens.at(AT: At, i: I): Lens = this.compose(AT.at(i))
/**
* DSL to compose [At] with an [Iso] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Iso] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Lens] with a focus in [A] at given index [I].
*/
public fun Iso.at(AT: At, i: I): Lens = this.compose(AT.at(i))
/**
* DSL to compose [At] with a [Prism] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Prism] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Optional] with a focus in [A] at given index [I].
*/
public fun Prism.at(AT: At, i: I): Optional = this.compose(AT.at(i))
/**
* DSL to compose [At] with an [Optional] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Optional] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Optional] with a focus in [A] at given index [I].
*/
public fun Optional.at(AT: At, i: I): Optional = this.compose(AT.at(i))
/**
* DSL to compose [At] with a [Getter] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Getter] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Getter] with a focus in [A] at given index [I].
*/
public fun Getter.at(AT: At, i: I): Getter = this.compose(AT.at(i))
/**
* DSL to compose [At] with a [Setter] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Setter] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Setter] with a focus in [A] at given index [I].
*/
public fun Setter.at(AT: At, i: I): Setter = this.compose(AT.at(i))
/**
* DSL to compose [At] with a [Traversal] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Traversal] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Traversal] with a focus in [A] at given index [I].
*/
public fun Traversal.at(AT: At, i: I): Traversal = this.compose(AT.at(i))
/**
* DSL to compose [At] with a [Fold] for a structure [S] to focus in on [A] at given index [I].
*
* @receiver [Fold] with a focus in [S]
* @param AT [At] instance to provide a [Lens] to zoom into [S] at [I]
* @param i index [I] to zoom into [S] and find focus [A]
* @return [Fold] with a focus in [A] at given index [I].
*/
public fun Fold.at(AT: At, i: I): Fold = this.compose(AT.at(i))
© 2015 - 2025 Weber Informatics LLC | Privacy Policy