
Hi Julian, how are you??
Yes I've looked into amb. In practice I have no problem with the back-end
implementation, I just wanted to provide a nice front-end for my DSL.
I wonder if there is a way to generalize the concept, especially in the
case with events of different types running in parallel:
ShortcutEvents :: [Event a] -> ([Maybe a] -> Maybe b) -> Event b
ShortcutEvents2 :: [Event a] -> [Event b] -> ([Maybe a] -> [Maybe b] ->
Maybe c) -> Event c
ShortcutEventsX ...
My use case is the voting system of Nomyx, for which I need to run in
parallel all the players votes plus a timer.
Cheers
Corentin
On Mon, Sep 8, 2014 at 1:01 PM, Julian K. Arni
Are you looking for something like amb/unamb? [0] In particular, if you look at the comments in the source for 'race', it should be pretty intuitive how to go from there to "run x computations, kill the remaining ones after y return". You just need to fiddle with the MVar, possibly adding another thread and MVar that represents whether the calculation can already be completed.
[0] https://hackage.haskell.org/package/unamb-0.2.5/docs/src/Data-Unamb.html#amb