toggl / komposable-architecture

🏗️ Kotlin implementation of Point-Free's composable architecture
Apache License 2.0
280 stars 20 forks source link

Move away from Mutable<T> and return State + Effect(s) instead #56

Closed semanticer closed 1 year ago

semanticer commented 1 year ago

Description

The original decision behind Mutable<T> was made to maintain syntactical similarity with iOS. We agreed this is not necessary, and we'd prefer to make things simpler.

fun reduce(state: Mutable<State>, action: Action): List<Effect<Action>>
// into 
fun reduce(state: State, action: Action): ResultOrSomething<State, List<Effect<Action>>>

after https://github.com/toggl/komposable-architecture/issues/51 it should become

fun reduce(state: State, action: Action): ResultOrSomething<State, Effect<Action>>

Let's make sure we can do the transition as painless as possible, let's provide @Deprecated if it makes sense

Definition of done