Shpadoinkle - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

TheMatten

@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:

Isaac Shapira

Ultimately you shouldn't have to worry about it in practice

Isaac Shapira

@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.

Isaac Shapira

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.

TheMatten

@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?

Isaac Shapira

@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.

Isaac Shapira

Consider joining my Zulip if you want to get your hands dirty.

TheMatten

@Isaac Shapira Yeah, I mean m in Continuation m a
Oh, cool, I can try it - what's the link to the Zulip instance?

Isaac Shapira

shpadoinkle.zulipchat.com @TheMatten

Explore the frontend frontier. And have fun doing it.
Isaac Shapira

@TheMatten the m in practice is typically a Monad in which on can perform effects in response to user action.

TheMatten

@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

Isaac Shapira

@TheMatten it's that you may have both! A pure update and one that results from a side effect

Isaac Shapira

@TheMatten If you join my Zulip you can speak with the author of this abstraction directly