In all releases of typed-protocols so far, the Collect primitive forces the mini protocol client to decide whether it has any possible work to do while waiting for the corresponding reply to arrive in order to react to said arrival. However, it's possible that the mini protocol wants to try to react to that arrival before it happens, and then---still before the arrival---something else changes and now the mini protocol can/should pipeline another message, even before the corresponding reply arrives.
The current Collect signature does not allow for that. If the Maybe were replaced with an STM (Maybe ...), then it could: the driver would race the arrival of the reply against this STM transaction return a continuation.
This signature of CollectSTM in this commit looks similar 2c947f1
In all releases of
typed-protocolsso far, theCollectprimitive forces the mini protocol client to decide whether it has any possible work to do while waiting for the corresponding reply to arrive in order to react to said arrival. However, it's possible that the mini protocol wants to try to react to that arrival before it happens, and then---still before the arrival---something else changes and now the mini protocol can/should pipeline another message, even before the corresponding reply arrives.The current
Collectsignature does not allow for that. If theMaybewere replaced with anSTM (Maybe ...), then it could: the driver would race the arrival of the reply against this STM transaction return a continuation.This signature of
CollectSTMin this commit looks similar 2c947f1