sunroof-compiler-0.2: Monadic Javascript Compiler

Safe HaskellNone



JSChan provides the same functionality and concurrency abstraction in Javascript computations as Chan in Haskell.



data JSChan a Source

JSChan abstraction. The type parameter gives the type of values held in the channel.


SunroofArgument o0 => Show (JSChan o0) 
SunroofArgument o0 => IfB (JSChan o0) 
SunroofArgument o => EqB (JSChan o)

Reference equality, not value equality.

SunroofArgument o0 => Sunroof (JSChan o0) 
SunroofArgument o0 => JSTuple (JSChan o0) 

newChan :: SunroofArgument a => JS t (JSChan a)Source

Create a new empty JSChan.

writeChan :: forall t a. (SunroofThread t, SunroofArgument a) => a -> JSChan a -> JS t ()Source

Put a value into the channel. This will never block.

readChan :: forall a. (Sunroof a, SunroofArgument a) => JSChan a -> JS B aSource

Take a value out of the channel. If there is no value inside, this will block until one is available.