
me.aartikov.sesame.loop.Next.kt Maven / Gradle / Ivy
package me.aartikov.sesame.loop
/**
* Represents an output of [Reducer]. Contains new state and side effects. Null state means no changes.
*/
data class Next(val state: StateT?, val effects: List)
/**
* Helper method to create [Next]
*/
fun next(state: StateT, vararg effects: EffectT?): Next {
return Next(state, effects.toList().filterNotNull())
}
fun next(state: StateT): Next {
return Next(state, emptyList())
}
fun effects(vararg effects: EffectT?): Next {
return Next(null, effects.toList().filterNotNull())
}
fun nothing(): Next {
return Next(null, emptyList())
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy