role APlus {
method andthen(&block) {
nextwith -> Promise $p {
my \res = block $p.result;
do if res ~~ Awaitable {
await res
} else {
res
}
}
}
}
sub a-start(&block) { (start block) does APlus }
say await (a-start { 1 }).andthen(-> Int $i { a-start { $i + 1 }})