本文整理汇总了TypeScript中@jonggrang/prelude.list类的典型用法代码示例。如果您正苦于以下问题:TypeScript list类的具体用法?TypeScript list怎么用?TypeScript list使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了list类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
function listForInPar_<A, B>(xs: P.list.List<A>, fn: (_: A) => T.Task<B>): T.Task<void> {
return P.list.foldr((a, b) => T.apSecond(fn(a).parallel(), b), T.Parallel.of(void 0), xs).sequential();
}
开发者ID:syaiful6,项目名称:jonggrang,代码行数:3,代码来源:fd-cache.ts
示例2: getMockOperation
it('saveSession can replace old session with new one', async function () {
const storage = await T.toPromise(emptyMockStorage);
const state = SS.createServerSessionState(storage);
const m1 = { a: 'b' };
const sess1 = await T.toPromise(SS.saveSession(state, { sess: null, now: fakenow }, m1));
const m2 = SO.insert(state.authKey, 'John', m1);
const sess2 = await T.toPromise(SS.saveSession(state, { sess: sess1, now: fakenow }, m2));
const m3 = SO.insert(SS.forceInvalidateKey, SS.ForceInvalidate.ALL_SESSION_IDS_OF_LOGGED_USER, m2 as any);
const sess3 = await T.toPromise(SS.saveSession(state, { sess: sess2, now: fakenow }, m3));
await getMockOperation(storage);
const m4 = SO.insert('x', 'y', m2);
const sess4 = await T.toPromise(SS.saveSession(state, { sess: sess3, now: fakenow }, m4));
assert.deepEqual(sess4, SO.assign({}, sess3, { data: SO.remove(state.authKey, m4) }));
const op = await getMockOperation(storage);
assert.deepEqual(op, L.fromArray([
{ tag: 'replace', session: sess4 }
]));
});
开发者ID:syaiful6,项目名称:jonggrang,代码行数:25,代码来源:server-session.ts
示例3: go
function go(xs: L.List<[number, L.List<A>]>, acc: L.List<[number, L.List<A>]>): T.Task<L.List<[number, L.List<A>]>> {
if (L.isEmpty(xs)) return T.pure(acc);
const [k, s] = xs.head;
return prune(s, f).chain(mt =>
isNothing(mt) ? go(xs.tail, acc)
/* otherwise */ : go(xs.tail, L.cons([k, mt.value] as [number, L.List<A>], acc)));
}
开发者ID:syaiful6,项目名称:jonggrang,代码行数:7,代码来源:multi-map.ts
示例4: it
it('saveSession can create new session', async function () {
const storage = await T.toPromise(emptyMockStorage);
const state = SS.createServerSessionState(storage);
const m1 = { a: 'b' };
const session = await T.toPromise(SS.saveSession(state, { sess: null, now: fakenow }, m1));
assert.ok(session != null);
assert.equal((session as any).authId, null);
assert.deepEqual((session as any).data, m1);
const op = await getMockOperation(storage);
assert.deepEqual(op, L.singleton({ session, tag: 'insert' }));
});
开发者ID:syaiful6,项目名称:jonggrang,代码行数:13,代码来源:server-session.ts
示例5:
return L.concat(I.foldrWithKey((_, v, xs) => L.cons(v, xs), L.nil, m));
开发者ID:syaiful6,项目名称:jonggrang,代码行数:1,代码来源:multi-map.ts
示例6: sepEndBy
return p.chain(a =>
sep.chain(() => sepEndBy(p, sep).map(as => L.cons(a, as)))
.alt(Parser.of(L.singleton(a)))
开发者ID:syaiful6,项目名称:jonggrang,代码行数:3,代码来源:combinator.ts
示例7: many
return p.chain(head => many(p).map(xs => L.cons(head, xs)));
开发者ID:syaiful6,项目名称:jonggrang,代码行数:1,代码来源:combinator.ts
示例8: just
function nel<A>(xs: L.List<A>): Maybe<L.List<A>> {
return L.isEmpty(xs) ? nothing : just(xs);
}
开发者ID:syaiful6,项目名称:jonggrang,代码行数:3,代码来源:multi-map.ts
注:本文中的@jonggrang/prelude.list类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论