sunroof-compiler-0.2: Monadic Javascript Compiler

Safe HaskellNone



Provides common combinators for concurrency in Javascript.

The emulated threading Javascript threading model provided by Sunroof is based on cooperative multithreading (since Javascript is not multithreaded).



loop :: Sunroof a => a -> (a -> JSB a) -> JSB ()Source

loop x f executes the function f repeatedly. After each iteration the result value of the function is feed back as input of the next iteration. The initial value supplied for the first iteration is x. This loop will never terminate.

forkJS :: SunroofThread t1 => JS t1 () -> JS t2 ()Source

Fork of the given computation in a different thread.

threadDelay :: JSNumber -> JSB ()Source

Delay the execution of all instructions after this one by the given amount of milliseconds.

yield :: JSB ()Source

Give another thread time to execute.