kafka-flow
kafka-flow copied to clipboard
Minimize custom code in `Fold`
trafficstars
Right now Fold contains a lot of custom code and syntax to make constructing and combining Fold instances easier. It may make understanding of the whole library harder, because one will have to learn a domain specific language.
The idea is to investigate prior art and reuse as much syntax as possible for Fold. I.e. Fold is actually Kleisli[F, (S, A), S], so monad syntax could be reused from it etc. The key idea could be making a less restrictive type such as IndexedFold[F, (S1, A), S2] and then reuse functionality from Kleisli to define methods for original Fold[F, S, A].
See also similar structure here: https://github.com/notxcain/aecor/blob/master/modules/core/src/main/scala/aecor/data/Fold.scala