Renaming "Reducer" to "ActionHandler" for clarity

The Elm Architecture is based on exactly same concepts. Where the Reducer is called * Update — a way to update your state based on messages.

I feel StateUpdater (or just Updater) would be a better fit than ActionHandler.

2 Likes

FWIW in Haskell reduce is called foldl (with its counterpart foldr, which reduces in the opposite direction), and types that implement it are called Foldable. Unfortunately, it's not possible to express Foldable (or Reduceable) protocol in Swift due to limitations of its type system.

And given the long history of this concept in FP, "Fold" name could've become more prevalent, but it looks like "Reduce" won as a name when MapReduce became popular in big data in early 2010s.

7 Likes

Please keep Reducer +1, from my view, the terminologies in TCA are clear and easy to understand, especially when I have worked on several other Redux-like frameworks, those conceptions from pure functional programming are great to explain themselves.

1 Like

With the latest changes in the current beta of TCA, finally, the type Reducer (temporarily named ReducerProtocol) is becoming what I always thought it to be: "A wrapper type for a reduce function."

This new beta fixes so many issues all at once. :heart: I'm really looking forward to trying it out!

2 Likes

But it's a wrapper for a reduce function which doesn't seem to actually do what reduce functions typically do. Nothing is getting smaller.

It appears to be a state transition function.

1 Like

Just to mention, I think that the ReducerProtocol - released on TCA lib version 0.43.0 - kind of encapsulates with a better coherence the concepts of state, action, reduce and also the feature domain store.