Would need to be tested, but I think this variadic JS function would work as an implementation. It’s not exactly pretty.
const combineImpl = (...results) => {
let result;
for (const [data, loading, error] of results) {
if (loading) return "Loading";
if (result === "Unknown" || result?.TAG === "Error") continue;
if (error) result = { TAG: "Error", _0: error };
else if (data === undefined) result = "Unknown";
else if (result?.TAG === "Data") result._0.push(data);
else result = { TAG: "Data", _0: [data] };
}
return result ?? "Unknown";
};