本文整理匯總了TypeScript中@jonggrang/prelude.maybe函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript maybe函數的具體用法?TypeScript maybe怎麽用?TypeScript maybe使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了maybe函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
jsv.number, jsv.number, (im, k, v1, v2) =>
P.maybe(
false,
v3 => v3 === (v1 + v2),
IM.lookup(
k,
IM.alter(mv => P.just(P.maybe(v2, v3 => v3 + v2, mv)), k, IM.insert(k, v1, im))))
示例2: intMapArb
jsv.property('alter can be used for insert', intMapArb(jsv.number), jsv.integer, jsv.number, (im, k, v) =>
P.maybe(
false,
v2 => v === v2,
IM.lookup(
k,
IM.alter(m => P.altMaybe(m, P.just(v)), k, IM.remove(k, im))
)
)
示例3: co
return co(function* () {
yield takeAVar(needsRunning);
const a: A = yield maybe(set.task, identity, applyMaybe(modify, ma)) as Task<A>;
yield writeRef(currRef, right(a));
yield putAVar(responseVar, a);
yield delay(set.delay);
const responseVar_: AVar<A> = yield newEmptyAVar;
yield writeRef(currRef, left(responseVar_));
return loop(responseVar_, just(a));
});
示例4: alter
return alter(mb => P.maybe(P.nothing, f, mb), k, m);