bryanedds / Nu

Repository hosting the open-source Nu Game Engine and related projects.
MIT License
1.13k stars 155 forks source link

Try to figure out some way to enable continuation-style programming with the Elmish API. #415

Closed bryanedds closed 1 month ago

bryanedds commented 1 year ago

The solution would probably involve state monadifying around the 'model with frame advancement via a withSignalsPass : (Signal list * 'model) -> 'model operator.

It's kind of tricky to think about. Maybe some pseudo-code -

this.Message (model, message, _, world) =
  cont {
    let model = Model.op model
    let signal = Command "Abc"
    let! model = withSignalPass signal model // return model on next frame
    let model = Model.op2 model
    return model }
bryanedds commented 1 year ago

To make this work, it looks like it will have to be done in a command context since hooking up the continuation is a side-effect...

bryanedds commented 1 month ago

Closing this as likely infeasible.