本文整理汇总了TypeScript中@jonggrang/prelude.constant函数的典型用法代码示例。如果您正苦于以下问题:TypeScript constant函数的具体用法?TypeScript constant怎么用?TypeScript constant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了constant函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: action
export function withFileInfoCache<A>(
delay: number,
action: (getInfo: (hash: number) => (path: string) => T.Task<FileInfo>) => T.Task<A>
): T.Task<A> {
return delay === 0
? action(constant(getFileInfo))
: T.bracket(initialize(delay), terminate, s => action(getAndRegisterInfo(s)));
}
示例2: action
export function withFdCache<A>(duration: number, action: (_: GetFd) => T.Task<A>): T.Task<A> {
return duration === 0
? action(P.constant(getFdNothing))
: T.bracket(initialize(duration), terminate, mfc => action(getFd(mfc)));
}
示例3: it
it('#searchWith return Just if the key present and satisfy pred', function () {
const mmap = MM.singleton(10, 'ten');
assert.ok(P.isJust(MM.searchWith(10, P.constant(true), mmap)));
});
示例4:
export function apSecond<A, B>(fa: any, fb: any): any {
return fa.map(constant(identity)).ap(fb) as Task<B>;
}
示例5: bracket
export function bracket_<A, B, C>(acquire: Task<A>, release: Task<B>, act: Task<C>): Task<C> {
return bracket(acquire, constant(release), constant(act));
}
示例6: bracketOnError
export function onException<A, B>(t: Task<A>, what: Task<B>): Task<A> {
return bracketOnError(pure(void 0), constant(what), constant(t));
}
示例7: override
function override(): T.Task<(c: Cache) => Cache> {
return T.pure(constant(HM.empty));
}