I've run into something like the following scenario a couple times (as usual, using s prefix for Stream and c prefix for Cell. A Cell of the same name as a Stream is a hold of that Stream[*])
At first, it's something like this:
-
sAdd: adds an item to a list (starting with emptyList)
-
sEdit: snapshot+modification of cAdd
-
cFinal: snapshot+hold of sEdit
Then I realize that I need to allow more adjustments after cFinal, and also that I need to not lose the new incoming stuff on sAdd, so I use a loop+lift:
-
sAdd: snapshot+concat of cFinal (note: cAdd is sAdd.hold(emptyList))
-
sEdit: snapshot + modification of cAdd
-
sModify: snapshot+modification of cEdit
-
cFinal: CellLoop.loop of cAdd.lift(cModify, merge)
The problem I'm facing is - what if I want to make more adjustments ?
The simple answer is that I keep stuffing more things in that loop. In React-lingo, this would be like "lifting state up"... but this isn't so clean since the adjustments really don't belong in that loop from an organizational point of view.
For example - the core loop might be adjusting position/rotation of all the text items on the screen. Yet a modification might be changing the content of a text item.
Okay - arguably everything should be stuffed in that loop... but I dunno... any advice is appreciated!
[*] Side-point, it may be useful to pin a list of idioms like these to ease discussion on the forum