【发布时间】:2023-03-10 10:41:01
【问题描述】:
我正在寻找具有此行为的 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,
])
找不到对应的函数in the documentation of Option here。
【问题讨论】:
标签: typescript fp-ts