All Downloads are FREE. Search and download functionalities are using the official Maven repository.

data.State.kt Maven / Gradle / Ivy

The newest version!
package nl.sanderdijkhuis.noise.data

/** Provides a functional approach to handling protocol state. */
data class State(val value: S, val result: A) {

    fun map(f: (A) -> B) = State(value, f(result))

    @Suppress("UNCHECKED_CAST")
    fun state(): T? = value as? T
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy