CoreDSL
Type members
Types
Libretto arrow, also called a ''component'' or a ''linear function''.
┏━━━━━━━━━━┓
┞───┐ ┞───┐
╎ A │ ╎ B │
┟───┘ ┟───┘
┗━━━━━━━━━━┛
In A -⚬ B, we say that the ''in-port'' is of type A and the ''out-port'' is of type B.
Note that the distinction between the in-port and the out-port is only formal. Information or resources
may flow in and out through both the in-port and the out-port.
"Linear" means that each input is ''consumed'' exactly once, in particular, it cannot be ignored or used twice.
A black hole that can absorb (i.e. take over the responsibility to await) Need signals, but from which there is no escape.
No resource. It is the identity element for |*|.
There is no flow of information through a One-typed port.
A black hole that can absorb (i.e. take over the responsibility to await) Done signals, but from which there is no escape.
Choice between A and B.
The consumer chooses whether to get A or B (but can get only one of them).
The producer has to be ready to provide either of them.
Value members
Methods
Races the two Done signals and - produces left if the first signal wins, in which case it returns the second signal that still has to be awaited; - produces right if the second signal wins, in which case it returns the first signal that still has to be awaited. It is biased to the left: if both signals have arrived by the time of inquiry, returns left.
Races two Need signals, i.e. signals traveling in the negative direction (i.e. opposite the -⚬ arrow).
Based on which Need signal from the out-port wins the race,
selects one of the two Need signals from the in-port:
- If the first signal from the out-port wins the race, selects the left signal from the in-port
and pipes to it the remaining (i.e. the right) signal from the out-port.
- If the second signal from the out-port wins the race, selects the right signal from the in-port
and pipes to it the reamining (i.e. the left) signal from the out-port.
It is biased to the left: if both signals from the out-port have arrived by the time of inquiry,
selects the left signal from the in-port.
Signals (in the negative direction) when it is known which side of the choice (A |&| B) has been chosen.