Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
@Isaac Shapira is there some place where one can read more about motivation for Continuation m a's shape and interpretation? Because this behaviour of state change throughout nested stages can be a little bit mind-bending :sweat_smile:
Continuation m a
Ultimately you shouldn't have to worry about it in practice
@TheMatten it's what makes updates atomic. The idea is all updates are continuations, and we can evaluate all of them at once until we have a single function Model -> Model that we can apply to update the rendered view.
Model -> Model
You can still foot gun yourself if you mix up the view state with the incremental update state, but overall Continuation eliminates most of the common foot guns you would expect with concurrency in a UI.
@Isaac Shapira I'm just curious - and wonder whether it would be possible to port it into Purescript (if you wouldn't mind of course :smile: )
What I find interesting is first field of tuple in Continuation constructor specifically - is it simply an optimization, or does putting wrapped update into second, monadic field change it's behaviour in some way?
@TheMatten it's not a Monad. If you want a Shpadoinkle PureScript, it's been on the roadmap forever. I could use help, and I would be happy to direct you.
Consider joining my Zulip if you want to get your hands dirty.
@Isaac Shapira Yeah, I mean m in Continuation m a
Oh, cool, I can try it - what's the link to the Zulip instance?
@TheMatten the m in practice is typically a Monad in which on can perform effects in response to user action.
@Isaac Shapira Thanks!
Sorry, I probably wasn't totally clear - what I mean is that I'm wondering, whether there's possible difference between using first or second field of Continuation (a -> a, a -> m (Continuation m a)) constructor, or whether it's simply an optimization to collect as many pure functions in advance as possible
Continuation (a -> a, a -> m (Continuation m a))
@TheMatten it's that you may have both! A pure update and one that results from a side effect
@TheMatten If you join my Zulip you can speak with the author of this abstraction directly