public static Process <T> RepeatUntil <T>(this Process <T> p, Func <bool> predicate) { return(p.Concat(() => predicate() ? new Halt <T>(End.Only) : p.RepeatUntil(predicate))); }
public static Process <T> While <T>(this Process <T> p, Func <bool> predicate) { return(Await <T> .Create(predicate, either => either.Match( left: e => new Halt <T>(e), right: b => b ? p.Concat(() => p.While(predicate)) : new Halt <T>(End.Only)))); }
public static Process <T> Repeat <T>(this Process <T> p1) { return(p1.Concat(p1.Repeat)); }