flatMap

fun <A, B> Program<A>.flatMap(f: (A) -> Program<B>): Program<B>(source)

Sequence f after this program. Evaluation timing follows the receiver: on a Program.Done value, f runs immediately at construction; on a suspended or deferred program it is queued and runs during interpretation.