You have a sequence of actions that prefer to be performed in chunks due to some highly reliable overhead, such as packet headers or connections. The limit is that sometimes the next action depends on the result of the previous one, in which case all pending actions are performed immediately.
Example:
mySession :: Session IO ()
a <- readit -- nothing happens yet
b <- readit -- nothing happens yet
c <- readit -- nothing happens yet
if a -- all three readits execute because we need a
then write "a"
else write "..."
if b || c -- b and c already available
...
It reminds me of so many Haskell concepts, but I can't put it on it.
Of course, you could do something obvious, like:
[a,b,c] <- batch([readit, readit, readit])
But I would like to hide the fact of chunking from the user for use.
Not sure if Session is the right word. Maybe you can offer the best? (Packet, Batch, Chunk, and Deferred come to mind.)
Update
, , , , , . ?