pkamenarsky / synchron

Synchronous programming in Haskell
BSD 3-Clause "New" or "Revised" License
17 stars 1 forks source link

IO action in Syn or Concur #2

Open YuMingLiao opened 1 year ago

YuMingLiao commented 1 year ago

Hi,

I was trying this fascinating package synchron and wondering ... In package concur-replica, I can add IO actions in Widget by liftIO. Could I do this in Syn or Concur in synchron?

It seems in synchron Concur doesn't have StepIO or StepBlock. And Syn doesn't have something like liftIO that return value after an IO action as opposed to async.

related: concur-replica #47 concur Types.hs

YuMingLiao commented 1 year ago

I tried adding StepIO in Syn. But orr is left-biased. In my implementation attempt, any IO action in orr will definitely get finished and then the most left result will be returned. Not sure in Syn.hs how to implement "long-running IO actions which can be canceled by a button" or "show a loading screen while performing IO" in concur documentation.

Note to self: concur-core implementation for orr.

YuMingLiao commented 1 year ago

an event can both be caused and perceived at the same time

advanceIO Or run advanceIO p then pass eid and ios to advanceIO q. If I implement no-bias orr, eid won't be sequential.

YuMingLiao commented 1 year ago

After reviewing the concepts of synchronous and asynchronous, I guess that Syn.hs is for synchronous programming and unbiased orr belongs to Concur.hs.

YuMingLiao commented 1 year ago

Still not sure where a thread-cancellable orr should belong to. Concur.hs here uses STM to step, which leaves IO actions excluded.

YuMingLiao commented 1 year ago

It seems that logical time orr (events) and real time (IO actions) orr should be separated for single responsibility principle. Otherwise this threading or not issue will happen again. Is a combined orr useful? bidding with certain events satisfied? racing cars while needing change tires?