我正在寻找fp-ts
具有这种行为的函数:
function compute1(arg: number): Option<number>;
function compute2(arg: number): Option<number>;
function compute3(arg: number): Option<number>;
function compute(arg: number): Option<number> {
const first = compute1(arg)
if (isSome(first)) return first
const second = compute2(arg)
if (isSome(second)) return second
const third = compute3(arg)
if (isSome(third)) return third
return none
}
// For example I am looking for this `or` function:
const compute = or([
compute1,
compute2,
compute3,
])
我无法在此处的文档中Option
找到相应的功能。