fn(sync$0, events$1, index$2, count$3, errors$4, then$5) =>
match @core.list-get(list: $1, index: $2) {
#none(_) =>
$5(summary: {count: $3, errors: $4}),
#some(event$6) =>
$0(
event: $6,
then: fn(error$7) =>
@definy.sync-events-loop(
sync: fn(event$10, then$11) =>
$0(
event: $10,
then: fn(error$12) =>
$11(error: $12)
),
events: $1,
index: @core.plus(left: $2, right: 1),
count: match $7 {
#none(_) =>
@core.plus(left: $3, right: 1),
#some(_) =>
$3
},
errors: match $7 {
#none(_) =>
$4,
#some(message$8) =>
@core.list-append(
list: $4,
item: @std.string-join(items: [$6.event_type, " ", $6.event_hash, ": ", $8], separator: "")
)
},
then: fn(summary$9) =>
$5(summary: $9)
)
)
}