You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IOSim is essentially a free monad, one of its operations allows to run ST actions, that would fit into PrimBase, but how would you embed all the other actions into it?
We could just implement keepAlive, although it's non-trivial. It would require implementing schedule function which can halt and resume:
classMonadKeepAlivemwherekeepAlive::a->mr->mrdataSimAsawhere
...
KeepAlive::a->IOSimsr-> (r->SimAsb) ->SimAsb
...
schedule::_
schedule thread@Thread { threadControl =ThreadControl action ctl },
simstate =case action ofKeepAlive a mr k ->do
keepAlive a (_ {- here we want to schedule `mr` -})
_continue {- here we want to continue with `k` -}
Currently, schedule doesn't allow for something like that. It runs the simulation until completion, while we need some sort of scheduling an IOSim computation in a given computation context. Hopefully, this doesn't become more challenging for IOSimPOR.
Activity
coot commentedon Jul 4, 2025
IOSimis essentially a free monad, one of its operations allows to runSTactions, that would fit intoPrimBase, but how would you embed all the other actions into it?jorisdral commentedon Jul 7, 2025
Right, I posted it here partially to get your input on whether it would be possible. I suppose it isn't, so let's close this issue!
coot commentedon Jul 9, 2025
We could just implement
keepAlive, although it's non-trivial. It would require implementingschedulefunction which can halt and resume:Currently,
scheduledoesn't allow for something like that. It runs the simulation until completion, while we need some sort of scheduling anIOSimcomputation in a given computation context. Hopefully, this doesn't become more challenging forIOSimPOR.coot commentedon Jul 9, 2025
Hmm, another idea would be to implement
keepAliveusingtouch. For it we'd need to push a new kind of frame to theControlStack.jorisdral commentedon Jul 9, 2025
I currently don't immediately have a need for
keepAlivemyself, but I can imagine it might be nice to have. It was more intended as an examplecoot commentedon Jul 9, 2025
I'm not sure if it has the correct semantics with regards to exceptions (or that it works correctly), but here's a proof of concept: https://github.com/input-output-hk/io-sim/compare/coot/keepAlive