fn(texts$0, language$1, text$2) =>
let replaced$3 = @core.list-fold(
T: @core.localized-text,
A: Record{found: Boolean, items: List<@core.localized-text>},
reducer: fn(acc$4, item$5) =>
match @core.equal(left: $5.language, right: $1) {
true =>
match @core.or(left: $4.found, right: @core.equal(left: $2, right: "")) {
true =>
$4,
false =>
{found: true, items: @core.list-append(list: $4.items, item: {language: $1, text: $2})}
},
false =>
{found: $4.found, items: @core.list-append(list: $4.items, item: $5)}
},
init: {found: false, items: []},
xs: $0
);
match @core.or(left: $3.found, right: @core.equal(left: $2, right: "")) {
true =>
$3.items,
false =>
@core.list-append(list: $3.items, item: {language: $1, text: $2})
}