@typed/fp
Version:
Data Structures and Resources for fp-ts
32 lines • 933 B
JavaScript
/**
* FromKV is a Typeclass which represents the Natural Transformation from an KV into another
* effect.
*
* @since 0.11.0
*/
import { chainFirst } from 'fp-ts/Chain';
import { flow } from 'fp-ts/function';
import * as Provide from './Provide';
export function fromKVK(F) {
return (f) => (...args) => F.fromKV(f(...args));
}
export function chainKVK(F, C) {
return (f) => C.chain(flow(f, F.fromKV));
}
export function chainFirstKVK(F, C) {
const chainF = chainFirst(C);
return (f) => chainF(flow(f, F.fromKV));
}
export function provideSomeWithKV(F) {
return flow(F.fromKV, Provide.provideSomeWith(F));
}
export function provideAllWithKV(F) {
return flow(F.fromKV, Provide.provideAllWith(F));
}
export function useSomeWithKV(F) {
return flow(F.fromKV, Provide.useSomeWith(F));
}
export function useAllWithKV(F) {
return flow(F.fromKV, Provide.useAllWith(F));
}
//# sourceMappingURL=FromKV.js.map