
commonMain.io.lamart.lux.focus.FocusedSetter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lux-jvm Show documentation
Show all versions of lux-jvm Show documentation
Shiny state management for Kotlin, Android & iOS
package io.lamart.lux.focus
import arrow.optics.Setter
import io.lamart.lux.Mutable
interface FocusedSetter : Focused {
val setter: Setter
fun set(focus: A) = source.modify { setter.set(it, focus) }
fun modify(map: (focus: A) -> A) = source.modify { setter.modify(it, map) }
fun compose(other: Setter): FocusedSetter {
return object : FocusedSetter {
override val source: Mutable = [email protected]
override val setter: Setter = [email protected](other)
}
}
operator fun plus(other: Setter) = compose(other)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy