本文整理匯總了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));
}