
commonMain.io.lamart.lux.focus.FocusedOptional.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.core.Either
import arrow.optics.Optional
import arrow.optics.Setter
import io.lamart.lux.Mutable
interface FocusedOptional : Focused, FocusedSetter {
val optional: Optional
fun getOrModify(): Either = optional.getOrModify(source.get())
fun compose(other: Optional): FocusedOptional {
val optional = [email protected](other)
return object : FocusedOptional {
override val source: Mutable = [email protected]
override val optional: Optional = optional
override val setter: Setter = optional
}
}
operator fun plus(other: Optional) = compose(other)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy