import { Functor, Functor1, Functor2, Functor2C, Functor3, Functor3C, Functor4 } from './Functor' import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT' import { Semigroup } from './Semigroup' /** * @category model * @since 2.0.0 */ export interface Apply extends Functor { readonly ap: (fab: HKT B>, fa: HKT) => HKT } /** * @category model * @since 2.0.0 */ export interface Apply1 extends Functor1 { readonly ap: (fab: Kind B>, fa: Kind) => Kind } /** * @category model * @since 2.0.0 */ export interface Apply2 extends Functor2 { readonly ap: (fab: Kind2 B>, fa: Kind2) => Kind2 } /** * @category model * @since 2.0.0 */ export interface Apply2C extends Functor2C { readonly ap: (fab: Kind2 B>, fa: Kind2) => Kind2 } /** * @category model * @since 2.0.0 */ export interface Apply3 extends Functor3 { readonly ap: (fab: Kind3 B>, fa: Kind3) => Kind3 } /** * @category model * @since 2.2.0 */ export interface Apply3C extends Functor3C { readonly ap: (fab: Kind3 B>, fa: Kind3) => Kind3 } /** * @category model * @since 2.0.0 */ export interface Apply4 extends Functor4 { readonly ap: (fab: Kind4 B>, fa: Kind4) => Kind4 } /** * `ap` composition. * * @since 2.10.0 */ export declare function ap( F: Apply4, G: Apply4 ): ( fa: Kind4> ) => (fab: Kind4 B>>) => Kind4> export declare function ap( F: Apply4, G: Apply3 ): ( fa: Kind4> ) => (fab: Kind4 B>>) => Kind4> export declare function ap( F: Apply4, G: Apply3C ): ( fa: Kind4> ) => (fab: Kind4 B>>) => Kind4> export declare function ap( F: Apply4, G: Apply2 ): ( fa: Kind4> ) => (fab: Kind4 B>>) => Kind4> export declare function ap( F: Apply4, G: Apply2C ): ( fa: Kind4> ) => (fab: Kind4 B>>) => Kind4> export declare function ap( F: Apply4, G: Apply1 ): ( fa: Kind4> ) => (fab: Kind4 B>>) => Kind4> export declare function ap( F: Apply3C, G: Apply4 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3C, G: Apply3 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3C, G: Apply3C ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3C, G: Apply2 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3C, G: Apply2C ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3C, G: Apply1 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3, G: Apply4 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3, G: Apply3 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3, G: Apply3C ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3, G: Apply2 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3, G: Apply2C ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply3, G: Apply1 ): ( fa: Kind3> ) => (fab: Kind3 B>>) => Kind3> export declare function ap( F: Apply2C, G: Apply4 ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2C, G: Apply3 ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2C, G: Apply3C ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2C, G: Apply2 ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2C, G: Apply2C ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2C, G: Apply1 ): (fa: Kind2>) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2, G: Apply4 ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2, G: Apply3 ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2, G: Apply3C ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2, G: Apply2 ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2, G: Apply2C ): ( fa: Kind2> ) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply2, G: Apply1 ): (fa: Kind2>) => (fab: Kind2 B>>) => Kind2> export declare function ap( F: Apply1, G: Apply4 ): ( fa: Kind> ) => (fab: Kind B>>) => Kind> export declare function ap( F: Apply1, G: Apply3 ): ( fa: Kind> ) => (fab: Kind B>>) => Kind> export declare function ap( F: Apply1, G: Apply3C ): ( fa: Kind> ) => (fab: Kind B>>) => Kind> export declare function ap( F: Apply1, G: Apply2 ): (fa: Kind>) => (fab: Kind B>>) => Kind> export declare function ap( F: Apply1, G: Apply2C ): (fa: Kind>) => (fab: Kind B>>) => Kind> export declare function ap( F: Apply1, G: Apply1 ): (fa: Kind>) => (fab: Kind B>>) => Kind> export declare function ap( F: Apply, G: Apply4 ): ( fa: HKT> ) => (fab: HKT B>>) => HKT> export declare function ap( F: Apply, G: Apply3 ): ( fa: HKT> ) => (fab: HKT B>>) => HKT> export declare function ap( F: Apply, G: Apply3C ): (fa: HKT>) => (fab: HKT B>>) => HKT> export declare function ap( F: Apply, G: Apply2 ): (fa: HKT>) => (fab: HKT B>>) => HKT> export declare function ap( F: Apply, G: Apply2C ): (fa: HKT>) => (fab: HKT B>>) => HKT> export declare function ap( F: Apply, G: Apply1 ): (fa: HKT>) => (fab: HKT B>>) => HKT> export declare function ap( F: Apply, G: Apply ): (fa: HKT>) => (fab: HKT B>>) => HKT> /** * @since 2.10.0 */ export declare function apFirst( A: Apply4 ): (second: Kind4) => (first: Kind4) => Kind4 export declare function apFirst( A: Apply3 ): (second: Kind3) => (first: Kind3) => Kind3 export declare function apFirst( A: Apply3C ): (second: Kind3) => (first: Kind3) => Kind3 export declare function apFirst( A: Apply2 ): (second: Kind2) => (first: Kind2) => Kind2 export declare function apFirst( A: Apply2C ): (second: Kind2) => (first: Kind2) => Kind2 export declare function apFirst( A: Apply1 ): (second: Kind) => (first: Kind) => Kind export declare function apFirst(A: Apply): (second: HKT) => (first: HKT) => HKT /** * @since 2.10.0 */ export declare function apSecond( A: Apply4 ): (second: Kind4) => (first: Kind4) => Kind4 export declare function apSecond( A: Apply3 ): (second: Kind3) => (first: Kind3) => Kind3 export declare function apSecond( A: Apply3C ): (second: Kind3) => (first: Kind3) => Kind3 export declare function apSecond( A: Apply2 ): (second: Kind2) => (first: Kind2) => Kind2 export declare function apSecond( A: Apply2C ): (second: Kind2) => (first: Kind2) => Kind2 export declare function apSecond( A: Apply1 ): (second: Kind) => (first: Kind) => Kind export declare function apSecond(A: Apply): (second: HKT) => (first: HKT) => HKT /** * @since 2.10.0 */ export declare function apS( F: Apply4 ): ( name: Exclude, fb: Kind4 ) => (fa: Kind4) => Kind4< F, S, R, E, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > export declare function apS( F: Apply3 ): ( name: Exclude, fb: Kind3 ) => (fa: Kind3) => Kind3< F, R, E, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > export declare function apS( F: Apply3C ): ( name: Exclude, fb: Kind3 ) => (fa: Kind3) => Kind3< F, R, E, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > export declare function apS( F: Apply2 ): ( name: Exclude, fb: Kind2 ) => (fa: Kind2) => Kind2< F, E, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > export declare function apS( F: Apply2C ): ( name: Exclude, fb: Kind2 ) => (fa: Kind2) => Kind2< F, E, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > export declare function apS( F: Apply1 ): ( name: Exclude, fb: Kind ) => (fa: Kind) => Kind< F, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > export declare function apS(F: Apply): ( name: Exclude, fb: HKT ) => (fa: HKT) => HKT< F, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } > /** * Lift a semigroup into 'F', the inner values are concatenated using the provided `Semigroup`. * * @since 2.10.0 */ export declare function getApplySemigroup( F: Apply4 ): (S: Semigroup) => Semigroup> export declare function getApplySemigroup( F: Apply3 ): (S: Semigroup) => Semigroup> export declare function getApplySemigroup( F: Apply3C ): (S: Semigroup) => Semigroup> export declare function getApplySemigroup( F: Apply2 ): (S: Semigroup) => Semigroup> export declare function getApplySemigroup( F: Apply2C ): (S: Semigroup) => Semigroup> export declare function getApplySemigroup(F: Apply1): (S: Semigroup) => Semigroup> export declare function getApplySemigroup(F: Apply): (S: Semigroup) => Semigroup> /** * Tuple sequencing, i.e., take a tuple of monadic actions and does them from left-to-right, returning the resulting tuple. * * @example * import { sequenceT } from 'fp-ts/Apply' * import * as O from 'fp-ts/Option' * * const sequenceTOption = sequenceT(O.Apply) * assert.deepStrictEqual(sequenceTOption(O.some(1)), O.some([1])) * assert.deepStrictEqual(sequenceTOption(O.some(1), O.some('2')), O.some([1, '2'])) * assert.deepStrictEqual(sequenceTOption(O.some(1), O.some('2'), O.none), O.none) * * @since 2.0.0 */ export declare function sequenceT( F: Apply4 ): >>( ...t: T & { readonly 0: Kind4 } ) => Kind4< F, S, R, E, { [K in keyof T]: [T[K]] extends [Kind4] ? A : never } > export declare function sequenceT( F: Apply3 ): >>( ...t: T & { readonly 0: Kind3 } ) => Kind3< F, R, E, { [K in keyof T]: [T[K]] extends [Kind3] ? A : never } > export declare function sequenceT( F: Apply3C ): >>( ...t: T & { readonly 0: Kind3 } ) => Kind3< F, R, E, { [K in keyof T]: [T[K]] extends [Kind3] ? A : never } > export declare function sequenceT( F: Apply2 ): >>( ...t: T & { readonly 0: Kind2 } ) => Kind2< F, E, { [K in keyof T]: [T[K]] extends [Kind2] ? A : never } > export declare function sequenceT( F: Apply2C ): >>( ...t: T & { readonly 0: Kind2 } ) => Kind2< F, E, { [K in keyof T]: [T[K]] extends [Kind2] ? A : never } > export declare function sequenceT( F: Apply1 ): >>( ...t: T & { readonly 0: Kind } ) => Kind< F, { [K in keyof T]: [T[K]] extends [Kind] ? A : never } > export declare function sequenceT(F: Apply): >>( ...t: T & { readonly 0: HKT } ) => HKT< F, { [K in keyof T]: [T[K]] extends [HKT] ? A : never } > type EnforceNonEmptyRecord = keyof R extends never ? never : R /** * Like `Apply.sequenceT` but works with structs instead of tuples. * * @example * import * as E from 'fp-ts/Either' * import { sequenceS } from 'fp-ts/Apply' * * const ado = sequenceS(E.Apply) * * assert.deepStrictEqual( * ado({ * a: E.right(1), * b: E.right(true) * }), * E.right({ a: 1, b: true }) * ) * assert.deepStrictEqual( * ado({ * a: E.right(1), * b: E.left('error') * }), * E.left('error') * ) * * @since 2.0.0 */ export declare function sequenceS( F: Apply4 ): >>( r: EnforceNonEmptyRecord & Record> ) => Kind4< F, S, R, E, { [K in keyof NER]: [NER[K]] extends [Kind4] ? A : never } > export declare function sequenceS( F: Apply3 ): >>( r: EnforceNonEmptyRecord & Record> ) => Kind3< F, R, E, { [K in keyof NER]: [NER[K]] extends [Kind3] ? A : never } > export declare function sequenceS( F: Apply3C ): >>( r: EnforceNonEmptyRecord & Record> ) => Kind3< F, R, E, { [K in keyof NER]: [NER[K]] extends [Kind3] ? A : never } > export declare function sequenceS( F: Apply2 ): >>( r: EnforceNonEmptyRecord & Record> ) => Kind2< F, E, { [K in keyof NER]: [NER[K]] extends [Kind2] ? A : never } > export declare function sequenceS( F: Apply2C ): >>( r: EnforceNonEmptyRecord ) => Kind2< F, E, { [K in keyof NER]: [NER[K]] extends [Kind2] ? A : never } > export declare function sequenceS( F: Apply1 ): >>( r: EnforceNonEmptyRecord ) => Kind< F, { [K in keyof NER]: [NER[K]] extends [Kind] ? A : never } > export declare function sequenceS(F: Apply): >>( r: EnforceNonEmptyRecord ) => HKT< F, { [K in keyof NER]: [NER[K]] extends [HKT] ? A : never } > export {}