const it = morningRobot();
await(it.next());
function * morningRobot() {
let snooze = yield robot.setAlarm('7:00');
while (snooze) {
snooze = yield robot.snooze();
}
yield robot.makeBreakfast();
yield robot.brushMyTeeth();
}
function await(next) {
if (next.done) {
return;
}
next.value.then(response => {
await(it.next(response))
});
}