fn(project_name$0, branch$1, creator_account_id$2, latest_event_hash$3, records$4, merges$5) =>
let explicit$6 = @core.list-fold(
T: @core.branch-status-record,
A: Union{#none, #some(@core.branch-status-record)},
reducer: fn(acc$7, item$8) =>
match @core.and(
left: @core.and(
left: @core.equal(left: $8.change.project_name, right: $0),
right: @core.equal(left: $8.change.branch, right: $1)
),
right: @core.equal(left: $8.account_id, right: $2)
) {
false =>
$7,
true =>
match $7 {
#none(_) =>
#some($8),
#some(found$9) =>
match @core.less-than(left: $9.time, right: $8.time) {
true =>
#some($8),
false =>
$7
}
}
},
init: #none,
xs: $4
);
let merged$10 = @core.list-fold(
T: @core.branch-merge,
A: Union{#none, #some(Number)},
reducer: fn(acc$11, item$12) =>
match @core.and(
left: @core.equal(left: $12.project_name, right: $0),
right: @core.equal(left: $12.merged_commit_hash, right: $3)
) {
false =>
$11,
true =>
match $11 {
#none(_) =>
#some($12.time),
#some(time$13) =>
match @core.less-than(left: $12.time, right: $13) {
true =>
#some($12.time),
false =>
$11
}
}
},
init: #none,
xs: $5
);
match $10 {
#none(_) =>
match $6 {
#none(_) =>
#in_progress<@core.branch-status>,
#some(record$14) =>
$14.change.status
},
#some(merged_time$15) =>
match $6 {
#none(_) =>
#done<@core.branch-status>,
#some(record$16) =>
match @core.less-than(left: $16.time, right: $15) {
true =>
#done<@core.branch-status>,
false =>
$16.change.status
}
}
}