/** * FromEnv is a Typeclass which represents the Natural Transformation from a Resume into another * effect. * * @since 0.9.2 */ import { Chain, Chain1, Chain2, Chain3, Chain4, chainFirst } from 'fp-ts/Chain' import { flow } from 'fp-ts/function' import { HKT, URIS, URIS2, URIS3, URIS4 } from 'fp-ts/HKT' import { NaturalTransformation11, NaturalTransformation12, NaturalTransformation12C, NaturalTransformation13, NaturalTransformation13C, NaturalTransformation14, } from 'fp-ts/NaturalTransformation' import { Hkt } from './HKT' import * as R from './Resume' /** * @since 0.9.2 * @category Typeclass */ export type FromResume = { readonly URI?: F readonly fromResume: (resume: R.Resume) => HKT } /** * @since 0.9.2 * @category Typeclass */ export type FromResume1 = { readonly URI?: F readonly fromResume: NaturalTransformation11 } /** * @since 0.9.2 * @category Typeclass */ export type FromResume2 = { readonly URI?: F readonly fromResume: NaturalTransformation12 } /** * @since 0.9.2 * @category Typeclass */ export type FromResume2C = { readonly URI?: F readonly fromResume: NaturalTransformation12C } /** * @since 0.9.2 * @category Typeclass */ export type FromResume3 = { readonly URI?: F readonly fromResume: NaturalTransformation13 } /** * @since 0.9.2 * @category Typeclass */ export type FromResume3C = { readonly URI?: F readonly fromResume: NaturalTransformation13C } /** * @since 0.9.2 * @category Typeclass */ export type FromResume4 = { readonly URI?: F readonly fromResume: NaturalTransformation14 } /** * @since 0.9.2 * @category Constructor */ export function fromResumeK( F: FromResume1, ): (f: (...args: A) => R.Resume) => (...args: A) => Hkt export function fromResumeK( F: FromResume2, ): ( f: (...args: A) => R.Resume, ) => (...args: A) => Hkt export function fromResumeK( F: FromResume3, ): ( f: (...args: A) => R.Resume, ) => (...args: A) => Hkt export function fromResumeK( F: FromResume4, ): ( f: (...args: A) => R.Resume, ) => (...args: A) => Hkt export function fromResumeK( F: FromResume, ): (f: (...args: A) => R.Resume) => (...args: A) => Hkt export function fromResumeK(F: FromResume) { return (f: (...args: A) => R.Resume) => (...args: A): HKT => F.fromResume(f(...args)) } /** * @since 0.9.2 * @category Combinator */ export function chainResumeK( F: FromResume1, C: Chain1, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainResumeK( F: FromResume2, C: Chain2, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainResumeK( F: FromResume3, C: Chain3, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainResumeK( F: FromResume4, C: Chain4, ): ( f: (value: A) => R.Resume, ) => (hkt: Hkt) => Hkt export function chainResumeK( F: FromResume, C: Chain, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainResumeK( F: FromResume, C: Chain, ): (f: (value: A) => R.Resume) => (hkt: HKT) => HKT { return (f) => C.chain(flow(f, F.fromResume)) } /** * @since 0.9.2 * @category Combinator */ export function chainFirstResumeK( F: FromResume1, C: Chain1, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainFirstResumeK( F: FromResume2, C: Chain2, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainFirstResumeK( F: FromResume3, C: Chain3, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainFirstResumeK( F: FromResume4, C: Chain4, ): ( f: (value: A) => R.Resume, ) => (hkt: Hkt) => Hkt export function chainFirstResumeK( F: FromResume, C: Chain, ): (f: (value: A) => R.Resume) => (hkt: Hkt) => Hkt export function chainFirstResumeK( F: FromResume, C: Chain, ): (f: (value: A) => R.Resume) => (hkt: HKT) => HKT { const chainF = chainFirst(C) return (f) => chainF(flow(f, F.fromResume)) }