Channel (Function)

Signature: Channel(capacity: int) -> Channel<t0>

Description: Creates a buffered channel with a positive capacity.

Parameters

  • capacity (int): Positive number of buffered values

Returns: Channel<t0>

Example

fn receive(channel) = recv(channel)
let channel = Channel(1)
let worker = spawn receive(channel)
send(channel, 42)
print(await(worker))
receive channel = recv channel
channel = Channel 1
worker = spawn receive channel
send channel 42
print (await worker)