Files
pork/compiler/src/main/kotlin/gay/pizza/pork/compiler/ComputableState.kt

8 lines
197 B
Kotlin

package gay.pizza.pork.compiler
class ComputableState<X, T>(val computation: (X) -> T) {
private val state = StoredState<X, T>()
fun of(key: X): T = state.computeIfAbsent(key, computation)
}