init component
This commit is contained in:
86
node_modules/fp-ts/lib/Alt.d.ts
generated
vendored
Normal file
86
node_modules/fp-ts/lib/Alt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* The `Alt` type class identifies an associative operation on a type constructor. It is similar to `Semigroup`, except
|
||||
* that it applies to types of kind `* -> *`, like `Array` or `Option`, rather than concrete types like `string` or
|
||||
* `number`.
|
||||
*
|
||||
* `Alt` instances are required to satisfy the following laws:
|
||||
*
|
||||
* 1. Associativity: `A.alt(A.alt(fa, ga), ha) <-> A.alt(fa, A.alt(ga, ha))`
|
||||
* 2. Distributivity: `A.map(A.alt(fa, ga), ab) <-> A.alt(A.map(fa, ab), A.map(ga, ab))`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { LazyArg } from './function'
|
||||
import { Functor, Functor1, Functor2, Functor2C, Functor3, Functor3C, Functor4 } from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alt<F> extends Functor<F> {
|
||||
readonly alt: <A>(fa: HKT<F, A>, that: LazyArg<HKT<F, A>>) => HKT<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alt1<F extends URIS> extends Functor1<F> {
|
||||
readonly alt: <A>(fa: Kind<F, A>, that: LazyArg<Kind<F, A>>) => Kind<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alt2<F extends URIS2> extends Functor2<F> {
|
||||
readonly alt: <E, A>(fa: Kind2<F, E, A>, that: LazyArg<Kind2<F, E, A>>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alt2C<F extends URIS2, E> extends Functor2C<F, E> {
|
||||
readonly alt: <A>(fa: Kind2<F, E, A>, that: LazyArg<Kind2<F, E, A>>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alt3<F extends URIS3> extends Functor3<F> {
|
||||
readonly alt: <R, E, A>(fa: Kind3<F, R, E, A>, that: LazyArg<Kind3<F, R, E, A>>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Alt3C<F extends URIS3, E> extends Functor3C<F, E> {
|
||||
readonly alt: <R, A>(fa: Kind3<F, R, E, A>, that: LazyArg<Kind3<F, R, E, A>>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alt4<F extends URIS4> extends Functor4<F> {
|
||||
readonly alt: <S, R, E, A>(fa: Kind4<F, S, R, E, A>, that: LazyArg<Kind4<F, S, R, E, A>>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function altAll<F extends URIS4>(
|
||||
F: Alt4<F>
|
||||
): <S, R, E, A>(startWith: Kind4<F, S, R, E, A>) => (as: ReadonlyArray<Kind4<F, S, R, E, A>>) => Kind4<F, S, R, E, A>
|
||||
export declare function altAll<F extends URIS3>(
|
||||
F: Alt3<F>
|
||||
): <R, E, A>(startWith: Kind3<F, R, E, A>) => (as: ReadonlyArray<Kind3<F, R, E, A>>) => Kind3<F, R, E, A>
|
||||
export declare function altAll<F extends URIS3, E>(
|
||||
F: Alt3C<F, E>
|
||||
): <R, A>(startWith: Kind3<F, R, E, A>) => (as: ReadonlyArray<Kind3<F, R, E, A>>) => Kind3<F, R, E, A>
|
||||
export declare function altAll<F extends URIS2>(
|
||||
F: Alt2<F>
|
||||
): <E, A>(startWith: Kind2<F, E, A>) => (as: ReadonlyArray<Kind2<F, E, A>>) => Kind2<F, E, A>
|
||||
export declare function altAll<F extends URIS2, E>(
|
||||
F: Alt2C<F, E>
|
||||
): <A>(startWith: Kind2<F, E, A>) => (as: ReadonlyArray<Kind2<F, E, A>>) => Kind2<F, E, A>
|
||||
export declare function altAll<F extends URIS>(
|
||||
F: Alt1<F>
|
||||
): <A>(startWith: Kind<F, A>) => (as: ReadonlyArray<Kind<F, A>>) => Kind<F, A>
|
||||
export declare function altAll<F>(F: Alt<F>): <A>(startWith: HKT<F, A>) => (as: ReadonlyArray<HKT<F, A>>) => HKT<F, A>
|
||||
6
node_modules/fp-ts/lib/Alt.js
generated
vendored
Normal file
6
node_modules/fp-ts/lib/Alt.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.altAll = altAll;
|
||||
function altAll(F) {
|
||||
return function (startWith) { return function (as) { return as.reduce(function (acc, a) { return F.alt(acc, function () { return a; }); }, startWith); }; };
|
||||
}
|
||||
108
node_modules/fp-ts/lib/Alternative.d.ts
generated
vendored
Normal file
108
node_modules/fp-ts/lib/Alternative.d.ts
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* The `Alternative` type class extends the `Alt` type class with a value that should be the left and right identity for `alt`.
|
||||
*
|
||||
* It is similar to `Monoid`, except that it applies to types of kind `* -> *`, like `Array` or `Option`, rather than
|
||||
* concrete types like `string` or `number`.
|
||||
*
|
||||
* `Alternative` instances should satisfy the following laws:
|
||||
*
|
||||
* 1. Left identity: `A.alt(zero, fa) <-> fa`
|
||||
* 2. Right identity: `A.alt(fa, zero) <-> fa`
|
||||
* 3. Annihilation: `A.map(zero, f) <-> zero`
|
||||
* 4. Distributivity: `A.ap(A.alt(fab, gab), fa) <-> A.alt(A.ap(fab, fa), A.ap(gab, fa))`
|
||||
* 5. Annihilation: `A.ap(zero, fa) <-> zero`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Alt, Alt1, Alt2, Alt2C, Alt3, Alt3C, Alt4 } from './Alt'
|
||||
import {
|
||||
Applicative,
|
||||
Applicative1,
|
||||
Applicative2,
|
||||
Applicative2C,
|
||||
Applicative3,
|
||||
Applicative3C,
|
||||
Applicative4
|
||||
} from './Applicative'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Monoid } from './Monoid'
|
||||
import { Semigroup } from './Semigroup'
|
||||
import { Zero, Zero1, Zero2, Zero2C, Zero3, Zero3C, Zero4 } from './Zero'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alternative<F> extends Applicative<F>, Alt<F>, Zero<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alternative1<F extends URIS> extends Applicative1<F>, Alt1<F>, Zero1<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alternative2<F extends URIS2> extends Applicative2<F>, Alt2<F>, Zero2<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alternative2C<F extends URIS2, E> extends Applicative2C<F, E>, Alt2C<F, E>, Zero2C<F, E> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Alternative3<F extends URIS3> extends Applicative3<F>, Alt3<F>, Zero3<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface Alternative3C<F extends URIS3, E> extends Applicative3C<F, E>, Alt3C<F, E>, Zero3C<F, E> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface Alternative4<F extends URIS4> extends Applicative4<F>, Alt4<F>, Zero4<F> {}
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function altAll<F extends URIS4>(
|
||||
F: Alternative4<F>
|
||||
): <S, R, E, A>(as: ReadonlyArray<Kind4<F, S, R, E, A>>) => Kind4<F, S, R, E, A>
|
||||
export declare function altAll<F extends URIS3>(
|
||||
F: Alternative3<F>
|
||||
): <R, E, A>(as: ReadonlyArray<Kind3<F, R, E, A>>) => Kind3<F, R, E, A>
|
||||
export declare function altAll<F extends URIS3, E>(
|
||||
F: Alternative3C<F, E>
|
||||
): <R, A>(as: ReadonlyArray<Kind3<F, R, E, A>>) => Kind3<F, R, E, A>
|
||||
export declare function altAll<F extends URIS2>(
|
||||
F: Alternative2<F>
|
||||
): <E, A>(as: ReadonlyArray<Kind2<F, E, A>>) => Kind2<F, E, A>
|
||||
export declare function altAll<F extends URIS2, E>(
|
||||
F: Alternative2C<F, E>
|
||||
): <A>(as: ReadonlyArray<Kind2<F, E, A>>) => Kind2<F, E, A>
|
||||
export declare function altAll<F extends URIS>(F: Alternative1<F>): <A>(as: ReadonlyArray<Kind<F, A>>) => Kind<F, A>
|
||||
export declare function altAll<F>(F: Alternative<F>): <A>(as: ReadonlyArray<HKT<F, A>>) => HKT<F, A>
|
||||
/**
|
||||
* Lift a semigroup into a monoid alternative 'F', the inner values are concatenated using the provided `Semigroup`.
|
||||
* @since 2.13.0
|
||||
*/
|
||||
export declare function getAlternativeMonoid<F extends URIS4>(
|
||||
F: Alternative4<F>
|
||||
): <A, S, R, E>(S: Semigroup<A>) => Monoid<Kind4<F, S, R, E, A>>
|
||||
export declare function getAlternativeMonoid<F extends URIS3>(
|
||||
F: Alternative3<F>
|
||||
): <A, R, E>(S: Semigroup<A>) => Monoid<Kind3<F, R, E, A>>
|
||||
export declare function getAlternativeMonoid<F extends URIS3, E>(
|
||||
F: Alternative3C<F, E>
|
||||
): <A, R>(S: Semigroup<A>) => Monoid<Kind3<F, R, E, A>>
|
||||
export declare function getAlternativeMonoid<F extends URIS2>(
|
||||
F: Alternative2<F>
|
||||
): <A, E>(S: Semigroup<A>) => Monoid<Kind2<F, E, A>>
|
||||
export declare function getAlternativeMonoid<F extends URIS2, E>(
|
||||
F: Alternative2C<F, E>
|
||||
): <A>(S: Semigroup<A>) => Monoid<Kind2<F, E, A>>
|
||||
export declare function getAlternativeMonoid<F extends URIS>(
|
||||
F: Alternative1<F>
|
||||
): <A>(S: Semigroup<A>) => Monoid<Kind<F, A>>
|
||||
export declare function getAlternativeMonoid<F>(F: Alternative<F>): <A>(S: Semigroup<A>) => Monoid<HKT<F, A>>
|
||||
37
node_modules/fp-ts/lib/Alternative.js
generated
vendored
Normal file
37
node_modules/fp-ts/lib/Alternative.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.altAll = altAll;
|
||||
exports.getAlternativeMonoid = getAlternativeMonoid;
|
||||
/**
|
||||
* The `Alternative` type class extends the `Alt` type class with a value that should be the left and right identity for `alt`.
|
||||
*
|
||||
* It is similar to `Monoid`, except that it applies to types of kind `* -> *`, like `Array` or `Option`, rather than
|
||||
* concrete types like `string` or `number`.
|
||||
*
|
||||
* `Alternative` instances should satisfy the following laws:
|
||||
*
|
||||
* 1. Left identity: `A.alt(zero, fa) <-> fa`
|
||||
* 2. Right identity: `A.alt(fa, zero) <-> fa`
|
||||
* 3. Annihilation: `A.map(zero, f) <-> zero`
|
||||
* 4. Distributivity: `A.ap(A.alt(fab, gab), fa) <-> A.alt(A.ap(fab, fa), A.ap(gab, fa))`
|
||||
* 5. Annihilation: `A.ap(zero, fa) <-> zero`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var Alt_1 = require("./Alt");
|
||||
var Apply_1 = require("./Apply");
|
||||
function altAll(F) {
|
||||
return (0, Alt_1.altAll)(F)(F.zero());
|
||||
}
|
||||
function getAlternativeMonoid(F) {
|
||||
var f = (0, Apply_1.getApplySemigroup)(F);
|
||||
return function (S) {
|
||||
var SF = f(S);
|
||||
return {
|
||||
concat: function (first, second) {
|
||||
return F.alt(SF.concat(first, second), function () { return F.alt(first, function () { return second; }); });
|
||||
},
|
||||
empty: F.zero()
|
||||
};
|
||||
};
|
||||
}
|
||||
267
node_modules/fp-ts/lib/Applicative.d.ts
generated
vendored
Normal file
267
node_modules/fp-ts/lib/Applicative.d.ts
generated
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
/**
|
||||
* The `Applicative` type class extends the `Apply` type class with a `of` function, which can be used to create values
|
||||
* of type `f a` from values of type `a`.
|
||||
*
|
||||
* Where `Apply` provides the ability to lift functions of two or more arguments to functions whose arguments are
|
||||
* wrapped using `f`, and `Functor` provides the ability to lift functions of one argument, `pure` can be seen as the
|
||||
* function which lifts functions of _zero_ arguments. That is, `Applicative` functors support a lifting operation for
|
||||
* any number of function arguments.
|
||||
*
|
||||
* Instances must satisfy the following laws in addition to the `Apply` laws:
|
||||
*
|
||||
* 1. Identity: `A.ap(A.of(a => a), fa) <-> fa`
|
||||
* 2. Homomorphism: `A.ap(A.of(ab), A.of(a)) <-> A.of(ab(a))`
|
||||
* 3. Interchange: `A.ap(fab, A.of(a)) <-> A.ap(A.of(ab => ab(a)), fab)`
|
||||
*
|
||||
* Note. `Functor`'s `map` can be derived: `A.map(x, f) = A.ap(A.of(f), x)`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Apply, Apply1, Apply2, Apply2C, Apply3, Apply3C, Apply4 } from './Apply'
|
||||
import {
|
||||
FunctorComposition,
|
||||
FunctorComposition2C1,
|
||||
FunctorComposition11,
|
||||
FunctorComposition12,
|
||||
FunctorComposition12C,
|
||||
FunctorComposition21,
|
||||
FunctorComposition22,
|
||||
FunctorComposition22C,
|
||||
FunctorCompositionHKT1,
|
||||
FunctorCompositionHKT2,
|
||||
FunctorCompositionHKT2C
|
||||
} from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Monoid } from './Monoid'
|
||||
import { Pointed, Pointed1, Pointed2, Pointed2C, Pointed3, Pointed3C, Pointed4 } from './Pointed'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Applicative<F> extends Apply<F>, Pointed<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Applicative1<F extends URIS> extends Apply1<F>, Pointed1<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Applicative2<F extends URIS2> extends Apply2<F>, Pointed2<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Applicative2C<F extends URIS2, E> extends Apply2C<F, E>, Pointed2C<F, E> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Applicative3<F extends URIS3> extends Apply3<F>, Pointed3<F> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Applicative3C<F extends URIS3, E> extends Apply3C<F, E>, Pointed3C<F, E> {}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Applicative4<F extends URIS4> extends Apply4<F>, Pointed4<F> {}
|
||||
/**
|
||||
* Lift a monoid into 'F', the inner values are concatenated using the provided `Monoid`.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function getApplicativeMonoid<F extends URIS4>(
|
||||
F: Applicative4<F>
|
||||
): <A, S, R, E>(M: Monoid<A>) => Monoid<Kind4<F, S, R, E, A>>
|
||||
export declare function getApplicativeMonoid<F extends URIS3>(
|
||||
F: Applicative3<F>
|
||||
): <A, R, E>(M: Monoid<A>) => Monoid<Kind3<F, R, E, A>>
|
||||
export declare function getApplicativeMonoid<F extends URIS3, E>(
|
||||
F: Applicative3C<F, E>
|
||||
): <A, R>(M: Monoid<A>) => Monoid<Kind3<F, R, E, A>>
|
||||
export declare function getApplicativeMonoid<F extends URIS2>(
|
||||
F: Applicative2<F>
|
||||
): <A, E>(M: Monoid<A>) => Monoid<Kind2<F, E, A>>
|
||||
export declare function getApplicativeMonoid<F extends URIS2, E>(
|
||||
F: Applicative2C<F, E>
|
||||
): <A>(M: Monoid<A>) => Monoid<Kind2<F, E, A>>
|
||||
export declare function getApplicativeMonoid<F extends URIS>(
|
||||
F: Applicative1<F>
|
||||
): <A>(M: Monoid<A>) => Monoid<Kind<F, A>>
|
||||
export declare function getApplicativeMonoid<F>(F: Applicative<F>): <A>(M: Monoid<A>) => Monoid<HKT<F, A>>
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition<F, G> extends FunctorComposition<F, G> {
|
||||
readonly of: <A>(a: A) => HKT<F, HKT<G, A>>
|
||||
readonly ap: <A, B>(fgab: HKT<F, HKT<G, (a: A) => B>>, fga: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeCompositionHKT1<F, G extends URIS> extends FunctorCompositionHKT1<F, G> {
|
||||
readonly of: <A>(a: A) => HKT<F, Kind<G, A>>
|
||||
readonly ap: <A, B>(fgab: HKT<F, Kind<G, (a: A) => B>>, fga: HKT<F, Kind<G, A>>) => HKT<F, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeCompositionHKT2<F, G extends URIS2> extends FunctorCompositionHKT2<F, G> {
|
||||
readonly of: <E, A>(a: A) => HKT<F, Kind2<G, E, A>>
|
||||
readonly ap: <E, A, B>(fgab: HKT<F, Kind2<G, E, (a: A) => B>>, fga: HKT<F, Kind2<G, E, A>>) => HKT<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeCompositionHKT2C<F, G extends URIS2, E> extends FunctorCompositionHKT2C<F, G, E> {
|
||||
readonly of: <A>(a: A) => HKT<F, Kind2<G, E, A>>
|
||||
readonly ap: <A, B>(fgab: HKT<F, Kind2<G, E, (a: A) => B>>, fga: HKT<F, Kind2<G, E, A>>) => HKT<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition11<F extends URIS, G extends URIS> extends FunctorComposition11<F, G> {
|
||||
readonly of: <A>(a: A) => Kind<F, Kind<G, A>>
|
||||
readonly ap: <A, B>(fgab: Kind<F, Kind<G, (a: A) => B>>, fga: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition12<F extends URIS, G extends URIS2> extends FunctorComposition12<F, G> {
|
||||
readonly of: <E, A>(a: A) => Kind<F, Kind2<G, E, A>>
|
||||
readonly ap: <E, A, B>(
|
||||
fgab: Kind<F, Kind2<G, E, (a: A) => B>>,
|
||||
fga: Kind<F, Kind2<G, E, A>>
|
||||
) => Kind<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition12C<F extends URIS, G extends URIS2, E> extends FunctorComposition12C<F, G, E> {
|
||||
readonly of: <A>(a: A) => Kind<F, Kind2<G, E, A>>
|
||||
readonly ap: <A, B>(fgab: Kind<F, Kind2<G, E, (a: A) => B>>, fga: Kind<F, Kind2<G, E, A>>) => Kind<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition21<F extends URIS2, G extends URIS> extends FunctorComposition21<F, G> {
|
||||
readonly of: <E, A>(a: A) => Kind2<F, E, Kind<G, A>>
|
||||
readonly ap: <E, A, B>(
|
||||
fgab: Kind2<F, E, Kind<G, (a: A) => B>>,
|
||||
fga: Kind2<F, E, Kind<G, A>>
|
||||
) => Kind2<F, E, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition2C1<F extends URIS2, G extends URIS, E> extends FunctorComposition2C1<F, G, E> {
|
||||
readonly of: <A>(a: A) => Kind2<F, E, Kind<G, A>>
|
||||
readonly ap: <A, B>(fgab: Kind2<F, E, Kind<G, (a: A) => B>>, fga: Kind2<F, E, Kind<G, A>>) => Kind2<F, E, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition22<F extends URIS2, G extends URIS2> extends FunctorComposition22<F, G> {
|
||||
readonly of: <FE, GE, A>(a: A) => Kind2<F, FE, Kind2<G, GE, A>>
|
||||
readonly ap: <FE, GE, A, B>(
|
||||
fgab: Kind2<F, FE, Kind2<G, GE, (a: A) => B>>,
|
||||
fga: Kind2<F, FE, Kind2<G, GE, A>>
|
||||
) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ApplicativeComposition22C<F extends URIS2, G extends URIS2, E> extends FunctorComposition22C<F, G, E> {
|
||||
readonly of: <FE, A>(a: A) => Kind2<F, FE, Kind2<G, E, A>>
|
||||
readonly ap: <FE, A, B>(
|
||||
fgab: Kind2<F, FE, Kind2<G, E, (a: A) => B>>,
|
||||
fga: Kind2<F, FE, Kind2<G, E, A>>
|
||||
) => Kind2<F, FE, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* Use [`ap`](./Apply.ts.html#ap) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getApplicativeComposition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Applicative2<F>,
|
||||
G: Applicative2C<G, E>
|
||||
): ApplicativeComposition22C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F extends URIS2, G extends URIS2>(
|
||||
F: Applicative2<F>,
|
||||
G: Applicative2<G>
|
||||
): ApplicativeComposition22<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Applicative2<F>,
|
||||
G: Applicative2C<G, E>
|
||||
): ApplicativeComposition22C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F extends URIS2, G extends URIS>(
|
||||
F: Applicative2<F>,
|
||||
G: Applicative1<G>
|
||||
): ApplicativeComposition21<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F extends URIS, G extends URIS2>(
|
||||
F: Applicative1<F>,
|
||||
G: Applicative2<G>
|
||||
): ApplicativeComposition12<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F extends URIS, G extends URIS2, E>(
|
||||
F: Applicative1<F>,
|
||||
G: Applicative2C<G, E>
|
||||
): ApplicativeComposition12C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F extends URIS, G extends URIS>(
|
||||
F: Applicative1<F>,
|
||||
G: Applicative1<G>
|
||||
): ApplicativeComposition11<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F, G extends URIS2>(
|
||||
F: Applicative<F>,
|
||||
G: Applicative2<G>
|
||||
): ApplicativeCompositionHKT2<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F, G extends URIS2, E>(
|
||||
F: Applicative<F>,
|
||||
G: Applicative2C<G, E>
|
||||
): ApplicativeCompositionHKT2C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F, G extends URIS>(
|
||||
F: Applicative<F>,
|
||||
G: Applicative1<G>
|
||||
): ApplicativeCompositionHKT1<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getApplicativeComposition<F, G>(
|
||||
F: Applicative<F>,
|
||||
G: Applicative<G>
|
||||
): ApplicativeComposition<F, G>
|
||||
43
node_modules/fp-ts/lib/Applicative.js
generated
vendored
Normal file
43
node_modules/fp-ts/lib/Applicative.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getApplicativeMonoid = getApplicativeMonoid;
|
||||
exports.getApplicativeComposition = getApplicativeComposition;
|
||||
/**
|
||||
* The `Applicative` type class extends the `Apply` type class with a `of` function, which can be used to create values
|
||||
* of type `f a` from values of type `a`.
|
||||
*
|
||||
* Where `Apply` provides the ability to lift functions of two or more arguments to functions whose arguments are
|
||||
* wrapped using `f`, and `Functor` provides the ability to lift functions of one argument, `pure` can be seen as the
|
||||
* function which lifts functions of _zero_ arguments. That is, `Applicative` functors support a lifting operation for
|
||||
* any number of function arguments.
|
||||
*
|
||||
* Instances must satisfy the following laws in addition to the `Apply` laws:
|
||||
*
|
||||
* 1. Identity: `A.ap(A.of(a => a), fa) <-> fa`
|
||||
* 2. Homomorphism: `A.ap(A.of(ab), A.of(a)) <-> A.of(ab(a))`
|
||||
* 3. Interchange: `A.ap(fab, A.of(a)) <-> A.ap(A.of(ab => ab(a)), fab)`
|
||||
*
|
||||
* Note. `Functor`'s `map` can be derived: `A.map(x, f) = A.ap(A.of(f), x)`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var Apply_1 = require("./Apply");
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
function getApplicativeMonoid(F) {
|
||||
var f = (0, Apply_1.getApplySemigroup)(F);
|
||||
return function (M) { return ({
|
||||
concat: f(M).concat,
|
||||
empty: F.of(M.empty)
|
||||
}); };
|
||||
}
|
||||
/** @deprecated */
|
||||
function getApplicativeComposition(F, G) {
|
||||
var map = (0, Functor_1.getFunctorComposition)(F, G).map;
|
||||
var _ap = (0, Apply_1.ap)(F, G);
|
||||
return {
|
||||
map: map,
|
||||
of: function (a) { return F.of(G.of(a)); },
|
||||
ap: function (fgab, fga) { return (0, function_1.pipe)(fgab, _ap(fga)); }
|
||||
};
|
||||
}
|
||||
658
node_modules/fp-ts/lib/Apply.d.ts
generated
vendored
Normal file
658
node_modules/fp-ts/lib/Apply.d.ts
generated
vendored
Normal file
@@ -0,0 +1,658 @@
|
||||
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<F> extends Functor<F> {
|
||||
readonly ap: <A, B>(fab: HKT<F, (a: A) => B>, fa: HKT<F, A>) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Apply1<F extends URIS> extends Functor1<F> {
|
||||
readonly ap: <A, B>(fab: Kind<F, (a: A) => B>, fa: Kind<F, A>) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Apply2<F extends URIS2> extends Functor2<F> {
|
||||
readonly ap: <E, A, B>(fab: Kind2<F, E, (a: A) => B>, fa: Kind2<F, E, A>) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Apply2C<F extends URIS2, E> extends Functor2C<F, E> {
|
||||
readonly ap: <A, B>(fab: Kind2<F, E, (a: A) => B>, fa: Kind2<F, E, A>) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Apply3<F extends URIS3> extends Functor3<F> {
|
||||
readonly ap: <R, E, A, B>(fab: Kind3<F, R, E, (a: A) => B>, fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Apply3C<F extends URIS3, E> extends Functor3C<F, E> {
|
||||
readonly ap: <R, A, B>(fab: Kind3<F, R, E, (a: A) => B>, fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Apply4<F extends URIS4> extends Functor4<F> {
|
||||
readonly ap: <S, R, E, A, B>(fab: Kind4<F, S, R, E, (a: A) => B>, fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
/**
|
||||
* `ap` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function ap<F extends URIS4, G extends URIS4>(
|
||||
F: Apply4<F>,
|
||||
G: Apply4<G>
|
||||
): <FS, FR, FE, GS, GR, GE, A>(
|
||||
fa: Kind4<F, FS, FR, FE, Kind4<G, GS, GR, GE, A>>
|
||||
) => <B>(fab: Kind4<F, FS, FR, FE, Kind4<G, GS, GR, GE, (a: A) => B>>) => Kind4<F, FS, FR, FE, Kind4<G, GS, GR, GE, B>>
|
||||
export declare function ap<F extends URIS4, G extends URIS3>(
|
||||
F: Apply4<F>,
|
||||
G: Apply3<G>
|
||||
): <S, FR, FE, GR, GE, A>(
|
||||
fa: Kind4<F, S, FR, FE, Kind3<G, GR, GE, A>>
|
||||
) => <B>(fab: Kind4<F, S, FR, FE, Kind3<G, GR, GE, (a: A) => B>>) => Kind4<F, S, FR, FE, Kind3<G, GR, GE, B>>
|
||||
export declare function ap<F extends URIS4, G extends URIS3, GE>(
|
||||
F: Apply4<F>,
|
||||
G: Apply3C<G, GE>
|
||||
): <S, FR, FE, GR, A>(
|
||||
fa: Kind4<F, S, FR, FE, Kind3<G, GR, GE, A>>
|
||||
) => <B>(fab: Kind4<F, S, FR, FE, Kind3<G, GR, GE, (a: A) => B>>) => Kind4<F, S, FR, FE, Kind3<G, GR, GE, B>>
|
||||
export declare function ap<F extends URIS4, G extends URIS2>(
|
||||
F: Apply4<F>,
|
||||
G: Apply2<G>
|
||||
): <S, R, FE, GE, A>(
|
||||
fa: Kind4<F, S, R, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind4<F, S, R, FE, Kind2<G, GE, (a: A) => B>>) => Kind4<F, S, R, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS4, G extends URIS2, GE>(
|
||||
F: Apply4<F>,
|
||||
G: Apply2C<G, GE>
|
||||
): <S, R, FE, A>(
|
||||
fa: Kind4<F, S, R, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind4<F, S, R, FE, Kind2<G, GE, (a: A) => B>>) => Kind4<F, S, R, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS4, G extends URIS>(
|
||||
F: Apply4<F>,
|
||||
G: Apply1<G>
|
||||
): <S, R, E, A>(
|
||||
fa: Kind4<F, S, R, E, Kind<G, A>>
|
||||
) => <B>(fab: Kind4<F, S, R, E, Kind<G, (a: A) => B>>) => Kind4<F, S, R, E, Kind<G, B>>
|
||||
export declare function ap<F extends URIS3, FE, G extends URIS4>(
|
||||
F: Apply3C<F, FE>,
|
||||
G: Apply4<G>
|
||||
): <FR, S, GR, GE, A>(
|
||||
fa: Kind3<F, FR, FE, Kind4<G, S, GR, GE, A>>
|
||||
) => <B>(fab: Kind3<F, FR, FE, Kind4<G, S, GR, GE, (a: A) => B>>) => Kind3<F, FR, FE, Kind4<G, S, GR, GE, B>>
|
||||
export declare function ap<F extends URIS3, FE, G extends URIS3>(
|
||||
F: Apply3C<F, FE>,
|
||||
G: Apply3<G>
|
||||
): <FR, GR, GE, A>(
|
||||
fa: Kind3<F, FR, FE, Kind3<G, GR, GE, A>>
|
||||
) => <B>(fab: Kind3<F, FR, FE, Kind3<G, GR, GE, (a: A) => B>>) => Kind3<F, FR, FE, Kind3<G, GR, GE, B>>
|
||||
export declare function ap<F extends URIS3, FE, G extends URIS3, GE>(
|
||||
F: Apply3C<F, FE>,
|
||||
G: Apply3C<G, GE>
|
||||
): <FR, GR, A>(
|
||||
fa: Kind3<F, FR, FE, Kind3<G, GR, GE, A>>
|
||||
) => <B>(fab: Kind3<F, FR, FE, Kind3<G, GR, GE, (a: A) => B>>) => Kind3<F, FR, FE, Kind3<G, GR, GE, B>>
|
||||
export declare function ap<F extends URIS3, FE, G extends URIS2>(
|
||||
F: Apply3C<F, FE>,
|
||||
G: Apply2<G>
|
||||
): <R, GE, A>(
|
||||
fa: Kind3<F, R, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind3<F, R, FE, Kind2<G, GE, (a: A) => B>>) => Kind3<F, R, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS3, FE, G extends URIS2, GE>(
|
||||
F: Apply3C<F, FE>,
|
||||
G: Apply2C<G, GE>
|
||||
): <R, A>(
|
||||
fa: Kind3<F, R, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind3<F, R, FE, Kind2<G, GE, (a: A) => B>>) => Kind3<F, R, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS3, E, G extends URIS>(
|
||||
F: Apply3C<F, E>,
|
||||
G: Apply1<G>
|
||||
): <R, A>(
|
||||
fa: Kind3<F, R, E, Kind<G, A>>
|
||||
) => <B>(fab: Kind3<F, R, E, Kind<G, (a: A) => B>>) => Kind3<F, R, E, Kind<G, B>>
|
||||
export declare function ap<F extends URIS3, G extends URIS4>(
|
||||
F: Apply3<F>,
|
||||
G: Apply4<G>
|
||||
): <FR, FE, S, GR, GE, A>(
|
||||
fa: Kind3<F, FR, FE, Kind4<G, S, GR, GE, A>>
|
||||
) => <B>(fab: Kind3<F, FR, FE, Kind4<G, S, GR, GE, (a: A) => B>>) => Kind3<F, FR, FE, Kind4<G, S, GR, GE, B>>
|
||||
export declare function ap<F extends URIS3, G extends URIS3>(
|
||||
F: Apply3<F>,
|
||||
G: Apply3<G>
|
||||
): <FR, FE, GR, GE, A>(
|
||||
fa: Kind3<F, FR, FE, Kind3<G, GR, GE, A>>
|
||||
) => <B>(fab: Kind3<F, FR, FE, Kind3<G, GR, GE, (a: A) => B>>) => Kind3<F, FR, FE, Kind3<G, GR, GE, B>>
|
||||
export declare function ap<F extends URIS3, G extends URIS3, GE>(
|
||||
F: Apply3<F>,
|
||||
G: Apply3C<G, GE>
|
||||
): <FR, FE, GR, A>(
|
||||
fa: Kind3<F, FR, FE, Kind3<G, GR, GE, A>>
|
||||
) => <B>(fab: Kind3<F, FR, FE, Kind3<G, GR, GE, (a: A) => B>>) => Kind3<F, FR, FE, Kind3<G, GR, GE, B>>
|
||||
export declare function ap<F extends URIS3, G extends URIS2>(
|
||||
F: Apply3<F>,
|
||||
G: Apply2<G>
|
||||
): <R, FE, GE, A>(
|
||||
fa: Kind3<F, R, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind3<F, R, FE, Kind2<G, GE, (a: A) => B>>) => Kind3<F, R, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS3, G extends URIS2, GE>(
|
||||
F: Apply3<F>,
|
||||
G: Apply2C<G, GE>
|
||||
): <R, FE, A>(
|
||||
fa: Kind3<F, R, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind3<F, R, FE, Kind2<G, GE, (a: A) => B>>) => Kind3<F, R, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS3, G extends URIS>(
|
||||
F: Apply3<F>,
|
||||
G: Apply1<G>
|
||||
): <R, E, A>(
|
||||
fa: Kind3<F, R, E, Kind<G, A>>
|
||||
) => <B>(fab: Kind3<F, R, E, Kind<G, (a: A) => B>>) => Kind3<F, R, E, Kind<G, B>>
|
||||
export declare function ap<F extends URIS2, FE, G extends URIS4>(
|
||||
F: Apply2C<F, FE>,
|
||||
G: Apply4<G>
|
||||
): <S, R, GE, A>(
|
||||
fa: Kind2<F, FE, Kind4<G, S, R, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind4<G, S, R, GE, (a: A) => B>>) => Kind2<F, FE, Kind4<G, S, R, GE, B>>
|
||||
export declare function ap<F extends URIS2, FE, G extends URIS3>(
|
||||
F: Apply2C<F, FE>,
|
||||
G: Apply3<G>
|
||||
): <R, GE, A>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind3<G, R, GE, (a: A) => B>>) => Kind2<F, FE, Kind3<G, R, GE, B>>
|
||||
export declare function ap<F extends URIS2, FE, G extends URIS3, GE>(
|
||||
F: Apply2C<F, FE>,
|
||||
G: Apply3C<G, GE>
|
||||
): <R, A>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind3<G, R, GE, (a: A) => B>>) => Kind2<F, FE, Kind3<G, R, GE, B>>
|
||||
export declare function ap<F extends URIS2, FE, G extends URIS2>(
|
||||
F: Apply2C<F, FE>,
|
||||
G: Apply2<G>
|
||||
): <GE, A>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind2<G, GE, (a: A) => B>>) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS2, FE, G extends URIS2, GE>(
|
||||
F: Apply2C<F, FE>,
|
||||
G: Apply2C<G, GE>
|
||||
): <A>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind2<G, GE, (a: A) => B>>) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS2, E, G extends URIS>(
|
||||
F: Apply2C<F, E>,
|
||||
G: Apply1<G>
|
||||
): <A>(fa: Kind2<F, E, Kind<G, A>>) => <B>(fab: Kind2<F, E, Kind<G, (a: A) => B>>) => Kind2<F, E, Kind<G, B>>
|
||||
export declare function ap<F extends URIS2, G extends URIS4>(
|
||||
F: Apply2<F>,
|
||||
G: Apply4<G>
|
||||
): <FE, S, R, GE, A>(
|
||||
fa: Kind2<F, FE, Kind4<G, S, R, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind4<G, S, R, GE, (a: A) => B>>) => Kind2<F, FE, Kind4<G, S, R, GE, B>>
|
||||
export declare function ap<F extends URIS2, G extends URIS3>(
|
||||
F: Apply2<F>,
|
||||
G: Apply3<G>
|
||||
): <FE, R, GE, A>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind3<G, R, GE, (a: A) => B>>) => Kind2<F, FE, Kind3<G, R, GE, B>>
|
||||
export declare function ap<F extends URIS2, G extends URIS3, GE>(
|
||||
F: Apply2<F>,
|
||||
G: Apply3C<G, GE>
|
||||
): <FE, R, A>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind3<G, R, GE, (a: A) => B>>) => Kind2<F, FE, Kind3<G, R, GE, B>>
|
||||
export declare function ap<F extends URIS2, G extends URIS2>(
|
||||
F: Apply2<F>,
|
||||
G: Apply2<G>
|
||||
): <FE, GE, A>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind2<G, GE, (a: A) => B>>) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS2, G extends URIS2, GE>(
|
||||
F: Apply2<F>,
|
||||
G: Apply2C<G, GE>
|
||||
): <FE, A>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Kind2<G, GE, (a: A) => B>>) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
export declare function ap<F extends URIS2, G extends URIS>(
|
||||
F: Apply2<F>,
|
||||
G: Apply1<G>
|
||||
): <E, A>(fa: Kind2<F, E, Kind<G, A>>) => <B>(fab: Kind2<F, E, Kind<G, (a: A) => B>>) => Kind2<F, E, Kind<G, B>>
|
||||
export declare function ap<F extends URIS, G extends URIS4>(
|
||||
F: Apply1<F>,
|
||||
G: Apply4<G>
|
||||
): <S, R, E, A>(
|
||||
fa: Kind<F, Kind4<G, S, R, E, A>>
|
||||
) => <B>(fab: Kind<F, Kind4<G, S, R, E, (a: A) => B>>) => Kind<F, Kind4<G, S, R, E, B>>
|
||||
export declare function ap<F extends URIS, G extends URIS3>(
|
||||
F: Apply1<F>,
|
||||
G: Apply3<G>
|
||||
): <R, E, A>(
|
||||
fa: Kind<F, Kind3<G, R, E, A>>
|
||||
) => <B>(fab: Kind<F, Kind3<G, R, E, (a: A) => B>>) => Kind<F, Kind3<G, R, E, B>>
|
||||
export declare function ap<F extends URIS, G extends URIS3, E>(
|
||||
F: Apply1<F>,
|
||||
G: Apply3C<G, E>
|
||||
): <R, A>(
|
||||
fa: Kind<F, Kind3<G, R, E, A>>
|
||||
) => <B>(fab: Kind<F, Kind3<G, R, E, (a: A) => B>>) => Kind<F, Kind3<G, R, E, B>>
|
||||
export declare function ap<F extends URIS, G extends URIS2>(
|
||||
F: Apply1<F>,
|
||||
G: Apply2<G>
|
||||
): <E, A>(fa: Kind<F, Kind2<G, E, A>>) => <B>(fab: Kind<F, Kind2<G, E, (a: A) => B>>) => Kind<F, Kind2<G, E, B>>
|
||||
export declare function ap<F extends URIS, G extends URIS2, E>(
|
||||
F: Apply1<F>,
|
||||
G: Apply2C<G, E>
|
||||
): <A>(fa: Kind<F, Kind2<G, E, A>>) => <B>(fab: Kind<F, Kind2<G, E, (a: A) => B>>) => Kind<F, Kind2<G, E, B>>
|
||||
export declare function ap<F extends URIS, G extends URIS>(
|
||||
F: Apply1<F>,
|
||||
G: Apply1<G>
|
||||
): <A>(fa: Kind<F, Kind<G, A>>) => <B>(fab: Kind<F, Kind<G, (a: A) => B>>) => Kind<F, Kind<G, B>>
|
||||
export declare function ap<F, G extends URIS4>(
|
||||
F: Apply<F>,
|
||||
G: Apply4<G>
|
||||
): <S, R, E, A>(
|
||||
fa: HKT<F, Kind4<G, S, R, E, A>>
|
||||
) => <B>(fab: HKT<F, Kind4<G, S, R, E, (a: A) => B>>) => HKT<F, Kind4<G, S, R, E, B>>
|
||||
export declare function ap<F, G extends URIS3>(
|
||||
F: Apply<F>,
|
||||
G: Apply3<G>
|
||||
): <R, E, A>(
|
||||
fa: HKT<F, Kind3<G, R, E, A>>
|
||||
) => <B>(fab: HKT<F, Kind3<G, R, E, (a: A) => B>>) => HKT<F, Kind3<G, R, E, B>>
|
||||
export declare function ap<F, G extends URIS3, E>(
|
||||
F: Apply<F>,
|
||||
G: Apply3C<G, E>
|
||||
): <R, A>(fa: HKT<F, Kind3<G, R, E, A>>) => <B>(fab: HKT<F, Kind3<G, R, E, (a: A) => B>>) => HKT<F, Kind3<G, R, E, B>>
|
||||
export declare function ap<F, G extends URIS2>(
|
||||
F: Apply<F>,
|
||||
G: Apply2<G>
|
||||
): <E, A>(fa: HKT<F, Kind2<G, E, A>>) => <B>(fab: HKT<F, Kind2<G, E, (a: A) => B>>) => HKT<F, Kind2<G, E, B>>
|
||||
export declare function ap<F, G extends URIS2, E>(
|
||||
F: Apply<F>,
|
||||
G: Apply2C<G, E>
|
||||
): <A>(fa: HKT<F, Kind2<G, E, A>>) => <B>(fab: HKT<F, Kind2<G, E, (a: A) => B>>) => HKT<F, Kind2<G, E, B>>
|
||||
export declare function ap<F, G extends URIS>(
|
||||
F: Apply<F>,
|
||||
G: Apply1<G>
|
||||
): <A>(fa: HKT<F, Kind<G, A>>) => <B>(fab: HKT<F, Kind<G, (a: A) => B>>) => HKT<F, Kind<G, B>>
|
||||
export declare function ap<F, G>(
|
||||
F: Apply<F>,
|
||||
G: Apply<G>
|
||||
): <A>(fa: HKT<F, HKT<G, A>>) => <B>(fab: HKT<F, HKT<G, (a: A) => B>>) => HKT<F, HKT<G, B>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function apFirst<F extends URIS4>(
|
||||
A: Apply4<F>
|
||||
): <S, R, E, B>(second: Kind4<F, S, R, E, B>) => <A>(first: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, A>
|
||||
export declare function apFirst<F extends URIS3>(
|
||||
A: Apply3<F>
|
||||
): <R, E, B>(second: Kind3<F, R, E, B>) => <A>(first: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
|
||||
export declare function apFirst<F extends URIS3, E>(
|
||||
A: Apply3C<F, E>
|
||||
): <R, B>(second: Kind3<F, R, E, B>) => <A>(first: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
|
||||
export declare function apFirst<F extends URIS2>(
|
||||
A: Apply2<F>
|
||||
): <E, B>(second: Kind2<F, E, B>) => <A>(first: Kind2<F, E, A>) => Kind2<F, E, A>
|
||||
export declare function apFirst<F extends URIS2, E>(
|
||||
A: Apply2C<F, E>
|
||||
): <B>(second: Kind2<F, E, B>) => <A>(first: Kind2<F, E, A>) => Kind2<F, E, A>
|
||||
export declare function apFirst<F extends URIS>(
|
||||
A: Apply1<F>
|
||||
): <B>(second: Kind<F, B>) => <A>(first: Kind<F, A>) => Kind<F, A>
|
||||
export declare function apFirst<F>(A: Apply<F>): <B>(second: HKT<F, B>) => <A>(first: HKT<F, A>) => HKT<F, A>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function apSecond<F extends URIS4>(
|
||||
A: Apply4<F>
|
||||
): <S, R, E, B>(second: Kind4<F, S, R, E, B>) => <A>(first: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
|
||||
export declare function apSecond<F extends URIS3>(
|
||||
A: Apply3<F>
|
||||
): <R, E, B>(second: Kind3<F, R, E, B>) => <A>(first: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
|
||||
export declare function apSecond<F extends URIS3, E>(
|
||||
A: Apply3C<F, E>
|
||||
): <R, B>(second: Kind3<F, R, E, B>) => <A>(first: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
|
||||
export declare function apSecond<F extends URIS2>(
|
||||
A: Apply2<F>
|
||||
): <E, B>(second: Kind2<F, E, B>) => <A>(first: Kind2<F, E, A>) => Kind2<F, E, B>
|
||||
export declare function apSecond<F extends URIS2, E>(
|
||||
A: Apply2C<F, E>
|
||||
): <B>(second: Kind2<F, E, B>) => <A>(first: Kind2<F, E, A>) => Kind2<F, E, B>
|
||||
export declare function apSecond<F extends URIS>(
|
||||
A: Apply1<F>
|
||||
): <B>(second: Kind<F, B>) => <A>(first: Kind<F, A>) => Kind<F, B>
|
||||
export declare function apSecond<F>(A: Apply<F>): <B>(second: HKT<F, B>) => <A>(first: HKT<F, A>) => HKT<F, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function apS<F extends URIS4>(
|
||||
F: Apply4<F>
|
||||
): <N extends string, A, S, R, E, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: Kind4<F, S, R, E, B>
|
||||
) => (fa: Kind4<F, S, R, E, A>) => Kind4<
|
||||
F,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function apS<F extends URIS3>(
|
||||
F: Apply3<F>
|
||||
): <N extends string, A, R, E, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: Kind3<F, R, E, B>
|
||||
) => (fa: Kind3<F, R, E, A>) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function apS<F extends URIS3, E>(
|
||||
F: Apply3C<F, E>
|
||||
): <N extends string, A, R, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: Kind3<F, R, E, B>
|
||||
) => (fa: Kind3<F, R, E, A>) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function apS<F extends URIS2>(
|
||||
F: Apply2<F>
|
||||
): <N extends string, A, E, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: Kind2<F, E, B>
|
||||
) => (fa: Kind2<F, E, A>) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function apS<F extends URIS2, E>(
|
||||
F: Apply2C<F, E>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: Kind2<F, E, B>
|
||||
) => (fa: Kind2<F, E, A>) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function apS<F extends URIS>(
|
||||
F: Apply1<F>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: Kind<F, B>
|
||||
) => (fa: Kind<F, A>) => Kind<
|
||||
F,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function apS<F>(F: Apply<F>): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: HKT<F, B>
|
||||
) => (fa: HKT<F, A>) => 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 extends URIS4>(
|
||||
F: Apply4<F>
|
||||
): <A, S, R, E>(S: Semigroup<A>) => Semigroup<Kind4<F, S, R, E, A>>
|
||||
export declare function getApplySemigroup<F extends URIS3>(
|
||||
F: Apply3<F>
|
||||
): <A, R, E>(S: Semigroup<A>) => Semigroup<Kind3<F, R, E, A>>
|
||||
export declare function getApplySemigroup<F extends URIS3, E>(
|
||||
F: Apply3C<F, E>
|
||||
): <A, R>(S: Semigroup<A>) => Semigroup<Kind3<F, R, E, A>>
|
||||
export declare function getApplySemigroup<F extends URIS2>(
|
||||
F: Apply2<F>
|
||||
): <A, E>(S: Semigroup<A>) => Semigroup<Kind2<F, E, A>>
|
||||
export declare function getApplySemigroup<F extends URIS2, E>(
|
||||
F: Apply2C<F, E>
|
||||
): <A>(S: Semigroup<A>) => Semigroup<Kind2<F, E, A>>
|
||||
export declare function getApplySemigroup<F extends URIS>(F: Apply1<F>): <A>(S: Semigroup<A>) => Semigroup<Kind<F, A>>
|
||||
export declare function getApplySemigroup<F>(F: Apply<F>): <A>(S: Semigroup<A>) => Semigroup<HKT<F, A>>
|
||||
/**
|
||||
* 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 extends URIS4>(
|
||||
F: Apply4<F>
|
||||
): <S, R, E, T extends Array<Kind4<F, S, R, E, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: Kind4<F, S, R, E, any>
|
||||
}
|
||||
) => Kind4<
|
||||
F,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [Kind4<F, S, R, E, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceT<F extends URIS3>(
|
||||
F: Apply3<F>
|
||||
): <R, E, T extends Array<Kind3<F, R, E, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: Kind3<F, R, E, any>
|
||||
}
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [Kind3<F, R, E, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceT<F extends URIS3, E>(
|
||||
F: Apply3C<F, E>
|
||||
): <R, T extends Array<Kind3<F, R, E, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: Kind3<F, R, E, any>
|
||||
}
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [Kind3<F, R, E, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceT<F extends URIS2>(
|
||||
F: Apply2<F>
|
||||
): <E, T extends Array<Kind2<F, E, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: Kind2<F, E, any>
|
||||
}
|
||||
) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [Kind2<F, E, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceT<F extends URIS2, E>(
|
||||
F: Apply2C<F, E>
|
||||
): <T extends Array<Kind2<F, E, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: Kind2<F, E, any>
|
||||
}
|
||||
) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [Kind2<F, E, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceT<F extends URIS>(
|
||||
F: Apply1<F>
|
||||
): <T extends Array<Kind<F, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: Kind<F, any>
|
||||
}
|
||||
) => Kind<
|
||||
F,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [Kind<F, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceT<F>(F: Apply<F>): <T extends Array<HKT<F, any>>>(
|
||||
...t: T & {
|
||||
readonly 0: HKT<F, any>
|
||||
}
|
||||
) => HKT<
|
||||
F,
|
||||
{
|
||||
[K in keyof T]: [T[K]] extends [HKT<F, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
type EnforceNonEmptyRecord<R> = 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 extends URIS4>(
|
||||
F: Apply4<F>
|
||||
): <S, R, E, NER extends Record<string, Kind4<F, S, R, E, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER> & Record<string, Kind4<F, S, R, E, any>>
|
||||
) => Kind4<
|
||||
F,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [Kind4<F, any, any, any, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceS<F extends URIS3>(
|
||||
F: Apply3<F>
|
||||
): <R, E, NER extends Record<string, Kind3<F, R, E, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER> & Record<string, Kind3<F, R, E, any>>
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [Kind3<F, any, any, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceS<F extends URIS3, E>(
|
||||
F: Apply3C<F, E>
|
||||
): <R, NER extends Record<string, Kind3<F, R, E, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER> & Record<string, Kind3<F, R, E, any>>
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [Kind3<F, any, any, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceS<F extends URIS2>(
|
||||
F: Apply2<F>
|
||||
): <E, NER extends Record<string, Kind2<F, E, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER> & Record<string, Kind2<F, E, any>>
|
||||
) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [Kind2<F, any, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceS<F extends URIS2, E>(
|
||||
F: Apply2C<F, E>
|
||||
): <NER extends Record<string, Kind2<F, E, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER>
|
||||
) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [Kind2<F, any, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceS<F extends URIS>(
|
||||
F: Apply1<F>
|
||||
): <NER extends Record<string, Kind<F, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER>
|
||||
) => Kind<
|
||||
F,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [Kind<F, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export declare function sequenceS<F>(F: Apply<F>): <NER extends Record<string, HKT<F, any>>>(
|
||||
r: EnforceNonEmptyRecord<NER>
|
||||
) => HKT<
|
||||
F,
|
||||
{
|
||||
[K in keyof NER]: [NER[K]] extends [HKT<F, infer A>] ? A : never
|
||||
}
|
||||
>
|
||||
export {}
|
||||
210
node_modules/fp-ts/lib/Apply.js
generated
vendored
Normal file
210
node_modules/fp-ts/lib/Apply.js
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ap = ap;
|
||||
exports.apFirst = apFirst;
|
||||
exports.apSecond = apSecond;
|
||||
exports.apS = apS;
|
||||
exports.getApplySemigroup = getApplySemigroup;
|
||||
exports.sequenceT = sequenceT;
|
||||
exports.sequenceS = sequenceS;
|
||||
/**
|
||||
* The `Apply` class provides the `ap` which is used to apply a function to an argument under a type constructor.
|
||||
*
|
||||
* `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor
|
||||
* `f`.
|
||||
*
|
||||
* Instances must satisfy the following law in addition to the `Functor` laws:
|
||||
*
|
||||
* 1. Associative composition: `F.ap(F.ap(F.map(fbc, bc => ab => a => bc(ab(a))), fab), fa) <-> F.ap(fbc, F.ap(fab, fa))`
|
||||
*
|
||||
* Formally, `Apply` represents a strong lax semi-monoidal endofunctor.
|
||||
*
|
||||
* @example
|
||||
* import * as O from 'fp-ts/Option'
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
*
|
||||
* const f = (a: string) => (b: number) => (c: boolean) => a + String(b) + String(c)
|
||||
* const fa: O.Option<string> = O.some('s')
|
||||
* const fb: O.Option<number> = O.some(1)
|
||||
* const fc: O.Option<boolean> = O.some(true)
|
||||
*
|
||||
* assert.deepStrictEqual(
|
||||
* pipe(
|
||||
* // lift a function
|
||||
* O.some(f),
|
||||
* // apply the first argument
|
||||
* O.ap(fa),
|
||||
* // apply the second argument
|
||||
* O.ap(fb),
|
||||
* // apply the third argument
|
||||
* O.ap(fc)
|
||||
* ),
|
||||
* O.some('s1true')
|
||||
* )
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var function_1 = require("./function");
|
||||
var _ = __importStar(require("./internal"));
|
||||
function ap(F, G) {
|
||||
return function (fa) {
|
||||
return function (fab) {
|
||||
return F.ap(F.map(fab, function (gab) { return function (ga) { return G.ap(gab, ga); }; }), fa);
|
||||
};
|
||||
};
|
||||
}
|
||||
function apFirst(A) {
|
||||
return function (second) { return function (first) {
|
||||
return A.ap(A.map(first, function (a) { return function () { return a; }; }), second);
|
||||
}; };
|
||||
}
|
||||
function apSecond(A) {
|
||||
return function (second) {
|
||||
return function (first) {
|
||||
return A.ap(A.map(first, function () { return function (b) { return b; }; }), second);
|
||||
};
|
||||
};
|
||||
}
|
||||
function apS(F) {
|
||||
return function (name, fb) {
|
||||
return function (fa) {
|
||||
return F.ap(F.map(fa, function (a) { return function (b) {
|
||||
var _a;
|
||||
return Object.assign({}, a, (_a = {}, _a[name] = b, _a));
|
||||
}; }), fb);
|
||||
};
|
||||
};
|
||||
}
|
||||
function getApplySemigroup(F) {
|
||||
return function (S) { return ({
|
||||
concat: function (first, second) {
|
||||
return F.ap(F.map(first, function (x) { return function (y) { return S.concat(x, y); }; }), second);
|
||||
}
|
||||
}); };
|
||||
}
|
||||
function curried(f, n, acc) {
|
||||
return function (x) {
|
||||
var combined = Array(acc.length + 1);
|
||||
for (var i = 0; i < acc.length; i++) {
|
||||
combined[i] = acc[i];
|
||||
}
|
||||
combined[acc.length] = x;
|
||||
return n === 0 ? f.apply(null, combined) : curried(f, n - 1, combined);
|
||||
};
|
||||
}
|
||||
var tupleConstructors = {
|
||||
1: function (a) { return [a]; },
|
||||
2: function (a) { return function (b) { return [a, b]; }; },
|
||||
3: function (a) { return function (b) { return function (c) { return [a, b, c]; }; }; },
|
||||
4: function (a) { return function (b) { return function (c) { return function (d) { return [a, b, c, d]; }; }; }; },
|
||||
5: function (a) { return function (b) { return function (c) { return function (d) { return function (e) { return [a, b, c, d, e]; }; }; }; }; }
|
||||
};
|
||||
function getTupleConstructor(len) {
|
||||
if (!_.has.call(tupleConstructors, len)) {
|
||||
tupleConstructors[len] = curried(function_1.tuple, len - 1, []);
|
||||
}
|
||||
return tupleConstructors[len];
|
||||
}
|
||||
function sequenceT(F) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var len = args.length;
|
||||
var f = getTupleConstructor(len);
|
||||
var fas = F.map(args[0], f);
|
||||
for (var i = 1; i < len; i++) {
|
||||
fas = F.ap(fas, args[i]);
|
||||
}
|
||||
return fas;
|
||||
};
|
||||
}
|
||||
function getRecordConstructor(keys) {
|
||||
var len = keys.length;
|
||||
switch (len) {
|
||||
case 1:
|
||||
return function (a) {
|
||||
var _a;
|
||||
return (_a = {}, _a[keys[0]] = a, _a);
|
||||
};
|
||||
case 2:
|
||||
return function (a) { return function (b) {
|
||||
var _a;
|
||||
return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a);
|
||||
}; };
|
||||
case 3:
|
||||
return function (a) { return function (b) { return function (c) {
|
||||
var _a;
|
||||
return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a[keys[2]] = c, _a);
|
||||
}; }; };
|
||||
case 4:
|
||||
return function (a) { return function (b) { return function (c) { return function (d) {
|
||||
var _a;
|
||||
return (_a = {},
|
||||
_a[keys[0]] = a,
|
||||
_a[keys[1]] = b,
|
||||
_a[keys[2]] = c,
|
||||
_a[keys[3]] = d,
|
||||
_a);
|
||||
}; }; }; };
|
||||
case 5:
|
||||
return function (a) { return function (b) { return function (c) { return function (d) { return function (e) {
|
||||
var _a;
|
||||
return (_a = {},
|
||||
_a[keys[0]] = a,
|
||||
_a[keys[1]] = b,
|
||||
_a[keys[2]] = c,
|
||||
_a[keys[3]] = d,
|
||||
_a[keys[4]] = e,
|
||||
_a);
|
||||
}; }; }; }; };
|
||||
default:
|
||||
return curried(function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var r = {};
|
||||
for (var i = 0; i < len; i++) {
|
||||
r[keys[i]] = args[i];
|
||||
}
|
||||
return r;
|
||||
}, len - 1, []);
|
||||
}
|
||||
}
|
||||
function sequenceS(F) {
|
||||
return function (r) {
|
||||
var keys = Object.keys(r);
|
||||
var len = keys.length;
|
||||
var f = getRecordConstructor(keys);
|
||||
var fr = F.map(r[keys[0]], f);
|
||||
for (var i = 1; i < len; i++) {
|
||||
fr = F.ap(fr, r[keys[i]]);
|
||||
}
|
||||
return fr;
|
||||
};
|
||||
}
|
||||
2215
node_modules/fp-ts/lib/Array.d.ts
generated
vendored
Normal file
2215
node_modules/fp-ts/lib/Array.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2621
node_modules/fp-ts/lib/Array.js
generated
vendored
Normal file
2621
node_modules/fp-ts/lib/Array.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
60
node_modules/fp-ts/lib/Bifunctor.d.ts
generated
vendored
Normal file
60
node_modules/fp-ts/lib/Bifunctor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Bifunctor<F> {
|
||||
readonly URI: F
|
||||
readonly bimap: <E, A, G, B>(fea: HKT2<F, E, A>, f: (e: E) => G, g: (a: A) => B) => HKT2<F, G, B>
|
||||
readonly mapLeft: <E, A, G>(fea: HKT2<F, E, A>, f: (e: E) => G) => HKT2<F, G, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Bifunctor2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly bimap: <E, A, G, B>(fea: Kind2<F, E, A>, f: (e: E) => G, g: (a: A) => B) => Kind2<F, G, B>
|
||||
readonly mapLeft: <E, A, G>(fea: Kind2<F, E, A>, f: (e: E) => G) => Kind2<F, G, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Bifunctor2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly bimap: <A, G, B>(fea: Kind2<F, E, A>, f: (e: E) => G, g: (a: A) => B) => Kind2<F, G, B>
|
||||
readonly mapLeft: <A, M>(fea: Kind2<F, E, A>, f: (e: E) => M) => Kind2<F, M, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Bifunctor3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly bimap: <R, E, A, G, B>(fea: Kind3<F, R, E, A>, f: (e: E) => G, g: (a: A) => B) => Kind3<F, R, G, B>
|
||||
readonly mapLeft: <R, E, A, G>(fea: Kind3<F, R, E, A>, f: (e: E) => G) => Kind3<F, R, G, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Bifunctor3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly bimap: <R, A, G, B>(fea: Kind3<F, R, E, A>, f: (e: E) => G, g: (a: A) => B) => Kind3<F, R, G, B>
|
||||
readonly mapLeft: <R, A, G>(fea: Kind3<F, R, E, A>, f: (e: E) => G) => Kind3<F, R, G, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Bifunctor4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly bimap: <S, R, E, A, G, B>(fea: Kind4<F, S, R, E, A>, f: (e: E) => G, g: (a: A) => B) => Kind4<F, S, R, G, B>
|
||||
readonly mapLeft: <S, R, E, A, G>(fea: Kind4<F, S, R, E, A>, f: (e: E) => G) => Kind4<F, S, R, G, A>
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Bifunctor.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Bifunctor.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
43
node_modules/fp-ts/lib/BooleanAlgebra.d.ts
generated
vendored
Normal file
43
node_modules/fp-ts/lib/BooleanAlgebra.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { HeytingAlgebra } from './HeytingAlgebra'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface BooleanAlgebra<A> extends HeytingAlgebra<A> {}
|
||||
/**
|
||||
* Every boolean algebras has a dual algebra, which involves reversing one/zero as well as join/meet.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const reverse: <A>(B: BooleanAlgebra<A>) => BooleanAlgebra<A>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const booleanAlgebraVoid: BooleanAlgebra<void>
|
||||
/**
|
||||
* Use [`reverse`](#reverse) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const getDualBooleanAlgebra: <A>(B: BooleanAlgebra<A>) => BooleanAlgebra<A>
|
||||
/**
|
||||
* Use [`BooleanAlgebra`](./boolean.ts.html#booleanalgebra) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const booleanAlgebraBoolean: BooleanAlgebra<boolean>
|
||||
/**
|
||||
* Use [`getBooleanAlgebra`](./function.ts.html#getbooleanalgebra) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const getFunctionBooleanAlgebra: <B>(
|
||||
B: BooleanAlgebra<B>
|
||||
) => <A = never>() => BooleanAlgebra<(a: A) => B>
|
||||
82
node_modules/fp-ts/lib/BooleanAlgebra.js
generated
vendored
Normal file
82
node_modules/fp-ts/lib/BooleanAlgebra.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getFunctionBooleanAlgebra = exports.booleanAlgebraBoolean = exports.getDualBooleanAlgebra = exports.booleanAlgebraVoid = exports.reverse = void 0;
|
||||
/**
|
||||
* Boolean algebras are Heyting algebras with the additional constraint that the law of the excluded middle is true
|
||||
* (equivalently, double-negation is true).
|
||||
*
|
||||
* Instances should satisfy the following laws in addition to the `HeytingAlgebra` laws:
|
||||
*
|
||||
* - Excluded middle: `a ∨ ¬a <-> 1`
|
||||
*
|
||||
* Boolean algebras generalize classical logic: one is equivalent to "true" and zero is equivalent to "false".
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var function_1 = require("./function");
|
||||
// -------------------------------------------------------------------------------------
|
||||
// combinators
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Every boolean algebras has a dual algebra, which involves reversing one/zero as well as join/meet.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var reverse = function (B) { return ({
|
||||
meet: function (x, y) { return B.join(x, y); },
|
||||
join: function (x, y) { return B.meet(x, y); },
|
||||
zero: B.one,
|
||||
one: B.zero,
|
||||
implies: function (x, y) { return B.join(B.not(x), y); },
|
||||
not: B.not
|
||||
}); };
|
||||
exports.reverse = reverse;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// instances
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.booleanAlgebraVoid = {
|
||||
meet: function () { return undefined; },
|
||||
join: function () { return undefined; },
|
||||
zero: undefined,
|
||||
one: undefined,
|
||||
implies: function () { return undefined; },
|
||||
not: function () { return undefined; }
|
||||
};
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Use [`reverse`](#reverse) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.getDualBooleanAlgebra = exports.reverse;
|
||||
/**
|
||||
* Use [`BooleanAlgebra`](./boolean.ts.html#booleanalgebra) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.booleanAlgebraBoolean = {
|
||||
meet: function (x, y) { return x && y; },
|
||||
join: function (x, y) { return x || y; },
|
||||
zero: false,
|
||||
one: true,
|
||||
implies: function (x, y) { return !x || y; },
|
||||
not: function (x) { return !x; }
|
||||
};
|
||||
/**
|
||||
* Use [`getBooleanAlgebra`](./function.ts.html#getbooleanalgebra) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.getFunctionBooleanAlgebra = function_1.getBooleanAlgebra;
|
||||
41
node_modules/fp-ts/lib/Bounded.d.ts
generated
vendored
Normal file
41
node_modules/fp-ts/lib/Bounded.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* The `Bounded` type class represents totally ordered types that have an upper and lower boundary.
|
||||
*
|
||||
* Instances should satisfy the following law in addition to the `Ord` laws:
|
||||
*
|
||||
* - Bounded: `bottom <= a <= top`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import * as O from './Ord'
|
||||
import Ord = O.Ord
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Bounded<A> extends Ord<A> {
|
||||
readonly top: A
|
||||
readonly bottom: A
|
||||
}
|
||||
/**
|
||||
* Clamp a value between bottom and top values.
|
||||
*
|
||||
* @category utils
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const clamp: <A>(B: Bounded<A>) => (a: A) => A
|
||||
/**
|
||||
* Reverses the Ord of a bound and swaps top and bottom values.
|
||||
*
|
||||
* @category utils
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const reverse: <A>(B: Bounded<A>) => Bounded<A>
|
||||
/**
|
||||
* Use [`Bounded`](./number.ts.html#bounded) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const boundedNumber: Bounded<number>
|
||||
79
node_modules/fp-ts/lib/Bounded.js
generated
vendored
Normal file
79
node_modules/fp-ts/lib/Bounded.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.boundedNumber = exports.reverse = exports.clamp = void 0;
|
||||
/**
|
||||
* The `Bounded` type class represents totally ordered types that have an upper and lower boundary.
|
||||
*
|
||||
* Instances should satisfy the following law in addition to the `Ord` laws:
|
||||
*
|
||||
* - Bounded: `bottom <= a <= top`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var O = __importStar(require("./Ord"));
|
||||
// -------------------------------------------------------------------------------------
|
||||
// utils
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Clamp a value between bottom and top values.
|
||||
*
|
||||
* @category utils
|
||||
* @since 2.12.0
|
||||
*/
|
||||
var clamp = function (B) { return O.clamp(B)(B.bottom, B.top); };
|
||||
exports.clamp = clamp;
|
||||
/**
|
||||
* Reverses the Ord of a bound and swaps top and bottom values.
|
||||
*
|
||||
* @category utils
|
||||
* @since 2.12.0
|
||||
*/
|
||||
var reverse = function (B) {
|
||||
var R = O.reverse(B);
|
||||
return {
|
||||
equals: R.equals,
|
||||
compare: R.compare,
|
||||
top: B.bottom,
|
||||
bottom: B.top
|
||||
};
|
||||
};
|
||||
exports.reverse = reverse;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Use [`Bounded`](./number.ts.html#bounded) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.boundedNumber = {
|
||||
equals: O.ordNumber.equals,
|
||||
compare: O.ordNumber.compare,
|
||||
top: Infinity,
|
||||
bottom: -Infinity
|
||||
};
|
||||
20
node_modules/fp-ts/lib/BoundedDistributiveLattice.d.ts
generated
vendored
Normal file
20
node_modules/fp-ts/lib/BoundedDistributiveLattice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* A `BoundedDistributiveLattice` is a lattice that is both bounded and distributive
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { BoundedLattice } from './BoundedLattice'
|
||||
import { DistributiveLattice } from './DistributiveLattice'
|
||||
import { Ord } from './Ord'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface BoundedDistributiveLattice<A> extends BoundedLattice<A>, DistributiveLattice<A> {}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function getMinMaxBoundedDistributiveLattice<A>(
|
||||
O: Ord<A>
|
||||
): (min: A, max: A) => BoundedDistributiveLattice<A>
|
||||
20
node_modules/fp-ts/lib/BoundedDistributiveLattice.js
generated
vendored
Normal file
20
node_modules/fp-ts/lib/BoundedDistributiveLattice.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getMinMaxBoundedDistributiveLattice = getMinMaxBoundedDistributiveLattice;
|
||||
var DistributiveLattice_1 = require("./DistributiveLattice");
|
||||
// -------------------------------------------------------------------------------------
|
||||
// constructors
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function getMinMaxBoundedDistributiveLattice(O) {
|
||||
var L = (0, DistributiveLattice_1.getMinMaxDistributiveLattice)(O);
|
||||
return function (min, max) { return ({
|
||||
join: L.join,
|
||||
meet: L.meet,
|
||||
zero: min,
|
||||
one: max
|
||||
}); };
|
||||
}
|
||||
15
node_modules/fp-ts/lib/BoundedJoinSemilattice.d.ts
generated
vendored
Normal file
15
node_modules/fp-ts/lib/BoundedJoinSemilattice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* A `BoundedJoinSemilattice` must satisfy the following laws in addition to `JoinSemilattice` laws:
|
||||
*
|
||||
* - `a ∨ 0 <-> a`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { JoinSemilattice } from './JoinSemilattice'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface BoundedJoinSemilattice<A> extends JoinSemilattice<A> {
|
||||
readonly zero: A
|
||||
}
|
||||
2
node_modules/fp-ts/lib/BoundedJoinSemilattice.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/BoundedJoinSemilattice.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
15
node_modules/fp-ts/lib/BoundedLattice.d.ts
generated
vendored
Normal file
15
node_modules/fp-ts/lib/BoundedLattice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* A `BoundedLattice` must satisfy the following in addition to `BoundedMeetSemilattice` and `BoundedJoinSemilattice` laws:
|
||||
*
|
||||
* - Absorption law for meet: `a ∧ (a ∨ b) <-> a`
|
||||
* - Absorption law for join: `a ∨ (a ∧ b) <-> a`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { BoundedJoinSemilattice } from './BoundedJoinSemilattice'
|
||||
import { BoundedMeetSemilattice } from './BoundedMeetSemilattice'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface BoundedLattice<A> extends BoundedJoinSemilattice<A>, BoundedMeetSemilattice<A> {}
|
||||
2
node_modules/fp-ts/lib/BoundedLattice.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/BoundedLattice.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
15
node_modules/fp-ts/lib/BoundedMeetSemilattice.d.ts
generated
vendored
Normal file
15
node_modules/fp-ts/lib/BoundedMeetSemilattice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* A `BoundedMeetSemilattice` must satisfy the following laws in addition to `MeetSemilattice` laws:
|
||||
*
|
||||
* - `a ∧ 1 <-> a`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { MeetSemilattice } from './MeetSemilattice'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface BoundedMeetSemilattice<A> extends MeetSemilattice<A> {
|
||||
readonly one: A
|
||||
}
|
||||
2
node_modules/fp-ts/lib/BoundedMeetSemilattice.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/BoundedMeetSemilattice.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
33
node_modules/fp-ts/lib/Category.d.ts
generated
vendored
Normal file
33
node_modules/fp-ts/lib/Category.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Semigroupoid, Semigroupoid2, Semigroupoid3, Semigroupoid4 } from './Semigroupoid'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Category<F> extends Semigroupoid<F> {
|
||||
readonly id: <A>() => HKT2<F, A, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Category2<F extends URIS2> extends Semigroupoid2<F> {
|
||||
readonly id: <A>() => Kind2<F, A, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Category3<F extends URIS3> extends Semigroupoid3<F> {
|
||||
readonly id: <R, A>() => Kind3<F, R, A, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Category4<F extends URIS4> extends Semigroupoid4<F> {
|
||||
readonly id: <S, R, A>() => Kind4<F, S, R, A, A>
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Category.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Category.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
172
node_modules/fp-ts/lib/Chain.d.ts
generated
vendored
Normal file
172
node_modules/fp-ts/lib/Chain.d.ts
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* The `Chain` type class extends the `Apply` type class with a `chain` operation which composes computations in
|
||||
* sequence, using the return value of one computation to determine the next computation.
|
||||
*
|
||||
* Instances must satisfy the following law in addition to the `Apply` laws:
|
||||
*
|
||||
* 1. Associativity: `F.chain(F.chain(fa, afb), bfc) <-> F.chain(fa, a => F.chain(afb(a), bfc))`
|
||||
*
|
||||
* Note. `Apply`'s `ap` can be derived: `(fab, fa) => F.chain(fab, f => F.map(fa, f))`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Apply, Apply1, Apply2, Apply2C, Apply3, Apply3C, Apply4 } from './Apply'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Chain<F> extends Apply<F> {
|
||||
readonly chain: <A, B>(fa: HKT<F, A>, f: (a: A) => HKT<F, B>) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Chain1<F extends URIS> extends Apply1<F> {
|
||||
readonly chain: <A, B>(fa: Kind<F, A>, f: (a: A) => Kind<F, B>) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Chain2<F extends URIS2> extends Apply2<F> {
|
||||
readonly chain: <E, A, B>(fa: Kind2<F, E, A>, f: (a: A) => Kind2<F, E, B>) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Chain2C<F extends URIS2, E> extends Apply2C<F, E> {
|
||||
readonly chain: <A, B>(fa: Kind2<F, E, A>, f: (a: A) => Kind2<F, E, B>) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Chain3<F extends URIS3> extends Apply3<F> {
|
||||
readonly chain: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => Kind3<F, R, E, B>) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Chain3C<F extends URIS3, E> extends Apply3C<F, E> {
|
||||
readonly chain: <R, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => Kind3<F, R, E, B>) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Chain4<F extends URIS4> extends Apply4<F> {
|
||||
readonly chain: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (a: A) => Kind4<F, S, R, E, B>) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainFirst<M extends URIS4>(
|
||||
M: Chain4<M>
|
||||
): <A, S, R, E, _>(f: (a: A) => Kind4<M, S, R, E, _>) => (first: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, A>
|
||||
export declare function chainFirst<M extends URIS3>(
|
||||
M: Chain3<M>
|
||||
): <A, R, E, _>(f: (a: A) => Kind3<M, R, E, _>) => (first: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirst<M extends URIS3, E>(
|
||||
M: Chain3C<M, E>
|
||||
): <A, R, _>(f: (a: A) => Kind3<M, R, E, _>) => (first: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirst<M extends URIS2>(
|
||||
M: Chain2<M>
|
||||
): <A, E, _>(f: (a: A) => Kind2<M, E, _>) => (first: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirst<M extends URIS2, E>(
|
||||
M: Chain2C<M, E>
|
||||
): <A, _>(f: (a: A) => Kind2<M, E, _>) => (first: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirst<M extends URIS>(
|
||||
M: Chain1<M>
|
||||
): <A, _>(f: (a: A) => Kind<M, _>) => (first: Kind<M, A>) => Kind<M, A>
|
||||
export declare function chainFirst<M>(M: Chain<M>): <A, _>(f: (a: A) => HKT<M, _>) => (first: HKT<M, A>) => HKT<M, A>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function bind<M extends URIS4>(
|
||||
M: Chain4<M>
|
||||
): <N extends string, A, S, R, E, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => Kind4<M, S, R, E, B>
|
||||
) => (ma: Kind4<M, S, R, E, A>) => Kind4<
|
||||
M,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function bind<M extends URIS3>(
|
||||
M: Chain3<M>
|
||||
): <N extends string, A, R, E, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => Kind3<M, R, E, B>
|
||||
) => (ma: Kind3<M, R, E, A>) => Kind3<
|
||||
M,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function bind<M extends URIS3, E>(
|
||||
M: Chain3C<M, E>
|
||||
): <N extends string, A, R, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => Kind3<M, R, E, B>
|
||||
) => (ma: Kind3<M, R, E, A>) => Kind3<
|
||||
M,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function bind<M extends URIS2>(
|
||||
M: Chain2<M>
|
||||
): <N extends string, A, E, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => Kind2<M, E, B>
|
||||
) => (ma: Kind2<M, E, A>) => Kind2<
|
||||
M,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function bind<M extends URIS2, E>(
|
||||
M: Chain2C<M, E>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => Kind2<M, E, B>
|
||||
) => (ma: Kind2<M, E, A>) => Kind2<
|
||||
M,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function bind<M extends URIS>(
|
||||
M: Chain1<M>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => Kind<M, B>
|
||||
) => (ma: Kind<M, A>) => Kind<
|
||||
M,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export declare function bind<M>(M: Chain<M>): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => HKT<M, B>
|
||||
) => (ma: HKT<M, A>) => HKT<
|
||||
M,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
19
node_modules/fp-ts/lib/Chain.js
generated
vendored
Normal file
19
node_modules/fp-ts/lib/Chain.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.chainFirst = chainFirst;
|
||||
exports.tap = tap;
|
||||
exports.bind = bind;
|
||||
function chainFirst(M) {
|
||||
var tapM = tap(M);
|
||||
return function (f) { return function (first) { return tapM(first, f); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function tap(M) {
|
||||
return function (first, f) { return M.chain(first, function (a) { return M.map(f(a), function () { return a; }); }); };
|
||||
}
|
||||
function bind(M) {
|
||||
return function (name, f) { return function (ma) { return M.chain(ma, function (a) { return M.map(f(a), function (b) {
|
||||
var _a;
|
||||
return Object.assign({}, a, (_a = {}, _a[name] = b, _a));
|
||||
}); }); }; };
|
||||
}
|
||||
59
node_modules/fp-ts/lib/ChainRec.d.ts
generated
vendored
Normal file
59
node_modules/fp-ts/lib/ChainRec.d.ts
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C, Chain4 } from './Chain'
|
||||
import { Either } from './Either'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface ChainRec<F> extends Chain<F> {
|
||||
readonly chainRec: <A, B>(a: A, f: (a: A) => HKT<F, Either<A, B>>) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface ChainRec1<F extends URIS> extends Chain1<F> {
|
||||
readonly chainRec: <A, B>(a: A, f: (a: A) => Kind<F, Either<A, B>>) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface ChainRec2<F extends URIS2> extends Chain2<F> {
|
||||
readonly chainRec: <E, A, B>(a: A, f: (a: A) => Kind2<F, E, Either<A, B>>) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface ChainRec2C<F extends URIS2, E> extends Chain2C<F, E> {
|
||||
readonly chainRec: <A, B>(a: A, f: (a: A) => Kind2<F, E, Either<A, B>>) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface ChainRec3<F extends URIS3> extends Chain3<F> {
|
||||
readonly chainRec: <R, E, A, B>(a: A, f: (a: A) => Kind3<F, R, E, Either<A, B>>) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface ChainRec3C<F extends URIS3, E> extends Chain3C<F, E> {
|
||||
readonly chainRec: <R, A, B>(a: A, f: (a: A) => Kind3<F, R, E, Either<A, B>>) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface ChainRec4<F extends URIS4> extends Chain4<F> {
|
||||
readonly chainRec: <S, R, E, A, B>(a: A, f: (a: A) => Kind4<F, S, R, E, Either<A, B>>) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const tailRec: <A, B>(startWith: A, f: (a: A) => Either<A, B>) => B
|
||||
14
node_modules/fp-ts/lib/ChainRec.js
generated
vendored
Normal file
14
node_modules/fp-ts/lib/ChainRec.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tailRec = void 0;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var tailRec = function (startWith, f) {
|
||||
var ab = f(startWith);
|
||||
while (ab._tag === 'Left') {
|
||||
ab = f(ab.left);
|
||||
}
|
||||
return ab.right;
|
||||
};
|
||||
exports.tailRec = tailRec;
|
||||
174
node_modules/fp-ts/lib/Choice.d.ts
generated
vendored
Normal file
174
node_modules/fp-ts/lib/Choice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* The `Choice` class extends `Profunctor` with combinators for working with
|
||||
* sum types.
|
||||
*
|
||||
* `left` and `right` lift values in a `Profunctor` to act on the `Left` and
|
||||
* `Right` components of a sum, respectively.
|
||||
*
|
||||
* Looking at `Choice` through the intuition of inputs and outputs
|
||||
* yields the following type signature:
|
||||
*
|
||||
* ```purescript
|
||||
* left :: forall input output a. p input output -> p (Either input a) (Either output a)
|
||||
* right :: forall input output a. p input output -> p (Either a input) (Either a output)
|
||||
* ```
|
||||
*
|
||||
* If we specialize the profunctor `p` to the `function` arrow, we get the following type
|
||||
* signatures:
|
||||
*
|
||||
* ```purescript
|
||||
* left :: forall input output a. (input -> output) -> (Either input a) -> (Either output a)
|
||||
* right :: forall input output a. (input -> output) -> (Either a input) -> (Either a output)
|
||||
* ```
|
||||
*
|
||||
* When the `profunctor` is `Function` application, `left` allows you to map a function over the
|
||||
* left side of an `Either`, and `right` maps it over the right side (same as `map` would do).
|
||||
*
|
||||
* Adapted from https://github.com/purescript/purescript-profunctor/blob/master/src/Data/Profunctor/Choice.purs
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Category, Category2, Category3, Category4 } from './Category'
|
||||
import { Either } from './Either'
|
||||
import { HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Profunctor, Profunctor2, Profunctor3, Profunctor4 } from './Profunctor'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Choice<F> extends Profunctor<F> {
|
||||
readonly left: <A, B, C>(pab: HKT2<F, A, B>) => HKT2<F, Either<A, C>, Either<B, C>>
|
||||
readonly right: <A, B, C>(pbc: HKT2<F, B, C>) => HKT2<F, Either<A, B>, Either<A, C>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Choice2<F extends URIS2> extends Profunctor2<F> {
|
||||
readonly left: <A, B, C>(pab: Kind2<F, A, B>) => Kind2<F, Either<A, C>, Either<B, C>>
|
||||
readonly right: <A, B, C>(pbc: Kind2<F, B, C>) => Kind2<F, Either<A, B>, Either<A, C>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Choice3<F extends URIS3> extends Profunctor3<F> {
|
||||
readonly left: <R, A, B, C>(pab: Kind3<F, R, A, B>) => Kind3<F, R, Either<A, C>, Either<B, C>>
|
||||
readonly right: <R, A, B, C>(pbc: Kind3<F, R, B, C>) => Kind3<F, R, Either<A, B>, Either<A, C>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Choice4<F extends URIS4> extends Profunctor4<F> {
|
||||
readonly left: <S, R, A, B, C>(pab: Kind4<F, S, R, A, B>) => Kind4<F, S, R, Either<A, C>, Either<B, C>>
|
||||
readonly right: <S, R, A, B, C>(pbc: Kind4<F, S, R, B, C>) => Kind4<F, S, R, Either<A, B>, Either<A, C>>
|
||||
}
|
||||
/**
|
||||
* Compose a value acting on a sum from two values, each acting on one of
|
||||
* the components of the sum.
|
||||
*
|
||||
* Specializing `split` to function application would look like this:
|
||||
*
|
||||
* ```purescript
|
||||
* split :: forall a b c d. (a -> b) -> (c -> d) -> (Either a c) -> (Either b d)
|
||||
* ```
|
||||
*
|
||||
* We take two functions, `f` and `g`, and we transform them into a single function which
|
||||
* takes an `Either`and maps `f` over the left side and `g` over the right side. Just like
|
||||
* `bimap` would do for the `Bifunctor` instance of `Either`.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function split<P extends URIS4>(
|
||||
P: Choice4<P>,
|
||||
C: Category4<P>
|
||||
): <S, R, A, B, C, D>(
|
||||
pab: Kind4<P, S, R, A, B>,
|
||||
pcd: Kind4<P, S, R, C, D>
|
||||
) => Kind4<P, S, R, Either<A, C>, Either<B, D>>
|
||||
export declare function split<P extends URIS3>(
|
||||
P: Choice3<P>,
|
||||
C: Category3<P>
|
||||
): <R, A, B, C, D>(pab: Kind3<P, R, A, B>, pcd: Kind3<P, R, C, D>) => Kind3<P, R, Either<A, C>, Either<B, D>>
|
||||
export declare function split<P extends URIS2>(
|
||||
P: Choice2<P>,
|
||||
C: Category2<P>
|
||||
): <A, B, C, D>(pab: Kind2<P, A, B>, pcd: Kind2<P, C, D>) => Kind2<P, Either<A, C>, Either<B, D>>
|
||||
export declare function split<P>(
|
||||
P: Choice<P>,
|
||||
C: Category<P>
|
||||
): <A, B, C, D>(pab: HKT2<P, A, B>, pcd: HKT2<P, C, D>) => HKT2<P, Either<A, C>, Either<B, D>>
|
||||
/**
|
||||
* Compose a value which eliminates a sum from two values, each eliminating
|
||||
* one side of the sum.
|
||||
*
|
||||
* This combinator is useful when assembling values from smaller components,
|
||||
* because it provides a way to support two different types of input.
|
||||
*
|
||||
* Specializing `fanIn` to function application would look like this:
|
||||
*
|
||||
* ```purescript
|
||||
* fanIn :: forall a b c d. (a -> c) -> (b -> c) -> Either a b -> c
|
||||
* ```
|
||||
*
|
||||
* We take two functions, `f` and `g`, which both return the same type `c` and we transform them into a
|
||||
* single function which takes an `Either` value with the parameter type of `f` on the left side and
|
||||
* the parameter type of `g` on the right side. The function then runs either `f` or `g`, depending on
|
||||
* whether the `Either` value is a `Left` or a `Right`.
|
||||
* This allows us to bundle two different computations which both have the same result type into one
|
||||
* function which will run the appropriate computation based on the parameter supplied in the `Either` value.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fanIn<P extends URIS4>(
|
||||
P: Choice4<P>,
|
||||
C: Category4<P>
|
||||
): <S, R, A, B, C>(pac: Kind4<P, S, R, A, C>, pbc: Kind4<P, S, R, B, C>) => Kind4<P, S, R, Either<A, B>, C>
|
||||
export declare function fanIn<P extends URIS3>(
|
||||
P: Choice3<P>,
|
||||
C: Category3<P>
|
||||
): <R, A, B, C>(pac: Kind3<P, R, A, C>, pbc: Kind3<P, R, B, C>) => Kind3<P, R, Either<A, B>, C>
|
||||
export declare function fanIn<P extends URIS2>(
|
||||
P: Choice2<P>,
|
||||
C: Category2<P>
|
||||
): <A, B, C>(pac: Kind2<P, A, C>, pbc: Kind2<P, B, C>) => Kind2<P, Either<A, B>, C>
|
||||
export declare function fanIn<P>(
|
||||
P: Choice<P>,
|
||||
C: Category<P>
|
||||
): <A, B, C>(pac: HKT2<P, A, C>, pbc: HKT2<P, B, C>) => HKT2<P, Either<A, B>, C>
|
||||
/**
|
||||
* Use [`split`](#split) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function splitChoice<F extends URIS3>(
|
||||
F: Category3<F> & Choice3<F>
|
||||
): <R, A, B, C, D>(pab: Kind3<F, R, A, B>, pcd: Kind3<F, R, C, D>) => Kind3<F, R, Either<A, C>, Either<B, D>>
|
||||
/** @deprecated */
|
||||
export declare function splitChoice<F extends URIS2>(
|
||||
F: Category2<F> & Choice2<F>
|
||||
): <A, B, C, D>(pab: Kind2<F, A, B>, pcd: Kind2<F, C, D>) => Kind2<F, Either<A, C>, Either<B, D>>
|
||||
/** @deprecated */
|
||||
export declare function splitChoice<F>(
|
||||
F: Category<F> & Choice<F>
|
||||
): <A, B, C, D>(pab: HKT2<F, A, B>, pcd: HKT2<F, C, D>) => HKT2<F, Either<A, C>, Either<B, D>>
|
||||
/**
|
||||
* Use [`fanIn`](#fanIn) instead.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function fanin<F extends URIS3>(
|
||||
F: Category3<F> & Choice3<F>
|
||||
): <R, A, B, C>(pac: Kind3<F, R, A, C>, pbc: Kind3<F, R, B, C>) => Kind3<F, R, Either<A, B>, C>
|
||||
/** @deprecated */
|
||||
export declare function fanin<F extends URIS2>(
|
||||
F: Category2<F> & Choice2<F>
|
||||
): <A, B, C>(pac: Kind2<F, A, C>, pbc: Kind2<F, B, C>) => Kind2<F, Either<A, B>, C>
|
||||
/** @deprecated */
|
||||
export declare function fanin<F>(
|
||||
F: Category<F> & Choice<F>
|
||||
): <A, B, C>(pac: HKT2<F, A, C>, pbc: HKT2<F, B, C>) => HKT2<F, Either<A, B>, C>
|
||||
22
node_modules/fp-ts/lib/Choice.js
generated
vendored
Normal file
22
node_modules/fp-ts/lib/Choice.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.split = split;
|
||||
exports.fanIn = fanIn;
|
||||
exports.splitChoice = splitChoice;
|
||||
exports.fanin = fanin;
|
||||
var function_1 = require("./function");
|
||||
function split(P, C) {
|
||||
return function (pab, pcd) { return C.compose(P.right(pcd), P.left(pab)); };
|
||||
}
|
||||
function fanIn(P, C) {
|
||||
var splitPC = split(P, C);
|
||||
return function (pac, pbc) {
|
||||
return C.compose(P.promap(C.id(), function (cc) { return (cc._tag === 'Left' ? cc.left : cc.right); }, function_1.identity), splitPC(pac, pbc));
|
||||
};
|
||||
}
|
||||
function splitChoice(F) {
|
||||
return split(F, F);
|
||||
}
|
||||
function fanin(F) {
|
||||
return fanIn(F, F);
|
||||
}
|
||||
54
node_modules/fp-ts/lib/Comonad.d.ts
generated
vendored
Normal file
54
node_modules/fp-ts/lib/Comonad.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Extend, Extend1, Extend2, Extend2C, Extend3, Extend3C, Extend4 } from './Extend'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Comonad<W> extends Extend<W> {
|
||||
readonly extract: <A>(wa: HKT<W, A>) => A
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Comonad1<W extends URIS> extends Extend1<W> {
|
||||
readonly extract: <A>(wa: Kind<W, A>) => A
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Comonad2<W extends URIS2> extends Extend2<W> {
|
||||
readonly extract: <E, A>(wa: Kind2<W, E, A>) => A
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Comonad2C<W extends URIS2, E> extends Extend2C<W, E> {
|
||||
readonly extract: <A>(wa: Kind2<W, E, A>) => A
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Comonad3<W extends URIS3> extends Extend3<W> {
|
||||
readonly extract: <R, E, A>(wa: Kind3<W, R, E, A>) => A
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface Comonad3C<W extends URIS3, E> extends Extend3C<W, E> {
|
||||
readonly extract: <R, A>(wa: Kind3<W, R, E, A>) => A
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface Comonad4<W extends URIS4> extends Extend4<W> {
|
||||
readonly extract: <S, R, E, A>(wa: Kind4<W, S, R, E, A>) => A
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Comonad.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Comonad.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
320
node_modules/fp-ts/lib/Compactable.d.ts
generated
vendored
Normal file
320
node_modules/fp-ts/lib/Compactable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,320 @@
|
||||
/**
|
||||
* `Compactable` represents data structures which can be _compacted_/_filtered_. This is a generalization of
|
||||
* `catOptions` as a new function `compact`. `compact` has relations with `Functor`, `Applicative`,
|
||||
* `Monad`, `Alternative`, and `Traversable` in that we can use these classes to provide the ability to
|
||||
* operate on a data type by eliminating intermediate `None`s. This is useful for representing the filtering out of
|
||||
* values, or failure.
|
||||
*
|
||||
* Adapted from https://github.com/LiamGoodacre/purescript-filterable/blob/master/src/Data/Compactable.purs
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Either } from './Either'
|
||||
import {
|
||||
Functor,
|
||||
Functor1,
|
||||
Functor2,
|
||||
Functor2C,
|
||||
Functor3C,
|
||||
FunctorComposition,
|
||||
FunctorComposition2C1,
|
||||
FunctorComposition11,
|
||||
FunctorComposition12,
|
||||
FunctorComposition12C,
|
||||
FunctorComposition21,
|
||||
FunctorComposition22,
|
||||
FunctorComposition22C,
|
||||
FunctorComposition23,
|
||||
FunctorComposition23C
|
||||
} from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Option } from './Option'
|
||||
import * as S from './Separated'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Compactable<F> {
|
||||
readonly URI: F
|
||||
/**
|
||||
* Compacts a data structure unwrapping inner Option
|
||||
*/
|
||||
readonly compact: <A>(fa: HKT<F, Option<A>>) => HKT<F, A>
|
||||
/**
|
||||
* Separates a data structure moving inner Left to the left side and inner Right to the right side of Separated
|
||||
*/
|
||||
readonly separate: <A, B>(fa: HKT<F, Either<A, B>>) => S.Separated<HKT<F, A>, HKT<F, B>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Compactable1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly compact: <A>(fa: Kind<F, Option<A>>) => Kind<F, A>
|
||||
readonly separate: <A, B>(fa: Kind<F, Either<A, B>>) => S.Separated<Kind<F, A>, Kind<F, B>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Compactable2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly compact: <E, A>(fa: Kind2<F, E, Option<A>>) => Kind2<F, E, A>
|
||||
readonly separate: <E, A, B>(fa: Kind2<F, E, Either<A, B>>) => S.Separated<Kind2<F, E, A>, Kind2<F, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Compactable2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly compact: <A>(fa: Kind2<F, E, Option<A>>) => Kind2<F, E, A>
|
||||
readonly separate: <A, B>(fa: Kind2<F, E, Either<A, B>>) => S.Separated<Kind2<F, E, A>, Kind2<F, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Compactable3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly compact: <R, E, A>(fa: Kind3<F, R, E, Option<A>>) => Kind3<F, R, E, A>
|
||||
readonly separate: <R, E, A, B>(fa: Kind3<F, R, E, Either<A, B>>) => S.Separated<Kind3<F, R, E, A>, Kind3<F, R, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Compactable3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly compact: <R, A>(fa: Kind3<F, R, E, Option<A>>) => Kind3<F, R, E, A>
|
||||
readonly separate: <R, A, B>(fa: Kind3<F, R, E, Either<A, B>>) => S.Separated<Kind3<F, R, E, A>, Kind3<F, R, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Compactable4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly compact: <S, R, E, A>(fa: Kind4<F, S, R, E, Option<A>>) => Kind4<F, S, R, E, A>
|
||||
readonly separate: <S, R, E, A, B>(
|
||||
fa: Kind4<F, S, R, E, Either<A, B>>
|
||||
) => S.Separated<Kind4<F, S, R, E, A>, Kind4<F, S, R, E, B>>
|
||||
}
|
||||
/**
|
||||
* `compact` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function compact<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Compactable2C<G, E>
|
||||
): <FE, A>(fa: Kind2<F, FE, Kind2<G, E, Option<A>>>) => Kind2<F, FE, Kind2<G, E, A>>
|
||||
export declare function compact<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Compactable2C<G, E>
|
||||
): <A>(fa: Kind<F, Kind2<G, E, Option<A>>>) => Kind<F, Kind2<G, E, A>>
|
||||
export declare function compact<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Compactable1<G>
|
||||
): <A>(fa: Kind<F, Kind<G, Option<A>>>) => Kind<F, Kind<G, A>>
|
||||
export declare function compact<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Compactable<G>
|
||||
): <A>(fa: HKT<F, HKT<G, Option<A>>>) => HKT<F, HKT<G, A>>
|
||||
/**
|
||||
* `separate` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function separate<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
C: Compactable2C<G, E>,
|
||||
G: Functor2<G>
|
||||
): <FE, A, B>(
|
||||
fge: Kind2<F, FE, Kind2<G, E, Either<A, B>>>
|
||||
) => S.Separated<Kind2<F, FE, Kind2<G, E, A>>, Kind2<F, FE, Kind2<G, E, B>>>
|
||||
export declare function separate<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
C: Compactable2C<G, E>,
|
||||
G: Functor2<G>
|
||||
): <A, B>(fge: Kind<F, Kind2<G, E, Either<A, B>>>) => S.Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, B>>>
|
||||
export declare function separate<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
C: Compactable1<G>,
|
||||
G: Functor1<G>
|
||||
): <A, B>(fge: Kind<F, Kind<G, Either<A, B>>>) => S.Separated<Kind<F, Kind<G, A>>, Kind<F, Kind<G, B>>>
|
||||
export declare function separate<F, G>(
|
||||
F: Functor<F>,
|
||||
C: Compactable<G>,
|
||||
G: Functor<G>
|
||||
): <A, B>(fge: HKT<F, HKT<G, Either<A, B>>>) => S.Separated<HKT<F, HKT<G, A>>, HKT<F, HKT<G, B>>>
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition<F, G> extends FunctorComposition<F, G> {
|
||||
readonly compact: <A>(fga: HKT<F, HKT<G, Option<A>>>) => HKT<F, HKT<G, A>>
|
||||
readonly separate: <A, B>(fge: HKT<F, HKT<G, Either<A, B>>>) => Separated<HKT<F, HKT<G, A>>, HKT<F, HKT<G, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition11<F extends URIS, G extends URIS> extends FunctorComposition11<F, G> {
|
||||
readonly compact: <A>(fga: Kind<F, Kind<G, Option<A>>>) => Kind<F, Kind<G, A>>
|
||||
readonly separate: <A, B>(fge: Kind<F, Kind<G, Either<A, B>>>) => Separated<Kind<F, Kind<G, A>>, Kind<F, Kind<G, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition12<F extends URIS, G extends URIS2> extends FunctorComposition12<F, G> {
|
||||
readonly compact: <E, A>(fga: Kind<F, Kind2<G, E, Option<A>>>) => Kind<F, Kind2<G, E, A>>
|
||||
readonly separate: <E, A, B>(
|
||||
fge: Kind<F, Kind2<G, E, Either<A, B>>>
|
||||
) => Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition12C<F extends URIS, G extends URIS2, E> extends FunctorComposition12C<F, G, E> {
|
||||
readonly compact: <A>(fga: Kind<F, Kind2<G, E, Option<A>>>) => Kind<F, Kind2<G, E, A>>
|
||||
readonly separate: <A, B>(
|
||||
fge: Kind<F, Kind2<G, E, Either<A, B>>>
|
||||
) => Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition21<F extends URIS2, G extends URIS> extends FunctorComposition21<F, G> {
|
||||
readonly compact: <FE, A>(fga: Kind2<F, FE, Kind<G, Option<A>>>) => Kind2<F, FE, Kind<G, A>>
|
||||
readonly separate: <FE, A, B>(
|
||||
fge: Kind2<F, FE, Kind<G, Either<A, B>>>
|
||||
) => Separated<Kind2<F, FE, Kind<G, A>>, Kind2<F, FE, Kind<G, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition2C1<F extends URIS2, G extends URIS, E> extends FunctorComposition2C1<F, G, E> {
|
||||
readonly compact: <A>(fga: Kind2<F, E, Kind<G, Option<A>>>) => Kind2<F, E, Kind<G, A>>
|
||||
readonly separate: <A, B>(
|
||||
fge: Kind2<F, E, Kind<G, Either<A, B>>>
|
||||
) => Separated<Kind2<F, E, Kind<G, A>>, Kind2<F, E, Kind<G, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition22<F extends URIS2, G extends URIS2> extends FunctorComposition22<F, G> {
|
||||
readonly compact: <FE, GE, A>(fga: Kind2<F, FE, Kind2<G, GE, Option<A>>>) => Kind2<F, FE, Kind2<G, GE, A>>
|
||||
readonly separate: <FE, GE, A, B>(
|
||||
fge: Kind2<F, FE, Kind2<G, GE, Either<A, B>>>
|
||||
) => Separated<Kind2<F, FE, Kind2<G, GE, A>>, Kind2<F, FE, Kind2<G, GE, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition22C<F extends URIS2, G extends URIS2, E> extends FunctorComposition22C<F, G, E> {
|
||||
readonly compact: <FE, A>(fga: Kind2<F, FE, Kind2<G, E, Option<A>>>) => Kind2<F, FE, Kind2<G, E, A>>
|
||||
readonly separate: <FE, A, B>(
|
||||
fge: Kind2<F, FE, Kind2<G, E, Either<A, B>>>
|
||||
) => Separated<Kind2<F, FE, Kind2<G, E, A>>, Kind2<F, FE, Kind2<G, E, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.2.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition23<F extends URIS2, G extends URIS3> extends FunctorComposition23<F, G> {
|
||||
readonly compact: <R, FE, GE, A>(fga: Kind2<F, FE, Kind3<G, R, GE, Option<A>>>) => Kind2<F, FE, Kind3<G, R, GE, A>>
|
||||
readonly separate: <R, FE, GE, A, B>(
|
||||
fge: Kind2<F, FE, Kind3<G, R, GE, Either<A, B>>>
|
||||
) => Separated<Kind2<F, FE, Kind3<G, R, GE, A>>, Kind2<F, FE, Kind3<G, R, GE, B>>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.2.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface CompactableComposition23C<F extends URIS2, G extends URIS3, E> extends FunctorComposition23C<F, G, E> {
|
||||
readonly compact: <FE, R, A>(fga: Kind2<F, FE, Kind3<G, R, E, Option<A>>>) => Kind2<F, FE, Kind3<G, R, E, A>>
|
||||
readonly separate: <FE, R, A, B>(
|
||||
fge: Kind2<F, FE, Kind3<G, R, E, Either<A, B>>>
|
||||
) => Separated<Kind2<F, FE, Kind3<G, R, E, A>>, Kind2<F, FE, Kind3<G, R, E, B>>>
|
||||
}
|
||||
/**
|
||||
* Use [`compact`](#compact) and [`separate`](#separate) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getCompactableComposition<F extends URIS2, G extends URIS3, E>(
|
||||
F: Functor2<F>,
|
||||
G: Compactable3C<G, E> & Functor3C<G, E>
|
||||
): CompactableComposition23C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Compactable2C<G, E> & Functor2C<G, E>
|
||||
): CompactableComposition22C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS2, G extends URIS2>(
|
||||
F: Functor2<F>,
|
||||
G: Compactable2<G> & Functor2<G>
|
||||
): CompactableComposition22<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS2, G extends URIS, E>(
|
||||
F: Functor2C<F, E>,
|
||||
G: Compactable1<G> & Functor1<G>
|
||||
): CompactableComposition2C1<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS2, G extends URIS>(
|
||||
F: Functor2<F>,
|
||||
G: Compactable1<G> & Functor1<G>
|
||||
): CompactableComposition21<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Compactable2C<G, E> & Functor2C<G, E>
|
||||
): CompactableComposition12<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS, G extends URIS2>(
|
||||
F: Functor1<F>,
|
||||
G: Compactable2<G> & Functor2<G>
|
||||
): CompactableComposition12<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Compactable1<G> & Functor1<G>
|
||||
): CompactableComposition11<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getCompactableComposition<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Compactable<G> & Functor<G>
|
||||
): CompactableComposition<F, G>
|
||||
/**
|
||||
* Use [`Separated`](./Separated.ts.html#separated) instead.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface Separated<A, B> {
|
||||
readonly left: A
|
||||
readonly right: B
|
||||
}
|
||||
49
node_modules/fp-ts/lib/Compactable.js
generated
vendored
Normal file
49
node_modules/fp-ts/lib/Compactable.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.compact = compact;
|
||||
exports.separate = separate;
|
||||
exports.getCompactableComposition = getCompactableComposition;
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
var Option_1 = require("./Option");
|
||||
var S = __importStar(require("./Separated"));
|
||||
function compact(F, G) {
|
||||
return function (fga) { return F.map(fga, G.compact); };
|
||||
}
|
||||
function separate(F, C, G) {
|
||||
var _compact = compact(F, C);
|
||||
var _map = (0, Functor_1.map)(F, G);
|
||||
return function (fge) { return S.separated(_compact((0, function_1.pipe)(fge, _map(Option_1.getLeft))), _compact((0, function_1.pipe)(fge, _map(Option_1.getRight)))); };
|
||||
}
|
||||
/** @deprecated */
|
||||
function getCompactableComposition(F, G) {
|
||||
var map = (0, Functor_1.getFunctorComposition)(F, G).map;
|
||||
return {
|
||||
map: map,
|
||||
compact: compact(F, G),
|
||||
separate: separate(F, G, G)
|
||||
};
|
||||
}
|
||||
20
node_modules/fp-ts/lib/Console.d.ts
generated
vendored
Normal file
20
node_modules/fp-ts/lib/Console.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { IO } from './IO'
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const log: <A>(a: A) => IO<void>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const warn: <A>(a: A) => IO<void>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const error: <A>(a: A) => IO<void>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const info: <A>(a: A) => IO<void>
|
||||
39
node_modules/fp-ts/lib/Console.js
generated
vendored
Normal file
39
node_modules/fp-ts/lib/Console.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.info = exports.error = exports.warn = exports.log = void 0;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var log = function (a) {
|
||||
return function () {
|
||||
return console.log(a);
|
||||
};
|
||||
};
|
||||
exports.log = log;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var warn = function (a) {
|
||||
return function () {
|
||||
return console.warn(a);
|
||||
};
|
||||
};
|
||||
exports.warn = warn;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var error = function (a) {
|
||||
return function () {
|
||||
return console.error(a);
|
||||
};
|
||||
};
|
||||
exports.error = error;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var info = function (a) {
|
||||
return function () {
|
||||
return console.info(a);
|
||||
};
|
||||
};
|
||||
exports.info = info;
|
||||
169
node_modules/fp-ts/lib/Const.d.ts
generated
vendored
Normal file
169
node_modules/fp-ts/lib/Const.d.ts
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* The `Const` type constructor, which wraps its first type argument and ignores its second.
|
||||
* That is, `Const<E, A>` is isomorphic to `E` for any `A`.
|
||||
*
|
||||
* `Const` has some useful instances. For example, the `Applicative` instance allows us to collect results using a `Monoid`
|
||||
* while ignoring return values.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Applicative2C } from './Applicative'
|
||||
import { Apply2C } from './Apply'
|
||||
import { Bifunctor2 } from './Bifunctor'
|
||||
import { BooleanAlgebra } from './BooleanAlgebra'
|
||||
import { Bounded } from './Bounded'
|
||||
import { Contravariant2 } from './Contravariant'
|
||||
import { Eq } from './Eq'
|
||||
import { Functor2 } from './Functor'
|
||||
import { HeytingAlgebra } from './HeytingAlgebra'
|
||||
import { Monoid } from './Monoid'
|
||||
import { Ord } from './Ord'
|
||||
import { Ring } from './Ring'
|
||||
import { Semigroup } from './Semigroup'
|
||||
import { Semiring } from './Semiring'
|
||||
import { Show } from './Show'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type Const<E, A> = E & {
|
||||
readonly _A: A
|
||||
}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const make: <E, A = never>(e: E) => Const<E, A>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function getShow<E, A>(S: Show<E>): Show<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const getEq: <E, A>(E: Eq<E>) => Eq<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getOrd: <E, A>(O: Ord<E>) => Ord<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getBounded: <E, A>(B: Bounded<E>) => Bounded<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getSemigroup: <E, A>(S: Semigroup<E>) => Semigroup<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getMonoid: <E, A>(M: Monoid<E>) => Monoid<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getSemiring: <E, A>(S: Semiring<E>) => Semiring<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getRing: <E, A>(S: Ring<E>) => Ring<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getHeytingAlgebra: <E, A>(H: HeytingAlgebra<E>) => HeytingAlgebra<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getBooleanAlgebra: <E, A>(H: BooleanAlgebra<E>) => BooleanAlgebra<Const<E, A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function getApply<E>(S: Semigroup<E>): Apply2C<URI, E>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function getApplicative<E>(M: Monoid<E>): Applicative2C<URI, E>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const contramap: <A, B>(f: (b: B) => A) => <E>(fa: Const<E, A>) => Const<E, B>
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const map: <A, B>(f: (a: A) => B) => <E>(fa: Const<E, A>) => Const<E, B>
|
||||
/**
|
||||
* Map a pair of functions over the two type arguments of the bifunctor.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.6.2
|
||||
*/
|
||||
export declare const bimap: <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (fa: Const<E, A>) => Const<G, B>
|
||||
/**
|
||||
* Map a function over the first type argument of a bifunctor.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.6.2
|
||||
*/
|
||||
export declare const mapLeft: <E, G>(f: (e: E) => G) => <A>(fa: Const<E, A>) => Const<G, A>
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const URI = 'Const'
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type URI = typeof URI
|
||||
declare module './HKT' {
|
||||
interface URItoKind2<E, A> {
|
||||
readonly [URI]: Const<E, A>
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Functor: Functor2<URI>
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const flap: <A>(
|
||||
a: A
|
||||
) => <E, B>(fab: import('./HKT').Kind2<'Const', E, (a: A) => B>) => import('./HKT').Kind2<'Const', E, B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Contravariant: Contravariant2<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Bifunctor: Bifunctor2<URI>
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Functor` instance, pass `C.Functor` instead of `C.const_`
|
||||
* (where `C` is from `import C from 'fp-ts/Const'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const const_: Functor2<URI> & Contravariant2<URI> & Bifunctor2<URI>
|
||||
186
node_modules/fp-ts/lib/Const.js
generated
vendored
Normal file
186
node_modules/fp-ts/lib/Const.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.const_ = exports.Bifunctor = exports.Contravariant = exports.flap = exports.Functor = exports.URI = exports.mapLeft = exports.bimap = exports.map = exports.contramap = exports.getBooleanAlgebra = exports.getHeytingAlgebra = exports.getRing = exports.getSemiring = exports.getMonoid = exports.getSemigroup = exports.getBounded = exports.getOrd = exports.getEq = exports.make = void 0;
|
||||
exports.getShow = getShow;
|
||||
exports.getApply = getApply;
|
||||
exports.getApplicative = getApplicative;
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.make = function_1.unsafeCoerce;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function getShow(S) {
|
||||
return {
|
||||
show: function (c) { return "make(".concat(S.show(c), ")"); }
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.getEq = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getOrd = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getBounded = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getSemigroup = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getMonoid = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getSemiring = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getRing = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getHeytingAlgebra = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.getBooleanAlgebra = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function getApply(S) {
|
||||
return {
|
||||
URI: exports.URI,
|
||||
_E: undefined,
|
||||
map: _map,
|
||||
ap: function (fab, fa) { return (0, exports.make)(S.concat(fab, fa)); }
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function getApplicative(M) {
|
||||
var A = getApply(M);
|
||||
return {
|
||||
URI: exports.URI,
|
||||
_E: undefined,
|
||||
map: A.map,
|
||||
ap: A.ap,
|
||||
of: function () { return (0, exports.make)(M.empty); }
|
||||
};
|
||||
}
|
||||
var _contramap = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.contramap)(f)); };
|
||||
/* istanbul ignore next */
|
||||
var _map = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.map)(f)); };
|
||||
/* istanbul ignore next */
|
||||
var _bimap = function (fa, f, g) { return (0, function_1.pipe)(fa, (0, exports.bimap)(f, g)); };
|
||||
/* istanbul ignore next */
|
||||
var _mapLeft = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.mapLeft)(f)); };
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var contramap = function () { return function_1.unsafeCoerce; };
|
||||
exports.contramap = contramap;
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var map = function () { return function_1.unsafeCoerce; };
|
||||
exports.map = map;
|
||||
/**
|
||||
* Map a pair of functions over the two type arguments of the bifunctor.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.6.2
|
||||
*/
|
||||
var bimap = function (f) { return function (fa) {
|
||||
return (0, exports.make)(f(fa));
|
||||
}; };
|
||||
exports.bimap = bimap;
|
||||
/**
|
||||
* Map a function over the first type argument of a bifunctor.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.6.2
|
||||
*/
|
||||
var mapLeft = function (f) { return function (fa) { return (0, exports.make)(f(fa)); }; };
|
||||
exports.mapLeft = mapLeft;
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.URI = 'Const';
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Functor = {
|
||||
URI: exports.URI,
|
||||
map: _map
|
||||
};
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.flap = (0, Functor_1.flap)(exports.Functor);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Contravariant = {
|
||||
URI: exports.URI,
|
||||
contramap: _contramap
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Bifunctor = {
|
||||
URI: exports.URI,
|
||||
bimap: _bimap,
|
||||
mapLeft: _mapLeft
|
||||
};
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Functor` instance, pass `C.Functor` instead of `C.const_`
|
||||
* (where `C` is from `import C from 'fp-ts/Const'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.const_ = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
contramap: _contramap,
|
||||
bimap: _bimap,
|
||||
mapLeft: _mapLeft
|
||||
};
|
||||
62
node_modules/fp-ts/lib/Contravariant.d.ts
generated
vendored
Normal file
62
node_modules/fp-ts/lib/Contravariant.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Contravariant<F> {
|
||||
readonly URI: F
|
||||
readonly contramap: <A, B>(fa: HKT<F, A>, f: (b: B) => A) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Contravariant1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly contramap: <A, B>(fa: Kind<F, A>, f: (b: B) => A) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Contravariant2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly contramap: <E, A, B>(fa: Kind2<F, E, A>, f: (b: B) => A) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Contravariant2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly contramap: <A, B>(fa: Kind2<F, E, A>, f: (b: B) => A) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Contravariant3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly contramap: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (b: B) => A) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Contravariant3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly contramap: <R, A, B>(fa: Kind3<F, R, E, A>, f: (b: B) => A) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Contravariant4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly contramap: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (b: B) => A) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Contravariant.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Contravariant.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
49
node_modules/fp-ts/lib/Date.d.ts
generated
vendored
Normal file
49
node_modules/fp-ts/lib/Date.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import * as E from './Eq'
|
||||
import { IO } from './IO'
|
||||
import * as O from './Ord'
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Eq: E.Eq<Date>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const eqDate: E.Eq<Date>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const eqMonth: E.Eq<Date>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const eqYear: E.Eq<Date>
|
||||
/**
|
||||
* @example
|
||||
* import { Ord } from 'fp-ts/Date'
|
||||
*
|
||||
* assert.deepStrictEqual(Ord.compare(new Date(1, 1, 2020), new Date(1, 1, 2021)), -1)
|
||||
*
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Ord: O.Ord<Date>
|
||||
/**
|
||||
* Returns the current `Date`
|
||||
*
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const create: IO<Date>
|
||||
/**
|
||||
* Returns the number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const now: IO<number>
|
||||
89
node_modules/fp-ts/lib/Date.js
generated
vendored
Normal file
89
node_modules/fp-ts/lib/Date.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.now = exports.create = exports.Ord = exports.eqYear = exports.eqMonth = exports.eqDate = exports.Eq = void 0;
|
||||
var function_1 = require("./function");
|
||||
var N = __importStar(require("./number"));
|
||||
var O = __importStar(require("./Ord"));
|
||||
// -------------------------------------------------------------------------------------
|
||||
// instances
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Eq = {
|
||||
equals: function (first, second) { return first.valueOf() === second.valueOf(); }
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.eqDate = {
|
||||
equals: function (x, y) { return x.getDate() === y.getDate(); }
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.eqMonth = {
|
||||
equals: function (x, y) { return x.getMonth() === y.getMonth(); }
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
exports.eqYear = {
|
||||
equals: function (x, y) { return x.getFullYear() === y.getFullYear(); }
|
||||
};
|
||||
/**
|
||||
* @example
|
||||
* import { Ord } from 'fp-ts/Date'
|
||||
*
|
||||
* assert.deepStrictEqual(Ord.compare(new Date(1, 1, 2020), new Date(1, 1, 2021)), -1)
|
||||
*
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Ord = (0, function_1.pipe)(N.Ord,
|
||||
/*#__PURE__*/ O.contramap(function (date) { return date.valueOf(); }));
|
||||
// -------------------------------------------------------------------------------------
|
||||
// utils
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the current `Date`
|
||||
*
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var create = function () { return new Date(); };
|
||||
exports.create = create;
|
||||
/**
|
||||
* Returns the number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var now = function () { return new Date().getTime(); };
|
||||
exports.now = now;
|
||||
20
node_modules/fp-ts/lib/DistributiveLattice.d.ts
generated
vendored
Normal file
20
node_modules/fp-ts/lib/DistributiveLattice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* A `DistributiveLattice` must satisfy the following laws in addition to `Lattice` laws:
|
||||
*
|
||||
* - Distributivity for meet: `a ∨ (b ∧ c) <-> (a ∨ b) ∧ (a ∨ c)`
|
||||
* - Distributivity for join: `a ∧ (b ∨ c) <-> (a ∧ b) ∨ (a ∧ c)`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Lattice } from './Lattice'
|
||||
import { Ord } from './Ord'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface DistributiveLattice<A> extends Lattice<A> {}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function getMinMaxDistributiveLattice<A>(O: Ord<A>): DistributiveLattice<A>
|
||||
17
node_modules/fp-ts/lib/DistributiveLattice.js
generated
vendored
Normal file
17
node_modules/fp-ts/lib/DistributiveLattice.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getMinMaxDistributiveLattice = getMinMaxDistributiveLattice;
|
||||
var Ord_1 = require("./Ord");
|
||||
// -------------------------------------------------------------------------------------
|
||||
// constructors
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function getMinMaxDistributiveLattice(O) {
|
||||
return {
|
||||
meet: (0, Ord_1.min)(O),
|
||||
join: (0, Ord_1.max)(O)
|
||||
};
|
||||
}
|
||||
1354
node_modules/fp-ts/lib/Either.d.ts
generated
vendored
Normal file
1354
node_modules/fp-ts/lib/Either.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1542
node_modules/fp-ts/lib/Either.js
generated
vendored
Normal file
1542
node_modules/fp-ts/lib/Either.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
669
node_modules/fp-ts/lib/EitherT.d.ts
generated
vendored
Normal file
669
node_modules/fp-ts/lib/EitherT.d.ts
generated
vendored
Normal file
@@ -0,0 +1,669 @@
|
||||
/**
|
||||
* The error monad transformer. It can be used to add error handling to other monads.
|
||||
*
|
||||
* The `of` function yields a successful computation, while `chain` sequences two subcomputations, failing on the first error.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { ApplicativeComposition12, ApplicativeComposition22, ApplicativeCompositionHKT2 } from './Applicative'
|
||||
import { Apply, Apply1, Apply2, Apply2C, Apply3, Apply3C } from './Apply'
|
||||
import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C } from './Chain'
|
||||
import * as E from './Either'
|
||||
import { LazyArg } from './function'
|
||||
import { Functor, Functor1, Functor2, Functor2C, Functor3, Functor3C } from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from './HKT'
|
||||
import { Monad, Monad1, Monad2, Monad2C, Monad3, Monad3C } from './Monad'
|
||||
import { Pointed, Pointed1, Pointed2, Pointed2C, Pointed3, Pointed3C } from './Pointed'
|
||||
import { Semigroup } from './Semigroup'
|
||||
import Either = E.Either
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function right<F extends URIS3>(
|
||||
F: Pointed3<F>
|
||||
): <A, R, FE, E = never>(a: A) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function right<F extends URIS3, FE>(
|
||||
F: Pointed3C<F, FE>
|
||||
): <A, R, E = never>(a: A) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function right<F extends URIS2>(F: Pointed2<F>): <A, FE, E = never>(a: A) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function right<F extends URIS2, FE>(
|
||||
F: Pointed2C<F, FE>
|
||||
): <A, E = never>(a: A) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function right<F extends URIS>(F: Pointed1<F>): <A, E = never>(a: A) => Kind<F, Either<E, A>>
|
||||
export declare function right<F>(F: Pointed<F>): <A, E = never>(a: A) => HKT<F, Either<E, A>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function left<F extends URIS3>(
|
||||
F: Pointed3<F>
|
||||
): <E, R, FE, A = never>(e: E) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function left<F extends URIS3, FE>(
|
||||
F: Pointed3C<F, FE>
|
||||
): <E, R, A = never>(e: E) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function left<F extends URIS2>(F: Pointed2<F>): <E, FE, A = never>(e: E) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function left<F extends URIS2, FE>(
|
||||
F: Pointed2C<F, FE>
|
||||
): <E, A = never>(e: E) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function left<F extends URIS>(F: Pointed1<F>): <E, A = never>(e: E) => Kind<F, Either<E, A>>
|
||||
export declare function left<F>(F: Pointed<F>): <E, A = never>(e: E) => HKT<F, Either<E, A>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function rightF<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <R, FE, A, E = never>(fa: Kind3<F, R, FE, A>) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function rightF<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <R, A, E = never>(fa: Kind3<F, R, FE, A>) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function rightF<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <FE, A, E = never>(fa: Kind2<F, FE, A>) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function rightF<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <A, E = never>(fa: Kind2<F, FE, A>) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function rightF<F extends URIS>(F: Functor1<F>): <A, E = never>(fa: Kind<F, A>) => Kind<F, Either<E, A>>
|
||||
export declare function rightF<F>(F: Functor<F>): <A, E = never>(fa: HKT<F, A>) => HKT<F, Either<E, A>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function leftF<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <R, FE, E, A = never>(fe: Kind3<F, R, FE, E>) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function leftF<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <R, E, A = never>(fe: Kind3<F, R, FE, E>) => Kind3<F, R, FE, Either<E, A>>
|
||||
export declare function leftF<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <FE, E, A = never>(fe: Kind2<F, FE, E>) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function leftF<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <E, A = never>(fe: Kind2<F, FE, E>) => Kind2<F, FE, Either<E, A>>
|
||||
export declare function leftF<F extends URIS>(F: Functor1<F>): <E, A = never>(fe: Kind<F, E>) => Kind<F, Either<E, A>>
|
||||
export declare function leftF<F>(F: Functor<F>): <E, A = never>(fe: HKT<F, E>) => HKT<F, Either<E, A>>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare function fromNullable<F extends URIS3>(
|
||||
F: Pointed3<F>
|
||||
): <E>(e: E) => <A, S, R>(a: A) => Kind3<F, S, R, Either<E, NonNullable<A>>>
|
||||
export declare function fromNullable<F extends URIS3, R>(
|
||||
F: Pointed3C<F, R>
|
||||
): <E>(e: E) => <A, S>(a: A) => Kind3<F, S, R, Either<E, NonNullable<A>>>
|
||||
export declare function fromNullable<F extends URIS2>(
|
||||
F: Pointed2<F>
|
||||
): <E>(e: E) => <A, R>(a: A) => Kind2<F, R, Either<E, NonNullable<A>>>
|
||||
export declare function fromNullable<F extends URIS2, R>(
|
||||
F: Pointed2C<F, R>
|
||||
): <E>(e: E) => <A>(a: A) => Kind2<F, R, Either<E, NonNullable<A>>>
|
||||
export declare function fromNullable<F extends URIS>(
|
||||
F: Pointed1<F>
|
||||
): <E>(e: E) => <A>(a: A) => Kind<F, Either<E, NonNullable<A>>>
|
||||
export declare function fromNullable<F>(F: Pointed<F>): <E>(e: E) => <A>(a: A) => HKT<F, Either<E, NonNullable<A>>>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare function fromNullableK<F extends URIS3>(
|
||||
F: Pointed3<F>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => <S, R>(...a: A) => Kind3<F, S, R, Either<E, NonNullable<B>>>
|
||||
export declare function fromNullableK<F extends URIS3, R>(
|
||||
F: Pointed3C<F, R>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => <S>(...a: A) => Kind3<F, S, R, Either<E, NonNullable<B>>>
|
||||
export declare function fromNullableK<F extends URIS2>(
|
||||
F: Pointed2<F>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => <R>(...a: A) => Kind2<F, R, Either<E, NonNullable<B>>>
|
||||
export declare function fromNullableK<F extends URIS2, R>(
|
||||
F: Pointed2C<F, R>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => (...a: A) => Kind2<F, R, Either<E, NonNullable<B>>>
|
||||
export declare function fromNullableK<F extends URIS>(
|
||||
F: Pointed1<F>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => (...a: A) => Kind<F, Either<E, NonNullable<B>>>
|
||||
export declare function fromNullableK<F>(
|
||||
F: Pointed<F>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => (...a: A) => HKT<F, Either<E, NonNullable<B>>>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare function chainNullableK<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A, B>(
|
||||
f: (a: A) => B | null | undefined
|
||||
) => <S, R>(ma: Kind3<M, S, R, Either<E, A>>) => Kind3<M, S, R, Either<E, NonNullable<B>>>
|
||||
export declare function chainNullableK<M extends URIS3, R>(
|
||||
M: Monad3C<M, R>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A, B>(
|
||||
f: (a: A) => B | null | undefined
|
||||
) => <S>(ma: Kind3<M, S, R, Either<E, A>>) => Kind3<M, S, R, Either<E, NonNullable<B>>>
|
||||
export declare function chainNullableK<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A, B>(
|
||||
f: (a: A) => B | null | undefined
|
||||
) => <R>(ma: Kind2<M, R, Either<E, A>>) => Kind2<M, R, Either<E, NonNullable<B>>>
|
||||
export declare function chainNullableK<M extends URIS2, T>(
|
||||
M: Monad2C<M, T>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A, B>(
|
||||
f: (a: A) => B | null | undefined
|
||||
) => (ma: Kind2<M, T, Either<E, A>>) => Kind2<M, T, Either<E, NonNullable<B>>>
|
||||
export declare function chainNullableK<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A, B>(f: (a: A) => B | null | undefined) => (ma: Kind<M, Either<E, A>>) => Kind<M, Either<E, NonNullable<B>>>
|
||||
export declare function chainNullableK<M>(
|
||||
M: Monad<M>
|
||||
): <E>(
|
||||
e: E
|
||||
) => <A, B>(f: (a: A) => B | null | undefined) => (ma: HKT<M, Either<E, A>>) => HKT<M, Either<E, NonNullable<B>>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function map<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <A, B>(f: (a: A) => B) => <R, FE, E>(fa: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<E, B>>
|
||||
export declare function map<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <A, B>(f: (a: A) => B) => <R, E>(fa: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<E, B>>
|
||||
export declare function map<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <A, B>(f: (a: A) => B) => <FE, E>(fa: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<E, B>>
|
||||
export declare function map<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <A, B>(f: (a: A) => B) => <E>(fa: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<E, B>>
|
||||
export declare function map<F extends URIS>(
|
||||
F: Functor1<F>
|
||||
): <A, B>(f: (a: A) => B) => <E>(fa: Kind<F, Either<E, A>>) => Kind<F, Either<E, B>>
|
||||
export declare function map<F>(
|
||||
F: Functor<F>
|
||||
): <A, B>(f: (a: A) => B) => <E>(fa: HKT<F, Either<E, A>>) => HKT<F, Either<E, B>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function ap<F extends URIS3>(
|
||||
F: Apply3<F>
|
||||
): <R, FE, E, A>(
|
||||
fa: Kind3<F, R, FE, Either<E, A>>
|
||||
) => <B>(fab: Kind3<F, R, FE, Either<E, (a: A) => B>>) => Kind3<F, R, FE, Either<E, B>>
|
||||
export declare function ap<F extends URIS3, FE>(
|
||||
F: Apply3C<F, FE>
|
||||
): <R, E, A>(
|
||||
fa: Kind3<F, R, FE, Either<E, A>>
|
||||
) => <B>(fab: Kind3<F, R, FE, Either<E, (a: A) => B>>) => Kind3<F, R, FE, Either<E, B>>
|
||||
export declare function ap<F extends URIS2>(
|
||||
F: Apply2<F>
|
||||
): <FE, E, A>(
|
||||
fa: Kind2<F, FE, Either<E, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Either<E, (a: A) => B>>) => Kind2<F, FE, Either<E, B>>
|
||||
export declare function ap<F extends URIS2, FE>(
|
||||
F: Apply2C<F, FE>
|
||||
): <E, A>(
|
||||
fa: Kind2<F, FE, Either<E, A>>
|
||||
) => <B>(fab: Kind2<F, FE, Either<E, (a: A) => B>>) => Kind2<F, FE, Either<E, B>>
|
||||
export declare function ap<F extends URIS>(
|
||||
F: Apply1<F>
|
||||
): <E, A>(fa: Kind<F, Either<E, A>>) => <B>(fab: Kind<F, Either<E, (a: A) => B>>) => Kind<F, Either<E, B>>
|
||||
export declare function ap<F>(
|
||||
F: Apply<F>
|
||||
): <E, A>(fa: HKT<F, Either<E, A>>) => <B>(fab: HKT<F, Either<E, (a: A) => B>>) => HKT<F, Either<E, B>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chain<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <A, R, ME, E, B>(
|
||||
f: (a: A) => Kind3<M, R, ME, Either<E, B>>
|
||||
) => (ma: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, B>>
|
||||
export declare function chain<M extends URIS3, ME>(
|
||||
M: Monad3C<M, ME>
|
||||
): <A, R, E, B>(
|
||||
f: (a: A) => Kind3<M, R, ME, Either<E, B>>
|
||||
) => (ma: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, B>>
|
||||
export declare function chain<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <A, ME, E, B>(
|
||||
f: (a: A) => Kind2<M, ME, Either<E, B>>
|
||||
) => (ma: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, B>>
|
||||
export declare function chain<M extends URIS2, ME>(
|
||||
M: Monad2C<M, ME>
|
||||
): <A, E, B>(f: (a: A) => Kind2<M, ME, Either<E, B>>) => (ma: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, B>>
|
||||
export declare function chain<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <A, E, B>(f: (a: A) => Kind<M, Either<E, B>>) => (ma: Kind<M, Either<E, A>>) => Kind<M, Either<E, B>>
|
||||
export declare function chain<M>(
|
||||
M: Monad<M>
|
||||
): <A, E, B>(f: (a: A) => HKT<M, Either<E, B>>) => (ma: HKT<M, Either<E, A>>) => HKT<M, Either<E, B>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function alt<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <R, ME, E, A>(
|
||||
second: LazyArg<Kind3<M, R, ME, Either<E, A>>>
|
||||
) => (first: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, A>>
|
||||
export declare function alt<M extends URIS3, ME>(
|
||||
M: Monad3C<M, ME>
|
||||
): <R, E, A>(
|
||||
second: LazyArg<Kind3<M, R, ME, Either<E, A>>>
|
||||
) => (first: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, A>>
|
||||
export declare function alt<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <ME, E, A>(
|
||||
second: LazyArg<Kind2<M, ME, Either<E, A>>>
|
||||
) => (first: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, A>>
|
||||
export declare function alt<M extends URIS2, ME>(
|
||||
M: Monad2C<M, ME>
|
||||
): <E, A>(
|
||||
second: LazyArg<Kind2<M, ME, Either<E, A>>>
|
||||
) => (first: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, A>>
|
||||
export declare function alt<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <E, A>(second: LazyArg<Kind<M, Either<E, A>>>) => (first: Kind<M, Either<E, A>>) => Kind<M, Either<E, A>>
|
||||
export declare function alt<M>(
|
||||
M: Monad<M>
|
||||
): <E, A>(second: LazyArg<HKT<M, Either<E, A>>>) => (first: HKT<M, Either<E, A>>) => HKT<M, Either<E, A>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function bimap<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <E, G, A, B>(
|
||||
f: (e: E) => G,
|
||||
g: (a: A) => B
|
||||
) => <R, FE>(self: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<G, B>>
|
||||
export declare function bimap<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <E, G, A, B>(
|
||||
f: (e: E) => G,
|
||||
g: (a: A) => B
|
||||
) => <R>(self: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<G, B>>
|
||||
export declare function bimap<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => <FE>(self: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<G, B>>
|
||||
export declare function bimap<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (self: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<G, B>>
|
||||
export declare function bimap<F extends URIS>(
|
||||
F: Functor1<F>
|
||||
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (self: Kind<F, Either<E, A>>) => Kind<F, Either<G, B>>
|
||||
export declare function bimap<F>(
|
||||
F: Functor<F>
|
||||
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (self: HKT<F, Either<E, A>>) => HKT<F, Either<G, B>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function mapLeft<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <E, G>(f: (e: E) => G) => <R, FE, A>(self: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<G, A>>
|
||||
export declare function mapLeft<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <E, G>(f: (e: E) => G) => <R, A>(self: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<G, A>>
|
||||
export declare function mapLeft<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <E, G>(f: (e: E) => G) => <FE, A>(self: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<G, A>>
|
||||
export declare function mapLeft<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <E, G>(f: (e: E) => G) => <A>(self: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<G, A>>
|
||||
export declare function mapLeft<F extends URIS>(
|
||||
F: Functor1<F>
|
||||
): <E, G>(f: (e: E) => G) => <A>(self: Kind<F, Either<E, A>>) => Kind<F, Either<G, A>>
|
||||
export declare function mapLeft<F>(
|
||||
F: Functor<F>
|
||||
): <E, G>(f: (e: E) => G) => <A>(self: HKT<F, Either<E, A>>) => HKT<F, Either<G, A>>
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function altValidation<M extends URIS3, E>(
|
||||
M: Monad3<M>,
|
||||
S: Semigroup<E>
|
||||
): <R, ME, A>(
|
||||
second: LazyArg<Kind3<M, R, ME, Either<E, A>>>
|
||||
) => (first: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, A>>
|
||||
export declare function altValidation<M extends URIS3, ME, E>(
|
||||
M: Monad3C<M, ME>,
|
||||
S: Semigroup<E>
|
||||
): <R, A>(
|
||||
second: LazyArg<Kind3<M, R, ME, Either<E, A>>>
|
||||
) => (first: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, A>>
|
||||
export declare function altValidation<M extends URIS2, E>(
|
||||
M: Monad2<M>,
|
||||
S: Semigroup<E>
|
||||
): <ME, A>(
|
||||
second: LazyArg<Kind2<M, ME, Either<E, A>>>
|
||||
) => (first: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, A>>
|
||||
export declare function altValidation<M extends URIS2, ME, E>(
|
||||
M: Monad2C<M, ME>,
|
||||
S: Semigroup<E>
|
||||
): <A>(second: LazyArg<Kind2<M, ME, Either<E, A>>>) => (first: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, A>>
|
||||
export declare function altValidation<M extends URIS, E>(
|
||||
M: Monad1<M>,
|
||||
S: Semigroup<E>
|
||||
): <A>(second: LazyArg<Kind<M, Either<E, A>>>) => (first: Kind<M, Either<E, A>>) => Kind<M, Either<E, A>>
|
||||
export declare function altValidation<M, E>(
|
||||
M: Monad<M>,
|
||||
S: Semigroup<E>
|
||||
): <A>(second: LazyArg<HKT<M, Either<E, A>>>) => (first: HKT<M, Either<E, A>>) => HKT<M, Either<E, A>>
|
||||
/**
|
||||
* @category pattern matching
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function match<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <E, B, A>(
|
||||
onLeft: (e: E) => B,
|
||||
onRight: (a: A) => B
|
||||
) => <R, ME>(ma: Kind3<F, R, ME, Either<E, A>>) => Kind3<F, R, ME, B>
|
||||
export declare function match<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <E, B, A>(onLeft: (e: E) => B, onRight: (a: A) => B) => <R>(ma: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, B>
|
||||
export declare function match<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <E, B, A>(onLeft: (e: E) => B, onRight: (a: A) => B) => <FE>(ma: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, B>
|
||||
export declare function match<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <E, B, A>(onLeft: (e: E) => B, onRight: (a: A) => B) => (ma: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, B>
|
||||
export declare function match<F extends URIS>(
|
||||
F: Functor1<F>
|
||||
): <E, B, A>(onLeft: (e: E) => B, onRight: (a: A) => B) => (ma: Kind<F, Either<E, A>>) => Kind<F, B>
|
||||
export declare function match<F>(
|
||||
F: Functor<F>
|
||||
): <E, B, A>(onLeft: (e: E) => B, onRight: (a: A) => B) => (ma: HKT<F, Either<E, A>>) => HKT<F, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function matchE<M extends URIS3>(
|
||||
M: Chain3<M>
|
||||
): <E, R, FE, B, A>(
|
||||
onLeft: (e: E) => Kind3<M, R, FE, B>,
|
||||
onRight: (a: A) => Kind3<M, R, FE, B>
|
||||
) => (ma: Kind3<M, R, FE, Either<E, A>>) => Kind3<M, R, FE, B>
|
||||
export declare function matchE<M extends URIS3, FE>(
|
||||
M: Chain3C<M, FE>
|
||||
): <E, R, B, A>(
|
||||
onLeft: (e: E) => Kind3<M, R, FE, B>,
|
||||
onRight: (a: A) => Kind3<M, R, FE, B>
|
||||
) => (ma: Kind3<M, R, FE, Either<E, A>>) => Kind3<M, R, FE, B>
|
||||
export declare function matchE<M extends URIS2>(
|
||||
M: Chain2<M>
|
||||
): <E, FE, B, A>(
|
||||
onLeft: (e: E) => Kind2<M, FE, B>,
|
||||
onRight: (a: A) => Kind2<M, FE, B>
|
||||
) => (ma: Kind2<M, FE, Either<E, A>>) => Kind2<M, FE, B>
|
||||
export declare function matchE<M extends URIS2, FE>(
|
||||
M: Chain2C<M, FE>
|
||||
): <E, B, A>(
|
||||
onLeft: (e: E) => Kind2<M, FE, B>,
|
||||
onRight: (a: A) => Kind2<M, FE, B>
|
||||
) => (ma: Kind2<M, FE, Either<E, A>>) => Kind2<M, FE, B>
|
||||
export declare function matchE<M extends URIS>(
|
||||
M: Chain1<M>
|
||||
): <E, B, A>(onLeft: (e: E) => Kind<M, B>, onRight: (a: A) => Kind<M, B>) => (ma: Kind<M, Either<E, A>>) => Kind<M, B>
|
||||
export declare function matchE<M>(
|
||||
M: Chain<M>
|
||||
): <E, B, A>(onLeft: (e: E) => HKT<M, B>, onRight: (a: A) => HKT<M, B>) => (ma: HKT<M, Either<E, A>>) => HKT<M, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function getOrElse<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <E, R, ME, A>(onLeft: (e: E) => Kind3<M, R, ME, A>) => (ma: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, A>
|
||||
export declare function getOrElse<M extends URIS3, ME>(
|
||||
M: Monad3C<M, ME>
|
||||
): <E, R, A>(onLeft: (e: E) => Kind3<M, R, ME, A>) => (ma: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, A>
|
||||
export declare function getOrElse<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <E, ME, A>(onLeft: (e: E) => Kind2<M, ME, A>) => (ma: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, A>
|
||||
export declare function getOrElse<M extends URIS2, ME>(
|
||||
M: Monad2C<M, ME>
|
||||
): <E, A>(onLeft: (e: E) => Kind2<M, ME, A>) => (ma: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, A>
|
||||
export declare function getOrElse<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <E, A>(onLeft: (e: E) => Kind<M, A>) => (ma: Kind<M, Either<E, A>>) => Kind<M, A>
|
||||
export declare function getOrElse<M>(
|
||||
M: Monad<M>
|
||||
): <E, A>(onLeft: (e: E) => HKT<M, A>) => (ma: HKT<M, Either<E, A>>) => HKT<M, A>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function orElse<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <E1, R, ME, E2, A>(
|
||||
onLeft: (e: E1) => Kind3<M, R, ME, Either<E2, A>>
|
||||
) => (ma: Kind3<M, R, ME, Either<E1, A>>) => Kind3<M, R, ME, Either<E2, A>>
|
||||
export declare function orElse<M extends URIS3, ME>(
|
||||
M: Monad3C<M, ME>
|
||||
): <E1, R, E2, A>(
|
||||
onLeft: (e: E1) => Kind3<M, R, ME, Either<E2, A>>
|
||||
) => (ma: Kind3<M, R, ME, Either<E1, A>>) => Kind3<M, R, ME, Either<E2, A>>
|
||||
export declare function orElse<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <E1, ME, E2, A>(
|
||||
onLeft: (e: E1) => Kind2<M, ME, Either<E2, A>>
|
||||
) => (ma: Kind2<M, ME, Either<E1, A>>) => Kind2<M, ME, Either<E2, A>>
|
||||
export declare function orElse<M extends URIS2, ME>(
|
||||
M: Monad2C<M, ME>
|
||||
): <E1, E2, A>(
|
||||
onLeft: (e: E1) => Kind2<M, ME, Either<E2, A>>
|
||||
) => (ma: Kind2<M, ME, Either<E1, A>>) => Kind2<M, ME, Either<E2, A>>
|
||||
export declare function orElse<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <E1, E2, A>(onLeft: (e: E1) => Kind<M, Either<E2, A>>) => (ma: Kind<M, Either<E1, A>>) => Kind<M, Either<E2, A>>
|
||||
export declare function orElse<M>(
|
||||
M: Monad<M>
|
||||
): <E1, E2, A>(onLeft: (e: E1) => HKT<M, Either<E2, A>>) => (ma: HKT<M, Either<E1, A>>) => HKT<M, Either<E2, A>>
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function orElseFirst<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <E, R, ME, B>(
|
||||
onLeft: (e: E) => Kind3<M, R, ME, Either<E, B>>
|
||||
) => <A>(ma: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, A>>
|
||||
export declare function orElseFirst<M extends URIS3, ME>(
|
||||
M: Monad3C<M, ME>
|
||||
): <E, R, B>(
|
||||
onLeft: (e: E) => Kind3<M, R, ME, Either<E, B>>
|
||||
) => <A>(ma: Kind3<M, R, ME, Either<E, A>>) => Kind3<M, R, ME, Either<E, A>>
|
||||
export declare function orElseFirst<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <E, ME, B>(
|
||||
onLeft: (e: E) => Kind2<M, ME, Either<E, B>>
|
||||
) => <A>(ma: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, A>>
|
||||
export declare function orElseFirst<M extends URIS2, ME>(
|
||||
M: Monad2C<M, ME>
|
||||
): <E, B>(
|
||||
onLeft: (e: E) => Kind2<M, ME, Either<E, B>>
|
||||
) => <A>(ma: Kind2<M, ME, Either<E, A>>) => Kind2<M, ME, Either<E, A>>
|
||||
export declare function orElseFirst<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <E, B>(onLeft: (e: E) => Kind<M, Either<E, B>>) => <A>(ma: Kind<M, Either<E, A>>) => Kind<M, Either<E, A>>
|
||||
export declare function orElseFirst<M>(
|
||||
M: Monad<M>
|
||||
): <E, B>(onLeft: (e: E) => HKT<M, Either<E, B>>) => <A>(ma: HKT<M, Either<E, A>>) => HKT<M, Either<E, A>>
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function orLeft<M extends URIS3>(
|
||||
M: Monad3<M>
|
||||
): <E1, R, ME, E2>(
|
||||
onLeft: (e: E1) => Kind3<M, R, ME, E2>
|
||||
) => <A>(fa: Kind3<M, R, ME, Either<E1, A>>) => Kind3<M, R, ME, Either<E2, A>>
|
||||
export declare function orLeft<M extends URIS3, ME>(
|
||||
M: Monad3C<M, ME>
|
||||
): <E1, R, E2>(
|
||||
onLeft: (e: E1) => Kind3<M, R, ME, E2>
|
||||
) => <A>(fa: Kind3<M, R, ME, Either<E1, A>>) => Kind3<M, R, ME, Either<E2, A>>
|
||||
export declare function orLeft<M extends URIS2>(
|
||||
M: Monad2<M>
|
||||
): <E1, ME, E2>(
|
||||
onLeft: (e: E1) => Kind2<M, ME, E2>
|
||||
) => <A>(fa: Kind2<M, ME, Either<E1, A>>) => Kind2<M, ME, Either<E2, A>>
|
||||
export declare function orLeft<M extends URIS2, ME>(
|
||||
M: Monad2C<M, ME>
|
||||
): <E1, E2>(onLeft: (e: E1) => Kind2<M, ME, E2>) => <A>(fa: Kind2<M, ME, Either<E1, A>>) => Kind2<M, ME, Either<E2, A>>
|
||||
export declare function orLeft<M extends URIS>(
|
||||
M: Monad1<M>
|
||||
): <E1, E2>(onLeft: (e: E1) => Kind<M, E2>) => <A>(fa: Kind<M, Either<E1, A>>) => Kind<M, Either<E2, A>>
|
||||
export declare function orLeft<M>(
|
||||
M: Monad<M>
|
||||
): <E1, E2>(onLeft: (e: E1) => HKT<M, E2>) => <A>(fa: HKT<M, Either<E1, A>>) => HKT<M, Either<E2, A>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function swap<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <R, FE, E, A>(ma: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<A, E>>
|
||||
export declare function swap<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <R, E, A>(ma: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, Either<A, E>>
|
||||
export declare function swap<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <FE, E, A>(ma: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<A, E>>
|
||||
export declare function swap<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <E, A>(ma: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, Either<A, E>>
|
||||
export declare function swap<F extends URIS>(F: Functor1<F>): <E, A>(ma: Kind<F, Either<E, A>>) => Kind<F, Either<A, E>>
|
||||
export declare function swap<F>(F: Functor<F>): <E, A>(ma: HKT<F, Either<E, A>>) => HKT<F, Either<A, E>>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function toUnion<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <R, FE, E, A>(fa: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, E | A>
|
||||
export declare function toUnion<F extends URIS3, FE>(
|
||||
F: Functor3C<F, FE>
|
||||
): <R, E, A>(fa: Kind3<F, R, FE, Either<E, A>>) => Kind3<F, R, FE, E | A>
|
||||
export declare function toUnion<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <FE, E, A>(fa: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, E | A>
|
||||
export declare function toUnion<F extends URIS2, FE>(
|
||||
F: Functor2C<F, FE>
|
||||
): <E, A>(fa: Kind2<F, FE, Either<E, A>>) => Kind2<F, FE, E | A>
|
||||
export declare function toUnion<F extends URIS>(F: Functor1<F>): <E, A>(fa: Kind<F, Either<E, A>>) => Kind<F, E | A>
|
||||
export declare function toUnion<F>(F: Functor<F>): <E, A>(fa: HKT<F, Either<E, A>>) => HKT<F, E | A>
|
||||
import URI = E.URI
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface EitherT<M, E, A> extends HKT<M, Either<E, A>> {}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface EitherM<M> extends ApplicativeCompositionHKT2<M, URI> {
|
||||
readonly chain: <E, A, B>(ma: EitherT<M, E, A>, f: (a: A) => EitherT<M, E, B>) => EitherT<M, E, B>
|
||||
readonly alt: <E, A>(fa: EitherT<M, E, A>, that: LazyArg<EitherT<M, E, A>>) => EitherT<M, E, A>
|
||||
readonly bimap: <E, A, N, B>(ma: EitherT<M, E, A>, f: (e: E) => N, g: (a: A) => B) => EitherT<M, N, B>
|
||||
readonly mapLeft: <E, A, N>(ma: EitherT<M, E, A>, f: (e: E) => N) => EitherT<M, N, A>
|
||||
readonly fold: <E, A, R>(ma: EitherT<M, E, A>, onLeft: (e: E) => HKT<M, R>, onRight: (a: A) => HKT<M, R>) => HKT<M, R>
|
||||
readonly getOrElse: <E, A>(ma: EitherT<M, E, A>, onLeft: (e: E) => HKT<M, A>) => HKT<M, A>
|
||||
readonly orElse: <E, A, N>(ma: EitherT<M, E, A>, onLeft: (e: E) => EitherT<M, N, A>) => EitherT<M, N, A>
|
||||
readonly swap: <E, A>(ma: EitherT<M, E, A>) => EitherT<M, A, E>
|
||||
readonly rightM: <E, A>(ma: HKT<M, A>) => EitherT<M, E, A>
|
||||
readonly leftM: <E, A>(me: HKT<M, E>) => EitherT<M, E, A>
|
||||
readonly left: <E, A>(e: E) => EitherT<M, E, A>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export type EitherT1<M extends URIS, E, A> = Kind<M, Either<E, A>>
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface EitherM1<M extends URIS> extends ApplicativeComposition12<M, URI> {
|
||||
readonly chain: <E, A, B>(ma: EitherT1<M, E, A>, f: (a: A) => EitherT1<M, E, B>) => EitherT1<M, E, B>
|
||||
readonly alt: <E, A>(fa: EitherT1<M, E, A>, that: LazyArg<EitherT1<M, E, A>>) => EitherT1<M, E, A>
|
||||
readonly bimap: <E, A, N, B>(ma: EitherT1<M, E, A>, f: (e: E) => N, g: (a: A) => B) => EitherT1<M, N, B>
|
||||
readonly mapLeft: <E, A, N>(ma: EitherT1<M, E, A>, f: (e: E) => N) => EitherT1<M, N, A>
|
||||
readonly fold: <E, A, R>(
|
||||
ma: EitherT1<M, E, A>,
|
||||
onLeft: (e: E) => Kind<M, R>,
|
||||
onRight: (a: A) => Kind<M, R>
|
||||
) => Kind<M, R>
|
||||
readonly getOrElse: <E, A>(ma: EitherT1<M, E, A>, onLeft: (e: E) => Kind<M, A>) => Kind<M, A>
|
||||
readonly orElse: <E, A, N>(ma: EitherT1<M, E, A>, onLeft: (e: E) => EitherT1<M, N, A>) => EitherT1<M, N, A>
|
||||
readonly swap: <E, A>(ma: EitherT1<M, E, A>) => EitherT1<M, A, E>
|
||||
readonly rightM: <E, A>(ma: Kind<M, A>) => EitherT1<M, E, A>
|
||||
readonly leftM: <E, A>(me: Kind<M, E>) => EitherT1<M, E, A>
|
||||
readonly left: <E, A>(e: E) => EitherT1<M, E, A>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export type EitherT2<M extends URIS2, R, E, A> = Kind2<M, R, Either<E, A>>
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface EitherM2<M extends URIS2> extends ApplicativeComposition22<M, URI> {
|
||||
readonly chain: <R, E, A, B>(ma: EitherT2<M, R, E, A>, f: (a: A) => EitherT2<M, R, E, B>) => EitherT2<M, R, E, B>
|
||||
readonly alt: <R, E, A>(fa: EitherT2<M, R, E, A>, that: LazyArg<EitherT2<M, R, E, A>>) => EitherT2<M, R, E, A>
|
||||
readonly bimap: <R, E, A, N, B>(ma: EitherT2<M, R, E, A>, f: (e: E) => N, g: (a: A) => B) => EitherT2<M, R, N, B>
|
||||
readonly mapLeft: <R, E, A, N>(ma: EitherT2<M, R, E, A>, f: (e: E) => N) => EitherT2<M, R, N, A>
|
||||
readonly fold: <R, E, A, B>(
|
||||
ma: EitherT2<M, R, E, A>,
|
||||
onLeft: (e: E) => Kind2<M, R, B>,
|
||||
onRight: (a: A) => Kind2<M, R, B>
|
||||
) => Kind2<M, R, B>
|
||||
readonly getOrElse: <R, E, A>(ma: EitherT2<M, R, E, A>, onLeft: (e: E) => Kind2<M, R, A>) => Kind2<M, R, A>
|
||||
readonly orElse: <R, E, A, F>(
|
||||
ma: EitherT2<M, R, E, A>,
|
||||
onLeft: (e: E) => EitherT2<M, R, F, A>
|
||||
) => EitherT2<M, R, F, A>
|
||||
readonly swap: <R, E, A>(ma: EitherT2<M, R, E, A>) => EitherT2<M, R, A, E>
|
||||
readonly rightM: <R, E, A>(ma: Kind2<M, R, A>) => EitherT2<M, R, E, A>
|
||||
readonly leftM: <R, E, A>(me: Kind2<M, R, E>) => EitherT2<M, R, E, A>
|
||||
readonly left: <R, E, A>(e: E) => EitherT2<M, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getEitherM<M extends URIS2>(M: Monad2<M>): EitherM2<M>
|
||||
/** @deprecated */
|
||||
export declare function getEitherM<M extends URIS>(M: Monad1<M>): EitherM1<M>
|
||||
/** @deprecated */
|
||||
export declare function getEitherM<M>(M: Monad<M>): EitherM<M>
|
||||
189
node_modules/fp-ts/lib/EitherT.js
generated
vendored
Normal file
189
node_modules/fp-ts/lib/EitherT.js
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.right = right;
|
||||
exports.left = left;
|
||||
exports.rightF = rightF;
|
||||
exports.leftF = leftF;
|
||||
exports.fromNullable = fromNullable;
|
||||
exports.fromNullableK = fromNullableK;
|
||||
exports.chainNullableK = chainNullableK;
|
||||
exports.map = map;
|
||||
exports.ap = ap;
|
||||
exports.chain = chain;
|
||||
exports.flatMap = flatMap;
|
||||
exports.alt = alt;
|
||||
exports.bimap = bimap;
|
||||
exports.mapBoth = mapBoth;
|
||||
exports.mapLeft = mapLeft;
|
||||
exports.mapError = mapError;
|
||||
exports.altValidation = altValidation;
|
||||
exports.match = match;
|
||||
exports.matchE = matchE;
|
||||
exports.getOrElse = getOrElse;
|
||||
exports.orElse = orElse;
|
||||
exports.orElseFirst = orElseFirst;
|
||||
exports.tapError = tapError;
|
||||
exports.orLeft = orLeft;
|
||||
exports.swap = swap;
|
||||
exports.toUnion = toUnion;
|
||||
exports.getEitherM = getEitherM;
|
||||
var Apply_1 = require("./Apply");
|
||||
var E = __importStar(require("./Either"));
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
function right(F) {
|
||||
return (0, function_1.flow)(E.right, F.of);
|
||||
}
|
||||
function left(F) {
|
||||
return (0, function_1.flow)(E.left, F.of);
|
||||
}
|
||||
function rightF(F) {
|
||||
return function (fa) { return F.map(fa, E.right); };
|
||||
}
|
||||
function leftF(F) {
|
||||
return function (fe) { return F.map(fe, E.left); };
|
||||
}
|
||||
function fromNullable(F) {
|
||||
return function (e) { return (0, function_1.flow)(E.fromNullable(e), F.of); };
|
||||
}
|
||||
function fromNullableK(F) {
|
||||
var fromNullableF = fromNullable(F);
|
||||
return function (e) {
|
||||
var fromNullableFE = fromNullableF(e);
|
||||
return function (f) { return (0, function_1.flow)(f, fromNullableFE); };
|
||||
};
|
||||
}
|
||||
function chainNullableK(M) {
|
||||
var chainM = chain(M);
|
||||
var fromNullableKM = fromNullableK(M);
|
||||
return function (e) {
|
||||
var fromNullableKMe = fromNullableKM(e);
|
||||
return function (f) { return chainM(fromNullableKMe(f)); };
|
||||
};
|
||||
}
|
||||
function map(F) {
|
||||
return (0, Functor_1.map)(F, E.Functor);
|
||||
}
|
||||
function ap(F) {
|
||||
return (0, Apply_1.ap)(F, E.Apply);
|
||||
}
|
||||
function chain(M) {
|
||||
var flatMapM = flatMap(M);
|
||||
return function (f) { return function (ma) { return flatMapM(ma, f); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function flatMap(M) {
|
||||
return function (ma, f) { return M.chain(ma, function (e) { return (E.isLeft(e) ? M.of(e) : f(e.right)); }); };
|
||||
}
|
||||
function alt(M) {
|
||||
return function (second) { return function (first) { return M.chain(first, function (e) { return (E.isLeft(e) ? second() : M.of(e)); }); }; };
|
||||
}
|
||||
function bimap(F) {
|
||||
var mapBothF = mapBoth(F);
|
||||
return function (f, g) { return function (self) { return mapBothF(self, f, g); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function mapBoth(F) {
|
||||
return function (self, f, g) { return F.map(self, E.bimap(f, g)); };
|
||||
}
|
||||
function mapLeft(F) {
|
||||
var mapErrorF = mapError(F);
|
||||
return function (f) { return function (self) { return mapErrorF(self, f); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function mapError(F) {
|
||||
return function (self, f) { return F.map(self, E.mapLeft(f)); };
|
||||
}
|
||||
function altValidation(M, S) {
|
||||
return function (second) { return function (first) {
|
||||
return M.chain(first, E.match(function (e1) {
|
||||
return M.map(second(), E.mapLeft(function (e2) { return S.concat(e1, e2); }));
|
||||
}, right(M)));
|
||||
}; };
|
||||
}
|
||||
function match(F) {
|
||||
return function (onLeft, onRight) { return function (ma) { return F.map(ma, E.match(onLeft, onRight)); }; };
|
||||
}
|
||||
function matchE(M) {
|
||||
return function (onLeft, onRight) { return function (ma) { return M.chain(ma, E.match(onLeft, onRight)); }; };
|
||||
}
|
||||
function getOrElse(M) {
|
||||
return function (onLeft) { return function (ma) { return M.chain(ma, E.match(onLeft, M.of)); }; };
|
||||
}
|
||||
function orElse(M) {
|
||||
return function (onLeft) { return function (ma) { return M.chain(ma, function (e) { return (E.isLeft(e) ? onLeft(e.left) : M.of(e)); }); }; };
|
||||
}
|
||||
function orElseFirst(M) {
|
||||
var tapErrorM = tapError(M);
|
||||
return function (onLeft) { return function (ma) { return tapErrorM(ma, onLeft); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function tapError(M) {
|
||||
var orElseM = orElse(M);
|
||||
return function (ma, onLeft) {
|
||||
return (0, function_1.pipe)(ma, orElseM(function (e) { return M.map(onLeft(e), function (eb) { return (E.isLeft(eb) ? eb : E.left(e)); }); }));
|
||||
};
|
||||
}
|
||||
function orLeft(M) {
|
||||
return function (onLeft) { return function (ma) {
|
||||
return M.chain(ma, E.match(function (e) { return M.map(onLeft(e), E.left); }, function (a) { return M.of(E.right(a)); }));
|
||||
}; };
|
||||
}
|
||||
function swap(F) {
|
||||
return function (ma) { return F.map(ma, E.swap); };
|
||||
}
|
||||
function toUnion(F) {
|
||||
return function (fa) { return F.map(fa, E.toUnion); };
|
||||
}
|
||||
/** @deprecated */
|
||||
/* istanbul ignore next */
|
||||
function getEitherM(M) {
|
||||
var _ap = ap(M);
|
||||
var _map = map(M);
|
||||
var _chain = chain(M);
|
||||
var _alt = alt(M);
|
||||
var _bimap = bimap(M);
|
||||
var _mapLeft = mapLeft(M);
|
||||
var _fold = matchE(M);
|
||||
var _getOrElse = getOrElse(M);
|
||||
var _orElse = orElse(M);
|
||||
return {
|
||||
map: function (fa, f) { return (0, function_1.pipe)(fa, _map(f)); },
|
||||
ap: function (fab, fa) { return (0, function_1.pipe)(fab, _ap(fa)); },
|
||||
of: right(M),
|
||||
chain: function (ma, f) { return (0, function_1.pipe)(ma, _chain(f)); },
|
||||
alt: function (fa, that) { return (0, function_1.pipe)(fa, _alt(that)); },
|
||||
bimap: function (fea, f, g) { return (0, function_1.pipe)(fea, _bimap(f, g)); },
|
||||
mapLeft: function (fea, f) { return (0, function_1.pipe)(fea, _mapLeft(f)); },
|
||||
fold: function (fa, onLeft, onRight) { return (0, function_1.pipe)(fa, _fold(onLeft, onRight)); },
|
||||
getOrElse: function (fa, onLeft) { return (0, function_1.pipe)(fa, _getOrElse(onLeft)); },
|
||||
orElse: function (fa, f) { return (0, function_1.pipe)(fa, _orElse(f)); },
|
||||
swap: swap(M),
|
||||
rightM: rightF(M),
|
||||
leftM: leftF(M),
|
||||
left: left(M)
|
||||
};
|
||||
}
|
||||
40
node_modules/fp-ts/lib/Endomorphism.d.ts
generated
vendored
Normal file
40
node_modules/fp-ts/lib/Endomorphism.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
import { Monoid } from './Monoid'
|
||||
import { Semigroup } from './Semigroup'
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface Endomorphism<A> {
|
||||
(a: A): A
|
||||
}
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare const URI = 'Endomorphism'
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export type URI = typeof URI
|
||||
declare module './HKT' {
|
||||
interface URItoKind<A> {
|
||||
readonly [URI]: Endomorphism<A>
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Endomorphism form a `Semigroup` where the `concat` operation is the usual function composition.
|
||||
*
|
||||
* @category instances
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare const getSemigroup: <A = never>() => Semigroup<Endomorphism<A>>
|
||||
/**
|
||||
* Endomorphism form a `Monoid` where the `empty` value is the `identity` function.
|
||||
*
|
||||
* @category instances
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare const getMonoid: <A = never>() => Monoid<Endomorphism<A>>
|
||||
33
node_modules/fp-ts/lib/Endomorphism.js
generated
vendored
Normal file
33
node_modules/fp-ts/lib/Endomorphism.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getMonoid = exports.getSemigroup = exports.URI = void 0;
|
||||
var function_1 = require("./function");
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.11.0
|
||||
*/
|
||||
exports.URI = 'Endomorphism';
|
||||
/**
|
||||
* Endomorphism form a `Semigroup` where the `concat` operation is the usual function composition.
|
||||
*
|
||||
* @category instances
|
||||
* @since 2.11.0
|
||||
*/
|
||||
var getSemigroup = function () { return ({
|
||||
concat: function (first, second) { return (0, function_1.flow)(first, second); }
|
||||
}); };
|
||||
exports.getSemigroup = getSemigroup;
|
||||
/**
|
||||
* Endomorphism form a `Monoid` where the `empty` value is the `identity` function.
|
||||
*
|
||||
* @category instances
|
||||
* @since 2.11.0
|
||||
*/
|
||||
var getMonoid = function () { return ({
|
||||
concat: (0, exports.getSemigroup)().concat,
|
||||
empty: function_1.identity
|
||||
}); };
|
||||
exports.getMonoid = getMonoid;
|
||||
206
node_modules/fp-ts/lib/Eq.d.ts
generated
vendored
Normal file
206
node_modules/fp-ts/lib/Eq.d.ts
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* The `Eq` type class represents types which support decidable equality.
|
||||
*
|
||||
* Instances must satisfy the following laws:
|
||||
*
|
||||
* 1. Reflexivity: `E.equals(a, a) === true`
|
||||
* 2. Symmetry: `E.equals(a, b) === E.equals(b, a)`
|
||||
* 3. Transitivity: if `E.equals(a, b) === true` and `E.equals(b, c) === true`, then `E.equals(a, c) === true`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Contravariant1 } from './Contravariant'
|
||||
import { Monoid } from './Monoid'
|
||||
import { ReadonlyRecord } from './ReadonlyRecord'
|
||||
import { Semigroup } from './Semigroup'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Eq<A> {
|
||||
readonly equals: (x: A, y: A) => boolean
|
||||
}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const fromEquals: <A>(equals: Eq<A>['equals']) => Eq<A>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const struct: <A>(eqs: { [K in keyof A]: Eq<A[K]> }) => Eq<{ readonly [K in keyof A]: A[K] }>
|
||||
/**
|
||||
* Given a tuple of `Eq`s returns a `Eq` for the tuple
|
||||
*
|
||||
* @example
|
||||
* import { tuple } from 'fp-ts/Eq'
|
||||
* import * as S from 'fp-ts/string'
|
||||
* import * as N from 'fp-ts/number'
|
||||
* import * as B from 'fp-ts/boolean'
|
||||
*
|
||||
* const E = tuple(S.Eq, N.Eq, B.Eq)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['a', 1, true]), true)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['b', 1, true]), false)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['a', 2, true]), false)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['a', 1, false]), false)
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const tuple: <A extends ReadonlyArray<unknown>>(...eqs: { [K in keyof A]: Eq<A[K]> }) => Eq<Readonly<A>>
|
||||
/**
|
||||
* A typical use case for `contramap` would be like, given some `User` type, to construct an `Eq<User>`.
|
||||
*
|
||||
* We can do so with a function from `User -> X` where `X` is some value that we know how to compare
|
||||
* for equality (meaning we have an `Eq<X>`)
|
||||
*
|
||||
* For example, given the following `User` type, we want to construct an `Eq<User>` that just looks at the `key` field
|
||||
* for each user (since it's known to be unique).
|
||||
*
|
||||
* If we have a way of comparing `UUID`s for equality (`eqUUID: Eq<UUID>`) and we know how to go from `User -> UUID`,
|
||||
* using `contramap` we can do this
|
||||
*
|
||||
* @example
|
||||
* import { contramap, Eq } from 'fp-ts/Eq'
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
* import * as S from 'fp-ts/string'
|
||||
*
|
||||
* type UUID = string
|
||||
*
|
||||
* interface User {
|
||||
* readonly key: UUID
|
||||
* readonly firstName: string
|
||||
* readonly lastName: string
|
||||
* }
|
||||
*
|
||||
* const eqUUID: Eq<UUID> = S.Eq
|
||||
*
|
||||
* const eqUserByKey: Eq<User> = pipe(
|
||||
* eqUUID,
|
||||
* contramap((user) => user.key)
|
||||
* )
|
||||
*
|
||||
* assert.deepStrictEqual(
|
||||
* eqUserByKey.equals(
|
||||
* { key: 'k1', firstName: 'a1', lastName: 'b1' },
|
||||
* { key: 'k2', firstName: 'a1', lastName: 'b1' }
|
||||
* ),
|
||||
* false
|
||||
* )
|
||||
* assert.deepStrictEqual(
|
||||
* eqUserByKey.equals(
|
||||
* { key: 'k1', firstName: 'a1', lastName: 'b1' },
|
||||
* { key: 'k1', firstName: 'a2', lastName: 'b1' }
|
||||
* ),
|
||||
* true
|
||||
* )
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const contramap: <A, B>(f: (b: B) => A) => (fa: Eq<A>) => Eq<B>
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const URI = 'Eq'
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type URI = typeof URI
|
||||
declare module './HKT' {
|
||||
interface URItoKind<A> {
|
||||
readonly [URI]: Eq<A>
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.5.0
|
||||
*/
|
||||
export declare const eqStrict: Eq<unknown>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const getSemigroup: <A>() => Semigroup<Eq<A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
export declare const getMonoid: <A>() => Monoid<Eq<A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Contravariant: Contravariant1<URI>
|
||||
/**
|
||||
* Use [`tuple`](#tuple) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const getTupleEq: <T extends ReadonlyArray<Eq<any>>>(
|
||||
...eqs: T
|
||||
) => Eq<{
|
||||
[K in keyof T]: T[K] extends Eq<infer A> ? A : never
|
||||
}>
|
||||
/**
|
||||
* Use [`struct`](#struct) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const getStructEq: <O extends ReadonlyRecord<string, any>>(eqs: {
|
||||
[K in keyof O]: Eq<O[K]>
|
||||
}) => Eq<O>
|
||||
/**
|
||||
* Use [`eqStrict`](#eqstrict) instead
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const strictEqual: <A>(a: A, b: A) => boolean
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Contravariant` instance, pass `E.Contravariant` instead of `E.eq`
|
||||
* (where `E` is from `import E from 'fp-ts/Eq'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const eq: Contravariant1<URI>
|
||||
/**
|
||||
* Use [`Eq`](./boolean.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const eqBoolean: Eq<boolean>
|
||||
/**
|
||||
* Use [`Eq`](./string.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const eqString: Eq<string>
|
||||
/**
|
||||
* Use [`Eq`](./number.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const eqNumber: Eq<number>
|
||||
/**
|
||||
* Use [`Eq`](./Date.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const eqDate: Eq<Date>
|
||||
223
node_modules/fp-ts/lib/Eq.js
generated
vendored
Normal file
223
node_modules/fp-ts/lib/Eq.js
generated
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.eqDate = exports.eqNumber = exports.eqString = exports.eqBoolean = exports.eq = exports.strictEqual = exports.getStructEq = exports.getTupleEq = exports.Contravariant = exports.getMonoid = exports.getSemigroup = exports.eqStrict = exports.URI = exports.contramap = exports.tuple = exports.struct = exports.fromEquals = void 0;
|
||||
var function_1 = require("./function");
|
||||
// -------------------------------------------------------------------------------------
|
||||
// constructors
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var fromEquals = function (equals) { return ({
|
||||
equals: function (x, y) { return x === y || equals(x, y); }
|
||||
}); };
|
||||
exports.fromEquals = fromEquals;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// combinators
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var struct = function (eqs) {
|
||||
return (0, exports.fromEquals)(function (first, second) {
|
||||
for (var key in eqs) {
|
||||
if (!eqs[key].equals(first[key], second[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
exports.struct = struct;
|
||||
/**
|
||||
* Given a tuple of `Eq`s returns a `Eq` for the tuple
|
||||
*
|
||||
* @example
|
||||
* import { tuple } from 'fp-ts/Eq'
|
||||
* import * as S from 'fp-ts/string'
|
||||
* import * as N from 'fp-ts/number'
|
||||
* import * as B from 'fp-ts/boolean'
|
||||
*
|
||||
* const E = tuple(S.Eq, N.Eq, B.Eq)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['a', 1, true]), true)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['b', 1, true]), false)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['a', 2, true]), false)
|
||||
* assert.strictEqual(E.equals(['a', 1, true], ['a', 1, false]), false)
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var tuple = function () {
|
||||
var eqs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
eqs[_i] = arguments[_i];
|
||||
}
|
||||
return (0, exports.fromEquals)(function (first, second) { return eqs.every(function (E, i) { return E.equals(first[i], second[i]); }); });
|
||||
};
|
||||
exports.tuple = tuple;
|
||||
/* istanbul ignore next */
|
||||
var contramap_ = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.contramap)(f)); };
|
||||
/**
|
||||
* A typical use case for `contramap` would be like, given some `User` type, to construct an `Eq<User>`.
|
||||
*
|
||||
* We can do so with a function from `User -> X` where `X` is some value that we know how to compare
|
||||
* for equality (meaning we have an `Eq<X>`)
|
||||
*
|
||||
* For example, given the following `User` type, we want to construct an `Eq<User>` that just looks at the `key` field
|
||||
* for each user (since it's known to be unique).
|
||||
*
|
||||
* If we have a way of comparing `UUID`s for equality (`eqUUID: Eq<UUID>`) and we know how to go from `User -> UUID`,
|
||||
* using `contramap` we can do this
|
||||
*
|
||||
* @example
|
||||
* import { contramap, Eq } from 'fp-ts/Eq'
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
* import * as S from 'fp-ts/string'
|
||||
*
|
||||
* type UUID = string
|
||||
*
|
||||
* interface User {
|
||||
* readonly key: UUID
|
||||
* readonly firstName: string
|
||||
* readonly lastName: string
|
||||
* }
|
||||
*
|
||||
* const eqUUID: Eq<UUID> = S.Eq
|
||||
*
|
||||
* const eqUserByKey: Eq<User> = pipe(
|
||||
* eqUUID,
|
||||
* contramap((user) => user.key)
|
||||
* )
|
||||
*
|
||||
* assert.deepStrictEqual(
|
||||
* eqUserByKey.equals(
|
||||
* { key: 'k1', firstName: 'a1', lastName: 'b1' },
|
||||
* { key: 'k2', firstName: 'a1', lastName: 'b1' }
|
||||
* ),
|
||||
* false
|
||||
* )
|
||||
* assert.deepStrictEqual(
|
||||
* eqUserByKey.equals(
|
||||
* { key: 'k1', firstName: 'a1', lastName: 'b1' },
|
||||
* { key: 'k1', firstName: 'a2', lastName: 'b1' }
|
||||
* ),
|
||||
* true
|
||||
* )
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var contramap = function (f) { return function (fa) {
|
||||
return (0, exports.fromEquals)(function (x, y) { return fa.equals(f(x), f(y)); });
|
||||
}; };
|
||||
exports.contramap = contramap;
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.URI = 'Eq';
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.5.0
|
||||
*/
|
||||
exports.eqStrict = {
|
||||
equals: function (a, b) { return a === b; }
|
||||
};
|
||||
var empty = {
|
||||
equals: function () { return true; }
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var getSemigroup = function () { return ({
|
||||
concat: function (x, y) { return (0, exports.fromEquals)(function (a, b) { return x.equals(a, b) && y.equals(a, b); }); }
|
||||
}); };
|
||||
exports.getSemigroup = getSemigroup;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.6.0
|
||||
*/
|
||||
var getMonoid = function () { return ({
|
||||
concat: (0, exports.getSemigroup)().concat,
|
||||
empty: empty
|
||||
}); };
|
||||
exports.getMonoid = getMonoid;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Contravariant = {
|
||||
URI: exports.URI,
|
||||
contramap: contramap_
|
||||
};
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Use [`tuple`](#tuple) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.getTupleEq = exports.tuple;
|
||||
/**
|
||||
* Use [`struct`](#struct) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.getStructEq = exports.struct;
|
||||
/**
|
||||
* Use [`eqStrict`](#eqstrict) instead
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.strictEqual = exports.eqStrict.equals;
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Contravariant` instance, pass `E.Contravariant` instead of `E.eq`
|
||||
* (where `E` is from `import E from 'fp-ts/Eq'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.eq = exports.Contravariant;
|
||||
/**
|
||||
* Use [`Eq`](./boolean.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.eqBoolean = exports.eqStrict;
|
||||
/**
|
||||
* Use [`Eq`](./string.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.eqString = exports.eqStrict;
|
||||
/**
|
||||
* Use [`Eq`](./number.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.eqNumber = exports.eqStrict;
|
||||
/**
|
||||
* Use [`Eq`](./Date.ts.html#eq) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.eqDate = {
|
||||
equals: function (first, second) { return first.valueOf() === second.valueOf(); }
|
||||
};
|
||||
54
node_modules/fp-ts/lib/Extend.d.ts
generated
vendored
Normal file
54
node_modules/fp-ts/lib/Extend.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Functor, Functor1, Functor2, Functor2C, Functor3, Functor3C, Functor4 } from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Extend<W> extends Functor<W> {
|
||||
readonly extend: <A, B>(wa: HKT<W, A>, f: (wa: HKT<W, A>) => B) => HKT<W, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Extend1<W extends URIS> extends Functor1<W> {
|
||||
readonly extend: <A, B>(wa: Kind<W, A>, f: (wa: Kind<W, A>) => B) => Kind<W, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Extend2<W extends URIS2> extends Functor2<W> {
|
||||
readonly extend: <E, A, B>(wa: Kind2<W, E, A>, f: (wa: Kind2<W, E, A>) => B) => Kind2<W, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Extend2C<W extends URIS2, E> extends Functor2C<W, E> {
|
||||
readonly extend: <A, B>(wa: Kind2<W, E, A>, f: (wa: Kind2<W, E, A>) => B) => Kind2<W, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Extend3<W extends URIS3> extends Functor3<W> {
|
||||
readonly extend: <R, E, A, B>(wa: Kind3<W, R, E, A>, f: (wa: Kind3<W, R, E, A>) => B) => Kind3<W, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Extend3C<W extends URIS3, E> extends Functor3C<W, E> {
|
||||
readonly extend: <R, A, B>(wa: Kind3<W, R, E, A>, f: (wa: Kind3<W, R, E, A>) => B) => Kind3<W, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Extend4<W extends URIS4> extends Functor4<W> {
|
||||
readonly extend: <S, R, E, A, B>(wa: Kind4<W, S, R, E, A>, f: (wa: Kind4<W, S, R, E, A>) => B) => Kind4<W, S, R, E, B>
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Extend.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Extend.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
36
node_modules/fp-ts/lib/Field.d.ts
generated
vendored
Normal file
36
node_modules/fp-ts/lib/Field.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Adapted from https://github.com/purescript/purescript-prelude/blob/master/src/Data/Field.purs
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Eq } from './Eq'
|
||||
import { Ring } from './Ring'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Field<A> extends Ring<A> {
|
||||
readonly degree: (a: A) => number
|
||||
readonly div: (x: A, y: A) => A
|
||||
readonly mod: (x: A, y: A) => A
|
||||
}
|
||||
/**
|
||||
* The *greatest common divisor* of two values
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function gcd<A>(E: Eq<A>, field: Field<A>): (x: A, y: A) => A
|
||||
/**
|
||||
* The *least common multiple* of two values
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function lcm<A>(E: Eq<A>, F: Field<A>): (x: A, y: A) => A
|
||||
/**
|
||||
* Use [`Field`](./number.ts.html#field) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const fieldNumber: Field<number>
|
||||
48
node_modules/fp-ts/lib/Field.js
generated
vendored
Normal file
48
node_modules/fp-ts/lib/Field.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fieldNumber = void 0;
|
||||
exports.gcd = gcd;
|
||||
exports.lcm = lcm;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// utils
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* The *greatest common divisor* of two values
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function gcd(E, field) {
|
||||
var zero = field.zero;
|
||||
var f = function (x, y) { return (E.equals(y, zero) ? x : f(y, field.mod(x, y))); };
|
||||
return f;
|
||||
}
|
||||
/**
|
||||
* The *least common multiple* of two values
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function lcm(E, F) {
|
||||
var zero = F.zero;
|
||||
var gcdSF = gcd(E, F);
|
||||
return function (x, y) { return (E.equals(x, zero) || E.equals(y, zero) ? zero : F.div(F.mul(x, y), gcdSF(x, y))); };
|
||||
}
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Use [`Field`](./number.ts.html#field) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.fieldNumber = {
|
||||
add: function (x, y) { return x + y; },
|
||||
zero: 0,
|
||||
mul: function (x, y) { return x * y; },
|
||||
one: 1,
|
||||
sub: function (x, y) { return x - y; },
|
||||
degree: function (_) { return 1; },
|
||||
div: function (x, y) { return x / y; },
|
||||
mod: function (x, y) { return x % y; }
|
||||
};
|
||||
628
node_modules/fp-ts/lib/Filterable.d.ts
generated
vendored
Normal file
628
node_modules/fp-ts/lib/Filterable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,628 @@
|
||||
/**
|
||||
* `Filterable` represents data structures which can be _partitioned_/_filtered_.
|
||||
*
|
||||
* Adapted from https://github.com/LiamGoodacre/purescript-filterable/blob/master/src/Data/Filterable.purs
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import {
|
||||
Compactable,
|
||||
Compactable1,
|
||||
Compactable2,
|
||||
Compactable2C,
|
||||
Compactable3,
|
||||
Compactable3C,
|
||||
Compactable4,
|
||||
CompactableComposition,
|
||||
CompactableComposition11,
|
||||
CompactableComposition12,
|
||||
CompactableComposition12C,
|
||||
CompactableComposition21,
|
||||
CompactableComposition22,
|
||||
CompactableComposition23
|
||||
} from './Compactable'
|
||||
import { Either } from './Either'
|
||||
import {
|
||||
Functor,
|
||||
Functor1,
|
||||
Functor2,
|
||||
Functor2C,
|
||||
Functor3,
|
||||
Functor3C,
|
||||
Functor4,
|
||||
FunctorComposition,
|
||||
FunctorComposition11,
|
||||
FunctorComposition12,
|
||||
FunctorComposition12C,
|
||||
FunctorComposition21,
|
||||
FunctorComposition22,
|
||||
FunctorComposition23
|
||||
} from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Option } from './Option'
|
||||
import { Predicate } from './Predicate'
|
||||
import { Refinement } from './Refinement'
|
||||
import { Separated } from './Separated'
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filter<F> {
|
||||
<A, B extends A>(fa: HKT<F, A>, refinement: Refinement<A, B>): HKT<F, B>
|
||||
<A>(fa: HKT<F, A>, predicate: Predicate<A>): HKT<F, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Partition<F> {
|
||||
<A, B extends A>(fa: HKT<F, A>, refinement: Refinement<A, B>): Separated<HKT<F, A>, HKT<F, B>>
|
||||
<A>(fa: HKT<F, A>, predicate: Predicate<A>): Separated<HKT<F, A>, HKT<F, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filterable<F> extends Functor<F>, Compactable<F> {
|
||||
/**
|
||||
* Partition a data structure based on an either predicate.
|
||||
*/
|
||||
readonly partitionMap: <A, B, C>(fa: HKT<F, A>, f: (a: A) => Either<B, C>) => Separated<HKT<F, B>, HKT<F, C>>
|
||||
/**
|
||||
* Partition a data structure based on a boolean predicate.
|
||||
*/
|
||||
readonly partition: Partition<F>
|
||||
/**
|
||||
* Map over a data structure and filter based on an option predicate.
|
||||
*/
|
||||
readonly filterMap: <A, B>(fa: HKT<F, A>, f: (a: A) => Option<B>) => HKT<F, B>
|
||||
/**
|
||||
* Filter a data structure based on a boolean predicate.
|
||||
*/
|
||||
readonly filter: Filter<F>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filter1<F extends URIS> {
|
||||
<A, B extends A>(fa: Kind<F, A>, refinement: Refinement<A, B>): Kind<F, B>
|
||||
<A>(fa: Kind<F, A>, predicate: Predicate<A>): Kind<F, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Partition1<F extends URIS> {
|
||||
<A, B extends A>(fa: Kind<F, A>, refinement: Refinement<A, B>): Separated<Kind<F, A>, Kind<F, B>>
|
||||
<A>(fa: Kind<F, A>, predicate: Predicate<A>): Separated<Kind<F, A>, Kind<F, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filterable1<F extends URIS> extends Functor1<F>, Compactable1<F> {
|
||||
readonly partitionMap: <A, B, C>(fa: Kind<F, A>, f: (a: A) => Either<B, C>) => Separated<Kind<F, B>, Kind<F, C>>
|
||||
readonly partition: Partition1<F>
|
||||
readonly filterMap: <A, B>(fa: Kind<F, A>, f: (a: A) => Option<B>) => Kind<F, B>
|
||||
readonly filter: Filter1<F>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filter2<F extends URIS2> {
|
||||
<E, A, B extends A>(fa: Kind2<F, E, A>, refinement: Refinement<A, B>): Kind2<F, E, B>
|
||||
<E, A>(fa: Kind2<F, E, A>, predicate: Predicate<A>): Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Partition2<F extends URIS2> {
|
||||
<E, A, B extends A>(fa: Kind2<F, E, A>, refinement: Refinement<A, B>): Separated<Kind2<F, E, A>, Kind2<F, E, B>>
|
||||
<E, A>(fa: Kind2<F, E, A>, predicate: Predicate<A>): Separated<Kind2<F, E, A>, Kind2<F, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filterable2<F extends URIS2> extends Functor2<F>, Compactable2<F> {
|
||||
readonly partitionMap: <E, A, B, C>(
|
||||
fa: Kind2<F, E, A>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
|
||||
readonly partition: Partition2<F>
|
||||
readonly filterMap: <E, A, B>(fa: Kind2<F, E, A>, f: (a: A) => Option<B>) => Kind2<F, E, B>
|
||||
readonly filter: Filter2<F>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filter2C<F extends URIS2, E> {
|
||||
<A, B extends A>(fa: Kind2<F, E, A>, refinement: Refinement<A, B>): Kind2<F, E, B>
|
||||
<A>(fa: Kind2<F, E, A>, predicate: Predicate<A>): Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Partition2C<F extends URIS2, E> {
|
||||
<A, B extends A>(fa: Kind2<F, E, A>, refinement: Refinement<A, B>): Separated<Kind2<F, E, A>, Kind2<F, E, B>>
|
||||
<A>(fa: Kind2<F, E, A>, predicate: Predicate<A>): Separated<Kind2<F, E, A>, Kind2<F, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filterable2C<F extends URIS2, E> extends Functor2C<F, E>, Compactable2C<F, E> {
|
||||
readonly partitionMap: <A, B, C>(
|
||||
fa: Kind2<F, E, A>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
|
||||
readonly partition: Partition2C<F, E>
|
||||
readonly filterMap: <A, B>(fa: Kind2<F, E, A>, f: (a: A) => Option<B>) => Kind2<F, E, B>
|
||||
readonly filter: Filter2C<F, E>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filter3<F extends URIS3> {
|
||||
<R, E, A, B extends A>(fa: Kind3<F, R, E, A>, refinement: Refinement<A, B>): Kind3<F, R, E, B>
|
||||
<R, E, A>(fa: Kind3<F, R, E, A>, predicate: Predicate<A>): Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Partition3<F extends URIS3> {
|
||||
<R, E, A, B extends A>(fa: Kind3<F, R, E, A>, refinement: Refinement<A, B>): Separated<
|
||||
Kind3<F, R, E, A>,
|
||||
Kind3<F, R, E, B>
|
||||
>
|
||||
<R, E, A>(fa: Kind3<F, R, E, A>, predicate: Predicate<A>): Separated<Kind3<F, R, E, A>, Kind3<F, R, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filterable3<F extends URIS3> extends Functor3<F>, Compactable3<F> {
|
||||
readonly partitionMap: <R, E, A, B, C>(
|
||||
fa: Kind3<F, R, E, A>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
|
||||
readonly partition: Partition3<F>
|
||||
readonly filterMap: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => Option<B>) => Kind3<F, R, E, B>
|
||||
readonly filter: Filter3<F>
|
||||
}
|
||||
/**
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Filter3C<F extends URIS3, E> {
|
||||
<R, A, B extends A>(fa: Kind3<F, R, E, A>, refinement: Refinement<A, B>): Kind3<F, R, E, B>
|
||||
<R, A>(fa: Kind3<F, R, E, A>, predicate: Predicate<A>): Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Partition3C<F extends URIS3, E> {
|
||||
<R, A, B extends A>(fa: Kind3<F, R, E, A>, refinement: Refinement<A, B>): Separated<
|
||||
Kind3<F, R, E, A>,
|
||||
Kind3<F, R, E, B>
|
||||
>
|
||||
<R, A>(fa: Kind3<F, R, E, A>, predicate: Predicate<A>): Separated<Kind3<F, R, E, A>, Kind3<F, R, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Filterable3C<F extends URIS3, E> extends Functor3C<F, E>, Compactable3C<F, E> {
|
||||
readonly partitionMap: <R, A, B, C>(
|
||||
fa: Kind3<F, R, E, A>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
|
||||
readonly partition: Partition3C<F, E>
|
||||
readonly filterMap: <R, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => Option<B>) => Kind3<F, R, E, B>
|
||||
readonly filter: Filter3C<F, E>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filter4<F extends URIS4> {
|
||||
<S, R, E, A, B extends A>(fa: Kind4<F, S, R, E, A>, refinement: Refinement<A, B>): Kind4<F, S, R, E, B>
|
||||
<S, R, E, A>(fa: Kind4<F, S, R, E, A>, predicate: Predicate<A>): Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Partition4<F extends URIS4> {
|
||||
<S, R, E, A, B extends A>(fa: Kind4<F, S, R, E, A>, refinement: Refinement<A, B>): Separated<
|
||||
Kind4<F, S, R, E, A>,
|
||||
Kind4<F, S, R, E, B>
|
||||
>
|
||||
<S, R, E, A>(fa: Kind4<F, S, R, E, A>, predicate: Predicate<A>): Separated<Kind4<F, S, R, E, A>, Kind4<F, S, R, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Filterable4<F extends URIS4> extends Functor4<F>, Compactable4<F> {
|
||||
readonly partitionMap: <S, R, E, A, B, C>(
|
||||
fa: Kind4<F, S, R, E, A>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind4<F, S, R, E, B>, Kind4<F, S, R, E, C>>
|
||||
readonly partition: Partition4<F>
|
||||
readonly filterMap: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (a: A) => Option<B>) => Kind4<F, S, R, E, B>
|
||||
readonly filter: Filter4<F>
|
||||
}
|
||||
/**
|
||||
* `filter` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function filter<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): <R>(fga: Kind2<F, R, Kind2<G, E, A>>) => Kind2<F, R, Kind2<G, E, B>>
|
||||
<A>(predicate: Predicate<A>): <R, B extends A>(fgb: Kind2<F, R, Kind2<G, E, B>>) => Kind2<F, R, Kind2<G, E, B>>
|
||||
<A>(predicate: Predicate<A>): <R>(fga: Kind2<F, R, Kind2<G, E, A>>) => Kind2<F, R, Kind2<G, E, A>>
|
||||
}
|
||||
export declare function filter<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (fga: Kind<F, Kind2<G, E, A>>) => Kind<F, Kind2<G, E, B>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(fgb: Kind<F, Kind2<G, E, B>>) => Kind<F, Kind2<G, E, B>>
|
||||
<A>(predicate: Predicate<A>): (fga: Kind<F, Kind2<G, E, A>>) => Kind<F, Kind2<G, E, A>>
|
||||
}
|
||||
export declare function filter<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable1<G>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (fga: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, B>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(fgb: Kind<F, Kind<G, B>>) => Kind<F, Kind<G, B>>
|
||||
<A>(predicate: Predicate<A>): (fga: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, A>>
|
||||
}
|
||||
export declare function filter<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Filterable<G>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (fga: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, B>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(fgb: HKT<F, HKT<G, B>>) => HKT<F, HKT<G, B>>
|
||||
<A>(predicate: Predicate<A>): (fga: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, A>>
|
||||
}
|
||||
/**
|
||||
* `filterMap` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function filterMap<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): <A, B>(f: (a: A) => Option<B>) => <FE>(fga: Kind2<F, FE, Kind2<G, E, A>>) => Kind2<F, FE, Kind2<G, E, B>>
|
||||
export declare function filterMap<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): <A, B>(f: (a: A) => Option<B>) => (fga: Kind<F, Kind2<G, E, A>>) => Kind<F, Kind2<G, E, B>>
|
||||
export declare function filterMap<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable1<G>
|
||||
): <A, B>(f: (a: A) => Option<B>) => (fga: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, B>>
|
||||
export declare function filterMap<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Filterable<G>
|
||||
): <A, B>(f: (a: A) => Option<B>) => (fga: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, B>>
|
||||
/**
|
||||
* `partition` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function partition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): <R>(
|
||||
fga: Kind2<F, R, Kind2<G, E, A>>
|
||||
) => Separated<Kind2<F, R, Kind2<G, E, A>>, Kind2<F, R, Kind2<G, E, B>>>
|
||||
<A>(predicate: Predicate<A>): <R, B extends A>(
|
||||
fgb: Kind2<F, R, Kind2<G, E, B>>
|
||||
) => Separated<Kind2<F, R, Kind2<G, E, B>>, Kind2<F, R, Kind2<G, E, B>>>
|
||||
<A>(predicate: Predicate<A>): <R>(
|
||||
fga: Kind2<F, R, Kind2<G, E, A>>
|
||||
) => Separated<Kind2<F, R, Kind2<G, E, A>>, Kind2<F, R, Kind2<G, E, A>>>
|
||||
}
|
||||
export declare function partition<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (
|
||||
fga: Kind<F, Kind2<G, E, A>>
|
||||
) => Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, B>>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(
|
||||
fgb: Kind<F, Kind2<G, E, B>>
|
||||
) => Separated<Kind<F, Kind2<G, E, B>>, Kind<F, Kind2<G, E, B>>>
|
||||
<A>(predicate: Predicate<A>): (
|
||||
fga: Kind<F, Kind2<G, E, A>>
|
||||
) => Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, A>>>
|
||||
}
|
||||
export declare function partition<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable1<G>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (
|
||||
fga: Kind<F, Kind<G, A>>
|
||||
) => Separated<Kind<F, Kind<G, A>>, Kind<F, Kind<G, B>>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(
|
||||
fgb: Kind<F, Kind<G, B>>
|
||||
) => Separated<Kind<F, Kind<G, B>>, Kind<F, Kind<G, B>>>
|
||||
<A>(predicate: Predicate<A>): (fga: Kind<F, Kind<G, A>>) => Separated<Kind<F, Kind<G, A>>, Kind<F, Kind<G, A>>>
|
||||
}
|
||||
export declare function partition<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Filterable<G>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (
|
||||
fga: HKT<F, HKT<G, A>>
|
||||
) => Separated<HKT<F, HKT<G, A>>, HKT<F, HKT<G, B>>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(fgb: HKT<F, HKT<G, B>>) => Separated<HKT<F, HKT<G, B>>, HKT<F, HKT<G, B>>>
|
||||
<A>(predicate: Predicate<A>): (fga: HKT<F, HKT<G, A>>) => Separated<HKT<F, HKT<G, A>>, HKT<F, HKT<G, A>>>
|
||||
}
|
||||
/**
|
||||
* `partitionMap` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function partitionMap<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): <A, B, C>(
|
||||
f: (a: A) => Either<B, C>
|
||||
) => <FE>(fa: Kind2<F, FE, Kind2<G, E, A>>) => Separated<Kind2<F, FE, Kind2<G, E, B>>, Kind2<F, FE, Kind2<G, E, C>>>
|
||||
export declare function partitionMap<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): <A, B, C>(
|
||||
f: (a: A) => Either<B, C>
|
||||
) => (fa: Kind<F, Kind2<G, E, A>>) => Separated<Kind<F, Kind2<G, E, B>>, Kind<F, Kind2<G, E, C>>>
|
||||
export declare function partitionMap<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable1<G>
|
||||
): <A, B, C>(
|
||||
f: (a: A) => Either<B, C>
|
||||
) => (fa: Kind<F, Kind<G, A>>) => Separated<Kind<F, Kind<G, B>>, Kind<F, Kind<G, C>>>
|
||||
export declare function partitionMap<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Filterable<G>
|
||||
): <A, B, C>(f: (a: A) => Either<B, C>) => (fa: HKT<F, HKT<G, A>>) => Separated<HKT<F, HKT<G, B>>, HKT<F, HKT<G, C>>>
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition<F, G> extends FunctorComposition<F, G>, CompactableComposition<F, G> {
|
||||
readonly partitionMap: <A, B, C>(
|
||||
fa: HKT<F, HKT<G, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<HKT<F, HKT<G, B>>, HKT<F, HKT<G, C>>>
|
||||
readonly partition: <A>(
|
||||
fa: HKT<F, HKT<G, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<HKT<F, HKT<G, A>>, HKT<F, HKT<G, A>>>
|
||||
readonly filterMap: <A, B>(fa: HKT<F, HKT<G, A>>, f: (a: A) => Option<B>) => HKT<F, HKT<G, B>>
|
||||
readonly filter: <A>(fa: HKT<F, HKT<G, A>>, predicate: Predicate<A>) => HKT<F, HKT<G, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition11<F extends URIS, G extends URIS>
|
||||
extends FunctorComposition11<F, G>,
|
||||
CompactableComposition11<F, G> {
|
||||
readonly partitionMap: <A, B, C>(
|
||||
fa: Kind<F, Kind<G, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind<F, Kind<G, B>>, Kind<F, Kind<G, C>>>
|
||||
readonly partition: <A>(
|
||||
fa: Kind<F, Kind<G, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind<F, Kind<G, A>>, Kind<F, Kind<G, A>>>
|
||||
readonly filterMap: <A, B>(fa: Kind<F, Kind<G, A>>, f: (a: A) => Option<B>) => Kind<F, Kind<G, B>>
|
||||
readonly filter: <A>(fa: Kind<F, Kind<G, A>>, predicate: Predicate<A>) => Kind<F, Kind<G, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition12<F extends URIS, G extends URIS2>
|
||||
extends FunctorComposition12<F, G>,
|
||||
CompactableComposition12<F, G> {
|
||||
readonly partitionMap: <E, A, B, C>(
|
||||
fa: Kind<F, Kind2<G, E, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind<F, Kind2<G, E, B>>, Kind<F, Kind2<G, E, C>>>
|
||||
readonly partition: <E, A>(
|
||||
fa: Kind<F, Kind2<G, E, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, A>>>
|
||||
readonly filterMap: <E, A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (a: A) => Option<B>) => Kind<F, Kind2<G, E, B>>
|
||||
readonly filter: <E, A>(fa: Kind<F, Kind2<G, E, A>>, predicate: Predicate<A>) => Kind<F, Kind2<G, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition12C<F extends URIS, G extends URIS2, E>
|
||||
extends FunctorComposition12C<F, G, E>,
|
||||
CompactableComposition12C<F, G, E> {
|
||||
readonly partitionMap: <A, B, C>(
|
||||
fa: Kind<F, Kind2<G, E, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind<F, Kind2<G, E, B>>, Kind<F, Kind2<G, E, C>>>
|
||||
readonly partition: <A>(
|
||||
fa: Kind<F, Kind2<G, E, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind<F, Kind2<G, E, A>>, Kind<F, Kind2<G, E, A>>>
|
||||
readonly filterMap: <A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (a: A) => Option<B>) => Kind<F, Kind2<G, E, B>>
|
||||
readonly filter: <A>(fa: Kind<F, Kind2<G, E, A>>, predicate: Predicate<A>) => Kind<F, Kind2<G, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition21<F extends URIS2, G extends URIS>
|
||||
extends FunctorComposition21<F, G>,
|
||||
CompactableComposition21<F, G> {
|
||||
readonly partitionMap: <E, A, B, C>(
|
||||
fa: Kind2<F, E, Kind<G, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, E, Kind<G, B>>, Kind2<F, E, Kind<G, C>>>
|
||||
readonly partition: <E, A>(
|
||||
fa: Kind2<F, E, Kind<G, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind2<F, E, Kind<G, A>>, Kind2<F, E, Kind<G, A>>>
|
||||
readonly filterMap: <E, A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (a: A) => Option<B>) => Kind2<F, E, Kind<G, B>>
|
||||
readonly filter: <E, A>(fa: Kind2<F, E, Kind<G, A>>, predicate: Predicate<A>) => Kind2<F, E, Kind<G, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition2C1<F extends URIS2, G extends URIS, E>
|
||||
extends FunctorComposition21<F, G>,
|
||||
CompactableComposition21<F, G> {
|
||||
readonly partitionMap: <A, B, C>(
|
||||
fa: Kind2<F, E, Kind<G, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, E, Kind<G, B>>, Kind2<F, E, Kind<G, C>>>
|
||||
readonly partition: <A>(
|
||||
fa: Kind2<F, E, Kind<G, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind2<F, E, Kind<G, A>>, Kind2<F, E, Kind<G, A>>>
|
||||
readonly filterMap: <A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (a: A) => Option<B>) => Kind2<F, E, Kind<G, B>>
|
||||
readonly filter: <A>(fa: Kind2<F, E, Kind<G, A>>, predicate: Predicate<A>) => Kind2<F, E, Kind<G, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition22<F extends URIS2, G extends URIS2>
|
||||
extends FunctorComposition22<F, G>,
|
||||
CompactableComposition22<F, G> {
|
||||
readonly partitionMap: <FE, GE, A, B, C>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, FE, Kind2<G, GE, B>>, Kind2<F, FE, Kind2<G, GE, C>>>
|
||||
readonly partition: <FE, GE, A>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind2<F, FE, Kind2<G, GE, A>>, Kind2<F, FE, Kind2<G, GE, A>>>
|
||||
readonly filterMap: <FE, GE, A, B>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
f: (a: A) => Option<B>
|
||||
) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
readonly filter: <FE, GE, A>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Kind2<F, FE, Kind2<G, GE, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition22C<F extends URIS2, G extends URIS2, E>
|
||||
extends FunctorComposition22<F, G>,
|
||||
CompactableComposition22<F, G> {
|
||||
readonly partitionMap: <FE, A, B, C>(
|
||||
fa: Kind2<F, FE, Kind2<G, E, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, FE, Kind2<G, E, B>>, Kind2<F, FE, Kind2<G, E, C>>>
|
||||
readonly partition: <FE, A>(
|
||||
fa: Kind2<F, FE, Kind2<G, E, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind2<F, FE, Kind2<G, E, A>>, Kind2<F, FE, Kind2<G, E, A>>>
|
||||
readonly filterMap: <FE, A, B>(
|
||||
fa: Kind2<F, FE, Kind2<G, E, A>>,
|
||||
f: (a: A) => Option<B>
|
||||
) => Kind2<F, FE, Kind2<G, E, B>>
|
||||
readonly filter: <FE, A>(fa: Kind2<F, FE, Kind2<G, E, A>>, predicate: Predicate<A>) => Kind2<F, FE, Kind2<G, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.2.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FilterableComposition23C<F extends URIS2, G extends URIS3, E>
|
||||
extends FunctorComposition23<F, G>,
|
||||
CompactableComposition23<F, G> {
|
||||
readonly partitionMap: <R, FE, A, B, C>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, E, A>>,
|
||||
f: (a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, FE, Kind3<G, R, E, B>>, Kind2<F, FE, Kind3<G, R, E, C>>>
|
||||
readonly partition: <R, FE, A>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, E, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Separated<Kind2<F, FE, Kind3<G, R, E, A>>, Kind2<F, FE, Kind3<G, R, E, A>>>
|
||||
readonly filterMap: <R, FE, A, B>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, E, A>>,
|
||||
f: (a: A) => Option<B>
|
||||
) => Kind2<F, FE, Kind3<G, R, E, B>>
|
||||
readonly filter: <R, FE, A>(
|
||||
fa: Kind2<F, FE, Kind3<G, R, E, A>>,
|
||||
predicate: Predicate<A>
|
||||
) => Kind2<F, FE, Kind3<G, R, E, A>>
|
||||
}
|
||||
/**
|
||||
* Use
|
||||
*
|
||||
* - [`filter`](#filter)
|
||||
* - [`filterMap`](#filtermap)
|
||||
* - [`partition`](#partition)
|
||||
* - [`partitionMap`](#partitionmap)
|
||||
*
|
||||
* instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getFilterableComposition<F extends URIS2, G extends URIS3, E>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable3C<G, E>
|
||||
): FilterableComposition23C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): FilterableComposition22C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS2, G extends URIS2>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable2<G>
|
||||
): FilterableComposition22<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS2, G extends URIS, E>(
|
||||
F: Functor2C<F, E>,
|
||||
G: Filterable1<G>
|
||||
): FilterableComposition2C1<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS2, G extends URIS>(
|
||||
F: Functor2<F>,
|
||||
G: Filterable1<G>
|
||||
): FilterableComposition21<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable2C<G, E>
|
||||
): FilterableComposition12C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS, G extends URIS2>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable2<G>
|
||||
): FilterableComposition12<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Filterable1<G>
|
||||
): FilterableComposition11<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFilterableComposition<F, G>(F: Functor<F>, G: Filterable<G>): FilterableComposition<F, G>
|
||||
59
node_modules/fp-ts/lib/Filterable.js
generated
vendored
Normal file
59
node_modules/fp-ts/lib/Filterable.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.filter = filter;
|
||||
exports.filterMap = filterMap;
|
||||
exports.partition = partition;
|
||||
exports.partitionMap = partitionMap;
|
||||
exports.getFilterableComposition = getFilterableComposition;
|
||||
/**
|
||||
* `Filterable` represents data structures which can be _partitioned_/_filtered_.
|
||||
*
|
||||
* Adapted from https://github.com/LiamGoodacre/purescript-filterable/blob/master/src/Data/Filterable.purs
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var Compactable_1 = require("./Compactable");
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
var Option_1 = require("./Option");
|
||||
var Predicate_1 = require("./Predicate");
|
||||
var Separated_1 = require("./Separated");
|
||||
function filter(F, G) {
|
||||
return function (predicate) { return function (fga) { return F.map(fga, function (ga) { return G.filter(ga, predicate); }); }; };
|
||||
}
|
||||
function filterMap(F, G) {
|
||||
return function (f) { return function (fga) { return F.map(fga, function (ga) { return G.filterMap(ga, f); }); }; };
|
||||
}
|
||||
function partition(F, G) {
|
||||
var _filter = filter(F, G);
|
||||
return function (predicate) {
|
||||
var left = _filter((0, Predicate_1.not)(predicate));
|
||||
var right = _filter(predicate);
|
||||
return function (fgb) { return (0, Separated_1.separated)(left(fgb), right(fgb)); };
|
||||
};
|
||||
}
|
||||
function partitionMap(F, G) {
|
||||
var _filterMap = filterMap(F, G);
|
||||
return function (f) { return function (fga) {
|
||||
return (0, Separated_1.separated)((0, function_1.pipe)(fga, _filterMap(function (a) { return (0, Option_1.getLeft)(f(a)); })), (0, function_1.pipe)(fga, _filterMap(function (a) { return (0, Option_1.getRight)(f(a)); })));
|
||||
}; };
|
||||
}
|
||||
/** @deprecated */
|
||||
function getFilterableComposition(F, G) {
|
||||
var map = (0, Functor_1.getFunctorComposition)(F, G).map;
|
||||
var _compact = (0, Compactable_1.compact)(F, G);
|
||||
var _separate = (0, Compactable_1.separate)(F, G, G);
|
||||
var _filter = filter(F, G);
|
||||
var _filterMap = filterMap(F, G);
|
||||
var _partition = partition(F, G);
|
||||
var _partitionMap = partitionMap(F, G);
|
||||
return {
|
||||
map: map,
|
||||
compact: _compact,
|
||||
separate: _separate,
|
||||
filter: function (fga, f) { return (0, function_1.pipe)(fga, _filter(f)); },
|
||||
filterMap: function (fga, f) { return (0, function_1.pipe)(fga, _filterMap(f)); },
|
||||
partition: function (fga, p) { return (0, function_1.pipe)(fga, _partition(p)); },
|
||||
partitionMap: function (fga, f) { return (0, function_1.pipe)(fga, _partitionMap(f)); }
|
||||
};
|
||||
}
|
||||
255
node_modules/fp-ts/lib/FilterableWithIndex.d.ts
generated
vendored
Normal file
255
node_modules/fp-ts/lib/FilterableWithIndex.d.ts
generated
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Either } from './Either'
|
||||
import {
|
||||
Filterable,
|
||||
Filterable1,
|
||||
Filterable2,
|
||||
Filterable2C,
|
||||
Filterable3,
|
||||
Filterable3C,
|
||||
Filterable4
|
||||
} from './Filterable'
|
||||
import {
|
||||
FunctorWithIndex,
|
||||
FunctorWithIndex1,
|
||||
FunctorWithIndex2,
|
||||
FunctorWithIndex2C,
|
||||
FunctorWithIndex3,
|
||||
FunctorWithIndex3C,
|
||||
FunctorWithIndex4
|
||||
} from './FunctorWithIndex'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Option } from './Option'
|
||||
import { Separated } from './Separated'
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type RefinementWithIndex<I, A, B extends A> = (i: I, a: A) => a is B
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type PredicateWithIndex<I, A> = (i: I, a: A) => boolean
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterWithIndex<F, I> {
|
||||
<A, B extends A>(fa: HKT<F, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): HKT<F, B>
|
||||
<A>(fa: HKT<F, A>, predicateWithIndex: PredicateWithIndex<I, A>): HKT<F, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface PartitionWithIndex<F, I> {
|
||||
<A, B extends A>(fa: HKT<F, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<HKT<F, A>, HKT<F, B>>
|
||||
<A>(fa: HKT<F, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<HKT<F, A>, HKT<F, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterableWithIndex<F, I> extends FunctorWithIndex<F, I>, Filterable<F> {
|
||||
readonly partitionMapWithIndex: <A, B, C>(
|
||||
fa: HKT<F, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<HKT<F, B>, HKT<F, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex<F, I>
|
||||
readonly filterMapWithIndex: <A, B>(fa: HKT<F, A>, f: (i: I, a: A) => Option<B>) => HKT<F, B>
|
||||
readonly filterWithIndex: FilterWithIndex<F, I>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterWithIndex1<F extends URIS, I> {
|
||||
<A, B extends A>(fa: Kind<F, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Kind<F, B>
|
||||
<A>(fa: Kind<F, A>, predicateWithIndex: PredicateWithIndex<I, A>): Kind<F, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface PartitionWithIndex1<F extends URIS, I> {
|
||||
<A, B extends A>(fa: Kind<F, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<Kind<F, A>, Kind<F, B>>
|
||||
<A>(fa: Kind<F, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<Kind<F, A>, Kind<F, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterableWithIndex1<F extends URIS, I> extends FunctorWithIndex1<F, I>, Filterable1<F> {
|
||||
readonly partitionMapWithIndex: <A, B, C>(
|
||||
fa: Kind<F, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<Kind<F, B>, Kind<F, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex1<F, I>
|
||||
readonly filterMapWithIndex: <A, B>(fa: Kind<F, A>, f: (i: I, a: A) => Option<B>) => Kind<F, B>
|
||||
readonly filterWithIndex: FilterWithIndex1<F, I>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterWithIndex2<F extends URIS2, I> {
|
||||
<E, A, B extends A>(fa: Kind2<F, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Kind2<F, E, B>
|
||||
<E, A>(fa: Kind2<F, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface PartitionWithIndex2<F extends URIS2, I> {
|
||||
<E, A, B extends A>(fa: Kind2<F, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<
|
||||
Kind2<F, E, A>,
|
||||
Kind2<F, E, B>
|
||||
>
|
||||
<E, A>(fa: Kind2<F, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<Kind2<F, E, A>, Kind2<F, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterableWithIndex2<F extends URIS2, I> extends FunctorWithIndex2<F, I>, Filterable2<F> {
|
||||
readonly partitionMapWithIndex: <E, A, B, C>(
|
||||
fa: Kind2<F, E, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex2<F, I>
|
||||
readonly filterMapWithIndex: <E, A, B>(fa: Kind2<F, E, A>, f: (i: I, a: A) => Option<B>) => Kind2<F, E, B>
|
||||
readonly filterWithIndex: FilterWithIndex2<F, I>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterWithIndex2C<F extends URIS2, I, E> {
|
||||
<A, B extends A>(fa: Kind2<F, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Kind2<F, E, B>
|
||||
<A>(fa: Kind2<F, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface PartitionWithIndex2C<F extends URIS2, I, E> {
|
||||
<A, B extends A>(fa: Kind2<F, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<
|
||||
Kind2<F, E, A>,
|
||||
Kind2<F, E, B>
|
||||
>
|
||||
<A>(fa: Kind2<F, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<Kind2<F, E, A>, Kind2<F, E, A>>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterableWithIndex2C<F extends URIS2, I, E> extends FunctorWithIndex2C<F, I, E>, Filterable2C<F, E> {
|
||||
readonly partitionMapWithIndex: <A, B, C>(
|
||||
fa: Kind2<F, E, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex2C<F, I, E>
|
||||
readonly filterMapWithIndex: <A, B>(fa: Kind2<F, E, A>, f: (i: I, a: A) => Option<B>) => Kind2<F, E, B>
|
||||
readonly filterWithIndex: FilterWithIndex2C<F, I, E>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterWithIndex3<F extends URIS3, I> {
|
||||
<R, E, A, B extends A>(fa: Kind3<F, R, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Kind3<F, R, E, B>
|
||||
<R, E, A>(fa: Kind3<F, R, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface FilterWithIndex3C<F extends URIS3, I, E> {
|
||||
<R, A, B extends A>(fa: Kind3<F, R, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Kind3<F, R, E, B>
|
||||
<R, A>(fa: Kind3<F, R, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface FilterableWithIndex3C<F extends URIS3, I, E> extends FunctorWithIndex3C<F, I, E>, Filterable3C<F, E> {
|
||||
readonly partitionMapWithIndex: <R, A, B, C>(
|
||||
fa: Kind3<F, R, E, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex3C<F, I, E>
|
||||
readonly filterMapWithIndex: <R, A, B>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => Option<B>) => Kind3<F, R, E, B>
|
||||
readonly filterWithIndex: FilterWithIndex3C<F, I, E>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface PartitionWithIndex3<F extends URIS3, I> {
|
||||
<R, E, A, B extends A>(fa: Kind3<F, R, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<
|
||||
Kind3<F, R, E, A>,
|
||||
Kind3<F, R, E, B>
|
||||
>
|
||||
<R, E, A>(fa: Kind3<F, R, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<
|
||||
Kind3<F, R, E, A>,
|
||||
Kind3<F, R, E, A>
|
||||
>
|
||||
}
|
||||
/**
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface PartitionWithIndex3C<F extends URIS3, I, E> {
|
||||
<R, A, B extends A>(fa: Kind3<F, R, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<
|
||||
Kind3<F, R, E, A>,
|
||||
Kind3<F, R, E, B>
|
||||
>
|
||||
<R, A>(fa: Kind3<F, R, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<
|
||||
Kind3<F, R, E, A>,
|
||||
Kind3<F, R, E, A>
|
||||
>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterableWithIndex3<F extends URIS3, I> extends FunctorWithIndex3<F, I>, Filterable3<F> {
|
||||
readonly partitionMapWithIndex: <R, E, A, B, C>(
|
||||
fa: Kind3<F, R, E, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex3<F, I>
|
||||
readonly filterMapWithIndex: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => Option<B>) => Kind3<F, R, E, B>
|
||||
readonly filterWithIndex: FilterWithIndex3<F, I>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterWithIndex4<F extends URIS4, I> {
|
||||
<S, R, E, A, B extends A>(fa: Kind4<F, S, R, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Kind4<
|
||||
F,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
B
|
||||
>
|
||||
<S, R, E, A>(fa: Kind4<F, S, R, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface PartitionWithIndex4<F extends URIS4, I> {
|
||||
<S, R, E, A, B extends A>(fa: Kind4<F, S, R, E, A>, refinementWithIndex: RefinementWithIndex<I, A, B>): Separated<
|
||||
Kind4<F, S, R, E, A>,
|
||||
Kind4<F, S, R, E, B>
|
||||
>
|
||||
<S, R, E, A>(fa: Kind4<F, S, R, E, A>, predicateWithIndex: PredicateWithIndex<I, A>): Separated<
|
||||
Kind4<F, S, R, E, A>,
|
||||
Kind4<F, S, R, E, A>
|
||||
>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FilterableWithIndex4<F extends URIS4, I> extends FunctorWithIndex4<F, I>, Filterable4<F> {
|
||||
readonly partitionMapWithIndex: <S, R, E, A, B, C>(
|
||||
fa: Kind4<F, S, R, E, A>,
|
||||
f: (i: I, a: A) => Either<B, C>
|
||||
) => Separated<Kind4<F, S, R, E, B>, Kind4<F, S, R, E, C>>
|
||||
readonly partitionWithIndex: PartitionWithIndex4<F, I>
|
||||
readonly filterMapWithIndex: <S, R, E, A, B>(
|
||||
fa: Kind4<F, S, R, E, A>,
|
||||
f: (i: I, a: A) => Option<B>
|
||||
) => Kind4<F, S, R, E, B>
|
||||
readonly filterWithIndex: FilterWithIndex4<F, I>
|
||||
}
|
||||
2
node_modules/fp-ts/lib/FilterableWithIndex.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/FilterableWithIndex.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
423
node_modules/fp-ts/lib/Foldable.d.ts
generated
vendored
Normal file
423
node_modules/fp-ts/lib/Foldable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,423 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Applicative, Applicative1, Applicative2, Applicative2C, Applicative3 } from './Applicative'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Monad, Monad1, Monad2, Monad2C, Monad3, Monad3C } from './Monad'
|
||||
import { Monoid } from './Monoid'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Foldable<F> {
|
||||
readonly URI: F
|
||||
readonly reduce: <A, B>(fa: HKT<F, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: HKT<F, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: HKT<F, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Foldable1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly reduce: <A, B>(fa: Kind<F, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: Kind<F, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: Kind<F, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Foldable2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly reduce: <E, A, B>(fa: Kind2<F, E, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <E, A>(fa: Kind2<F, E, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <E, A, B>(fa: Kind2<F, E, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Foldable2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly reduce: <A, B>(fa: Kind2<F, E, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: Kind2<F, E, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: Kind2<F, E, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Foldable3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly reduce: <R, E, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <R, E, A>(fa: Kind3<F, R, E, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <R, E, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Foldable3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly reduce: <R, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <R, A>(fa: Kind3<F, R, E, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <R, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Foldable4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly reduce: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <S, R, E, A>(fa: Kind4<F, S, R, E, A>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* `reduce` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function reduce<F extends URIS, G extends URIS>(
|
||||
F: Foldable1<F>,
|
||||
G: Foldable1<G>
|
||||
): <B, A>(b: B, f: (b: B, a: A) => B) => (fga: Kind<F, Kind<G, A>>) => B
|
||||
export declare function reduce<F, G>(
|
||||
F: Foldable<F>,
|
||||
G: Foldable<G>
|
||||
): <B, A>(b: B, f: (b: B, a: A) => B) => (fga: HKT<F, HKT<G, A>>) => B
|
||||
/**
|
||||
* `foldMap` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function foldMap<F extends URIS, G extends URIS>(
|
||||
F: Foldable1<F>,
|
||||
G: Foldable1<G>
|
||||
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fga: Kind<F, Kind<G, A>>) => M
|
||||
export declare function foldMap<F, G>(
|
||||
F: Foldable<F>,
|
||||
G: Foldable<G>
|
||||
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fga: HKT<F, HKT<G, A>>) => M
|
||||
/**
|
||||
* `reduceRight` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function reduceRight<F extends URIS, G extends URIS>(
|
||||
F: Foldable1<F>,
|
||||
G: Foldable1<G>
|
||||
): <B, A>(b: B, f: (a: A, b: B) => B) => (fga: Kind<F, Kind<G, A>>) => B
|
||||
export declare function reduceRight<F, G>(
|
||||
F: Foldable<F>,
|
||||
G: Foldable<G>
|
||||
): <B, A>(b: B, f: (a: A, b: B) => B) => (fga: HKT<F, HKT<G, A>>) => B
|
||||
/**
|
||||
* Similar to 'reduce', but the result is encapsulated in a monad.
|
||||
*
|
||||
* Note: this function is not generally stack-safe, e.g., for monads which build up thunks a la `IO`.
|
||||
*
|
||||
* @example
|
||||
* import { reduceM } from 'fp-ts/Foldable'
|
||||
* import { Monad, some } from 'fp-ts/Option'
|
||||
* import { make, Foldable } from 'fp-ts/Tree'
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
*
|
||||
* const t = make(1, [make(2, []), make(3, []), make(4, [])])
|
||||
* assert.deepStrictEqual(pipe(t, reduceM(Monad, Foldable)(0, (b, a) => (a > 2 ? some(b + a) : some(b)))), some(7))
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare function reduceM<M extends URIS3, F extends URIS>(
|
||||
M: Monad3<M>,
|
||||
F: Foldable1<F>
|
||||
): <B, A, R, E>(b: B, f: (b: B, a: A) => Kind3<M, R, E, B>) => (fa: Kind<F, A>) => Kind3<M, R, E, B>
|
||||
export declare function reduceM<M extends URIS3, F extends URIS, E>(
|
||||
M: Monad3C<M, E>,
|
||||
F: Foldable1<F>
|
||||
): <B, A, R>(b: B, f: (b: B, a: A) => Kind3<M, R, E, B>) => (fa: Kind<F, A>) => Kind3<M, R, E, B>
|
||||
export declare function reduceM<M extends URIS2, F extends URIS>(
|
||||
M: Monad2<M>,
|
||||
F: Foldable1<F>
|
||||
): <B, A, E>(b: B, f: (b: B, a: A) => Kind2<M, E, B>) => (fa: Kind<F, A>) => Kind2<M, E, B>
|
||||
export declare function reduceM<M extends URIS2, F extends URIS, E>(
|
||||
M: Monad2C<M, E>,
|
||||
F: Foldable1<F>
|
||||
): <B, A>(b: B, f: (b: B, a: A) => Kind2<M, E, B>) => (fa: Kind<F, A>) => Kind2<M, E, B>
|
||||
export declare function reduceM<M extends URIS, F extends URIS>(
|
||||
M: Monad1<M>,
|
||||
F: Foldable1<F>
|
||||
): <B, A>(b: B, f: (b: B, a: A) => Kind<M, B>) => (fa: Kind<F, A>) => Kind<M, B>
|
||||
export declare function reduceM<M, F>(
|
||||
M: Monad<M>,
|
||||
F: Foldable<F>
|
||||
): <B, A>(b: B, f: (b: B, a: A) => HKT<M, B>) => (fa: HKT<F, A>) => HKT<M, B>
|
||||
/**
|
||||
* Fold a data structure, accumulating values in some `Monoid`, combining adjacent elements using the specified separator
|
||||
*
|
||||
* @example
|
||||
* import { intercalate } from 'fp-ts/Foldable'
|
||||
* import * as S from 'fp-ts/string'
|
||||
* import { make, Foldable } from 'fp-ts/Tree'
|
||||
*
|
||||
* const t = make('a', [make('b', []), make('c', []), make('d', [])])
|
||||
* assert.strictEqual(intercalate(S.Monoid, Foldable)('|', t), 'a|b|c|d')
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function intercalate<M, F extends URIS3>(
|
||||
M: Monoid<M>,
|
||||
F: Foldable3<F>
|
||||
): <R, E>(middle: M, fm: Kind3<F, R, E, M>) => M
|
||||
export declare function intercalate<M, F extends URIS2>(
|
||||
M: Monoid<M>,
|
||||
F: Foldable2<F>
|
||||
): <E>(middle: M, fm: Kind2<F, E, M>) => M
|
||||
export declare function intercalate<M, F extends URIS2, E>(
|
||||
M: Monoid<M>,
|
||||
F: Foldable2C<F, E>
|
||||
): (middle: M, fm: Kind2<F, E, M>) => M
|
||||
export declare function intercalate<M, F extends URIS>(M: Monoid<M>, F: Foldable1<F>): (middle: M, fm: Kind<F, M>) => M
|
||||
export declare function intercalate<M, F>(M: Monoid<M>, F: Foldable<F>): (middle: M, fm: HKT<F, M>) => M
|
||||
/**
|
||||
* Transforms a `Foldable` into a `toReadonlyArray`.
|
||||
*
|
||||
* @example
|
||||
* import { toReadonlyArray } from 'fp-ts/Foldable'
|
||||
* import { Foldable, make } from 'fp-ts/Tree'
|
||||
*
|
||||
* const t = make(1, [make(2, []), make(3, []), make(4, [])])
|
||||
* assert.deepStrictEqual(toReadonlyArray(Foldable)(t), [1, 2, 3, 4])
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function toReadonlyArray<F extends URIS4>(
|
||||
F: Foldable4<F>
|
||||
): <S, R, E, A>(fa: Kind4<F, S, R, E, A>) => ReadonlyArray<A>
|
||||
export declare function toReadonlyArray<F extends URIS3>(
|
||||
F: Foldable3<F>
|
||||
): <R, E, A>(fa: Kind3<F, R, E, A>) => ReadonlyArray<A>
|
||||
export declare function toReadonlyArray<F extends URIS3, E>(
|
||||
F: Foldable3C<F, E>
|
||||
): <R, A>(fa: Kind3<F, R, E, A>) => ReadonlyArray<A>
|
||||
export declare function toReadonlyArray<F extends URIS2>(
|
||||
F: Foldable2<F>
|
||||
): <E, A>(fa: Kind2<F, E, A>) => ReadonlyArray<A>
|
||||
export declare function toReadonlyArray<F extends URIS2, E>(
|
||||
F: Foldable2C<F, E>
|
||||
): <A>(fa: Kind2<F, E, A>) => ReadonlyArray<A>
|
||||
export declare function toReadonlyArray<F extends URIS>(F: Foldable1<F>): <A>(fa: Kind<F, A>) => ReadonlyArray<A>
|
||||
export declare function toReadonlyArray<F>(F: Foldable<F>): <A>(fa: HKT<F, A>) => ReadonlyArray<A>
|
||||
/**
|
||||
* Traverse a data structure, performing some effects encoded by an `Applicative` functor at each value, ignoring the
|
||||
* final result.
|
||||
*
|
||||
* @example
|
||||
* import { Foldable } from 'fp-ts/Array'
|
||||
* import { traverse_ } from 'fp-ts/Foldable'
|
||||
* import { Applicative } from 'fp-ts/IO'
|
||||
*
|
||||
* let log = ''
|
||||
* const append = (s: string) => () => (log += s)
|
||||
* traverse_(Applicative, Foldable)(['a', 'b', 'c'], append)()
|
||||
* assert.strictEqual(log, 'abc')
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function traverse_<M extends URIS3, F extends URIS>(
|
||||
M: Applicative3<M>,
|
||||
F: Foldable1<F>
|
||||
): <R, E, A, B>(fa: Kind<F, A>, f: (a: A) => Kind3<M, R, E, B>) => Kind3<M, R, E, void>
|
||||
export declare function traverse_<M extends URIS2, F extends URIS>(
|
||||
M: Applicative2<M>,
|
||||
F: Foldable1<F>
|
||||
): <E, A, B>(fa: Kind<F, A>, f: (a: A) => Kind2<M, E, B>) => Kind2<M, E, void>
|
||||
export declare function traverse_<M extends URIS2, F extends URIS, E>(
|
||||
M: Applicative2C<M, E>,
|
||||
F: Foldable1<F>
|
||||
): <A, B>(fa: Kind<F, A>, f: (a: A) => Kind2<M, E, B>) => Kind2<M, E, void>
|
||||
export declare function traverse_<M extends URIS, F extends URIS>(
|
||||
M: Applicative1<M>,
|
||||
F: Foldable1<F>
|
||||
): <A, B>(fa: Kind<F, A>, f: (a: A) => Kind<M, B>) => Kind<M, void>
|
||||
export declare function traverse_<M, F>(
|
||||
M: Applicative<M>,
|
||||
F: Foldable<F>
|
||||
): <A, B>(fa: HKT<F, A>, f: (a: A) => HKT<M, B>) => HKT<M, void>
|
||||
/**
|
||||
* Use [`reduceM`](#reducem) instead
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function foldM<M extends URIS3, F extends URIS>(
|
||||
M: Monad3<M>,
|
||||
F: Foldable1<F>
|
||||
): <R, E, A, B>(fa: Kind<F, A>, b: B, f: (b: B, a: A) => Kind3<M, R, E, B>) => Kind3<M, R, E, B>
|
||||
/** @deprecated */
|
||||
export declare function foldM<M extends URIS3, F extends URIS, E>(
|
||||
M: Monad3C<M, E>,
|
||||
F: Foldable1<F>
|
||||
): <R, A, B>(fa: Kind<F, A>, b: B, f: (b: B, a: A) => Kind3<M, R, E, B>) => Kind3<M, R, E, B>
|
||||
/** @deprecated */
|
||||
export declare function foldM<M extends URIS2, F extends URIS>(
|
||||
M: Monad2<M>,
|
||||
F: Foldable1<F>
|
||||
): <E, A, B>(fa: Kind<F, A>, b: B, f: (b: B, a: A) => Kind2<M, E, B>) => Kind2<M, E, B>
|
||||
/** @deprecated */
|
||||
export declare function foldM<M extends URIS2, F extends URIS, E>(
|
||||
M: Monad2C<M, E>,
|
||||
F: Foldable1<F>
|
||||
): <A, B>(fa: Kind<F, A>, b: B, f: (b: B, a: A) => Kind2<M, E, B>) => Kind2<M, E, B>
|
||||
/** @deprecated */
|
||||
export declare function foldM<M extends URIS, F extends URIS>(
|
||||
M: Monad1<M>,
|
||||
F: Foldable1<F>
|
||||
): <A, B>(fa: Kind<F, A>, b: B, f: (b: B, a: A) => Kind<M, B>) => Kind<M, B>
|
||||
/** @deprecated */
|
||||
export declare function foldM<M, F>(
|
||||
M: Monad<M>,
|
||||
F: Foldable<F>
|
||||
): <A, B>(fa: HKT<F, A>, b: B, f: (b: B, a: A) => HKT<M, B>) => HKT<M, B>
|
||||
/**
|
||||
* Use [`toReadonlyArray`](#toreadonlyarray) instead
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.8.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const toArray: typeof toReadonlyArray
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition<F, G> {
|
||||
readonly reduce: <A, B>(fga: HKT<F, HKT<G, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: HKT<F, HKT<G, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: HKT<F, HKT<G, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition11<F extends URIS, G extends URIS> {
|
||||
readonly reduce: <A, B>(fga: Kind<F, Kind<G, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: Kind<F, Kind<G, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: Kind<F, Kind<G, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition12<F extends URIS, G extends URIS2> {
|
||||
readonly reduce: <E, A, B>(fga: Kind<F, Kind2<G, E, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <E, A>(fa: Kind<F, Kind2<G, E, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <E, A, B>(fa: Kind<F, Kind2<G, E, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition12C<F extends URIS, G extends URIS2, E> {
|
||||
readonly reduce: <A, B>(fga: Kind<F, Kind2<G, E, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: Kind<F, Kind2<G, E, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: Kind<F, Kind2<G, E, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition21<F extends URIS2, G extends URIS> {
|
||||
readonly reduce: <E, A, B>(fga: Kind2<F, E, Kind<G, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <E, A>(fa: Kind2<F, E, Kind<G, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <E, A, B>(fa: Kind2<F, E, Kind<G, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition2C1<F extends URIS2, G extends URIS, E> {
|
||||
readonly reduce: <A, B>(fga: Kind2<F, E, Kind<G, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <A>(fa: Kind2<F, E, Kind<G, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <A, B>(fa: Kind2<F, E, Kind<G, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition22<F extends URIS2, G extends URIS2> {
|
||||
readonly reduce: <FE, GE, A, B>(fga: Kind2<F, FE, Kind2<G, GE, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <FE, GE, A>(fa: Kind2<F, FE, Kind2<G, GE, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <FE, GE, A, B>(fa: Kind2<F, FE, Kind2<G, GE, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableComposition22C<F extends URIS2, G extends URIS2, E> {
|
||||
readonly reduce: <FE, A, B>(fga: Kind2<F, FE, Kind2<G, E, A>>, b: B, f: (b: B, a: A) => B) => B
|
||||
readonly foldMap: <M>(M: Monoid<M>) => <FE, A>(fa: Kind2<F, FE, Kind2<G, E, A>>, f: (a: A) => M) => M
|
||||
readonly reduceRight: <FE, A, B>(fa: Kind2<F, FE, Kind2<G, E, A>>, b: B, f: (a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* Use
|
||||
*
|
||||
* - [reduce](#reduce)
|
||||
* - [foldMap](#foldmap)
|
||||
* - [reduceRight](#reduceright)
|
||||
*
|
||||
* instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getFoldableComposition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Foldable2<F>,
|
||||
G: Foldable2C<G, E>
|
||||
): FoldableComposition22C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F extends URIS2, G extends URIS2>(
|
||||
F: Foldable2<F>,
|
||||
G: Foldable2<G>
|
||||
): FoldableComposition22<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F extends URIS2, G extends URIS, E>(
|
||||
F: Foldable2C<F, E>,
|
||||
G: Foldable1<G>
|
||||
): FoldableComposition2C1<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F extends URIS2, G extends URIS>(
|
||||
F: Foldable2<F>,
|
||||
G: Foldable1<G>
|
||||
): FoldableComposition21<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F extends URIS, G extends URIS2, E>(
|
||||
F: Foldable1<F>,
|
||||
G: Foldable2C<G, E>
|
||||
): FoldableComposition12C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F extends URIS, G extends URIS2>(
|
||||
F: Foldable1<F>,
|
||||
G: Foldable2<G>
|
||||
): FoldableComposition12<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F extends URIS, G extends URIS>(
|
||||
F: Foldable1<F>,
|
||||
G: Foldable1<G>
|
||||
): FoldableComposition11<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableComposition<F, G>(F: Foldable<F>, G: Foldable<G>): FoldableComposition<F, G>
|
||||
76
node_modules/fp-ts/lib/Foldable.js
generated
vendored
Normal file
76
node_modules/fp-ts/lib/Foldable.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toArray = void 0;
|
||||
exports.reduce = reduce;
|
||||
exports.foldMap = foldMap;
|
||||
exports.reduceRight = reduceRight;
|
||||
exports.reduceM = reduceM;
|
||||
exports.intercalate = intercalate;
|
||||
exports.toReadonlyArray = toReadonlyArray;
|
||||
exports.traverse_ = traverse_;
|
||||
exports.foldM = foldM;
|
||||
exports.getFoldableComposition = getFoldableComposition;
|
||||
var function_1 = require("./function");
|
||||
function reduce(F, G) {
|
||||
return function (b, f) { return function (fga) { return F.reduce(fga, b, function (b, ga) { return G.reduce(ga, b, f); }); }; };
|
||||
}
|
||||
function foldMap(F, G) {
|
||||
return function (M) {
|
||||
var foldMapF = F.foldMap(M);
|
||||
var foldMapG = G.foldMap(M);
|
||||
return function (f) { return function (fga) { return foldMapF(fga, function (ga) { return foldMapG(ga, f); }); }; };
|
||||
};
|
||||
}
|
||||
function reduceRight(F, G) {
|
||||
return function (b, f) { return function (fga) { return F.reduceRight(fga, b, function (ga, b) { return G.reduceRight(ga, b, f); }); }; };
|
||||
}
|
||||
function reduceM(M, F) {
|
||||
return function (b, f) { return function (fa) { return F.reduce(fa, M.of(b), function (mb, a) { return M.chain(mb, function (b) { return f(b, a); }); }); }; };
|
||||
}
|
||||
function intercalate(M, F) {
|
||||
return function (middle, fm) {
|
||||
var go = function (_a, x) {
|
||||
var init = _a.init, acc = _a.acc;
|
||||
return init ? { init: false, acc: x } : { init: false, acc: M.concat(M.concat(acc, middle), x) };
|
||||
};
|
||||
return F.reduce(fm, { init: true, acc: M.empty }, go).acc;
|
||||
};
|
||||
}
|
||||
function toReadonlyArray(F) {
|
||||
return function (fa) {
|
||||
return F.reduce(fa, [], function (acc, a) {
|
||||
acc.push(a);
|
||||
return acc;
|
||||
});
|
||||
};
|
||||
}
|
||||
function traverse_(M, F) {
|
||||
var applyFirst = function (mu, mb) { return M.ap(M.map(mu, function_1.constant), mb); };
|
||||
var mu = M.of(undefined);
|
||||
return function (fa, f) { return F.reduce(fa, mu, function (mu, a) { return applyFirst(mu, f(a)); }); };
|
||||
}
|
||||
function foldM(M, F) {
|
||||
return function (fa, b, f) { return F.reduce(fa, M.of(b), function (mb, a) { return M.chain(mb, function (b) { return f(b, a); }); }); };
|
||||
}
|
||||
/**
|
||||
* Use [`toReadonlyArray`](#toreadonlyarray) instead
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.8.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.toArray = toReadonlyArray;
|
||||
/** @deprecated */
|
||||
function getFoldableComposition(F, G) {
|
||||
var _reduce = reduce(F, G);
|
||||
var _foldMap = foldMap(F, G);
|
||||
var _reduceRight = reduceRight(F, G);
|
||||
return {
|
||||
reduce: function (fga, b, f) { return (0, function_1.pipe)(fga, _reduce(b, f)); },
|
||||
foldMap: function (M) {
|
||||
var foldMapM = _foldMap(M);
|
||||
return function (fga, f) { return (0, function_1.pipe)(fga, foldMapM(f)); };
|
||||
},
|
||||
reduceRight: function (fga, b, f) { return (0, function_1.pipe)(fga, _reduceRight(b, f)); }
|
||||
};
|
||||
}
|
||||
290
node_modules/fp-ts/lib/FoldableWithIndex.d.ts
generated
vendored
Normal file
290
node_modules/fp-ts/lib/FoldableWithIndex.d.ts
generated
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
* A `Foldable` with an additional index.
|
||||
* A `FoldableWithIndex` instance must be compatible with its `Foldable` instance
|
||||
*
|
||||
* ```ts
|
||||
* reduce(fa, b, f) = reduceWithIndex(fa, b, (_, b, a) => f(b, a))
|
||||
* foldMap(M)(fa, f) = foldMapWithIndex(M)(fa, (_, a) => f(a))
|
||||
* reduceRight(fa, b, f) = reduceRightWithIndex(fa, b, (_, a, b) => f(a, b))
|
||||
* ```
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import {
|
||||
Foldable,
|
||||
Foldable1,
|
||||
Foldable2,
|
||||
Foldable2C,
|
||||
Foldable3,
|
||||
Foldable3C,
|
||||
Foldable4,
|
||||
FoldableComposition,
|
||||
FoldableComposition2C1,
|
||||
FoldableComposition11,
|
||||
FoldableComposition12,
|
||||
FoldableComposition12C,
|
||||
FoldableComposition21,
|
||||
FoldableComposition22,
|
||||
FoldableComposition22C
|
||||
} from './Foldable'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Monoid } from './Monoid'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FoldableWithIndex<F, I> extends Foldable<F> {
|
||||
readonly reduceWithIndex: <A, B>(fa: HKT<F, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fa: HKT<F, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fa: HKT<F, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FoldableWithIndex1<F extends URIS, I> extends Foldable1<F> {
|
||||
readonly reduceWithIndex: <A, B>(fa: Kind<F, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fa: Kind<F, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fa: Kind<F, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FoldableWithIndex2<F extends URIS2, I> extends Foldable2<F> {
|
||||
readonly reduceWithIndex: <E, A, B>(fa: Kind2<F, E, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <E, A>(fa: Kind2<F, E, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <E, A, B>(fa: Kind2<F, E, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FoldableWithIndex2C<F extends URIS2, I, E> extends Foldable2C<F, E> {
|
||||
readonly reduceWithIndex: <A, B>(fa: Kind2<F, E, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fa: Kind2<F, E, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fa: Kind2<F, E, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FoldableWithIndex3<F extends URIS3, I> extends Foldable3<F> {
|
||||
readonly reduceWithIndex: <R, E, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <R, E, A>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <R, E, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface FoldableWithIndex3C<F extends URIS3, I, E> extends Foldable3C<F, E> {
|
||||
readonly reduceWithIndex: <R, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <R, A>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <R, A, B>(fa: Kind3<F, R, E, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FoldableWithIndex4<F extends URIS4, I> extends Foldable4<F> {
|
||||
readonly reduceWithIndex: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, b: B, f: (i: I, b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <S, R, E, A>(fa: Kind4<F, S, R, E, A>, f: (i: I, a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, b: B, f: (i: I, a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* `reduceWithIndex` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function reduceWithIndex<F extends URIS, I, G extends URIS, J>(
|
||||
F: FoldableWithIndex1<F, I>,
|
||||
G: FoldableWithIndex1<G, J>
|
||||
): <B, A>(b: B, f: (ij: readonly [I, J], b: B, a: A) => B) => (fga: Kind<F, Kind<G, A>>) => B
|
||||
export declare function reduceWithIndex<F, I, G, J>(
|
||||
F: FoldableWithIndex<F, I>,
|
||||
G: FoldableWithIndex<G, J>
|
||||
): <B, A>(b: B, f: (ij: readonly [I, J], b: B, a: A) => B) => (fga: HKT<F, HKT<G, A>>) => B
|
||||
/**
|
||||
* `foldMapWithIndex` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function foldMapWithIndex<F extends URIS, I, G extends URIS, J>(
|
||||
F: FoldableWithIndex1<F, I>,
|
||||
G: FoldableWithIndex1<G, J>
|
||||
): <M>(M: Monoid<M>) => <A>(f: (ij: readonly [I, J], a: A) => M) => (fga: Kind<F, Kind<G, A>>) => M
|
||||
export declare function foldMapWithIndex<F, I, G, J>(
|
||||
F: FoldableWithIndex<F, I>,
|
||||
G: FoldableWithIndex<G, J>
|
||||
): <M>(M: Monoid<M>) => <A>(f: (ij: readonly [I, J], a: A) => M) => (fga: HKT<F, HKT<G, A>>) => M
|
||||
/**
|
||||
* `reduceRightWithIndex` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function reduceRightWithIndex<F extends URIS, I, G extends URIS, J>(
|
||||
F: FoldableWithIndex1<F, I>,
|
||||
G: FoldableWithIndex1<G, J>
|
||||
): <B, A>(b: B, f: (ij: readonly [I, J], a: A, b: B) => B) => (fga: Kind<F, Kind<G, A>>) => B
|
||||
export declare function reduceRightWithIndex<F, I, G, J>(
|
||||
F: FoldableWithIndex<F, I>,
|
||||
G: FoldableWithIndex<G, J>
|
||||
): <B, A>(b: B, f: (ij: readonly [I, J], a: A, b: B) => B) => (fga: HKT<F, HKT<G, A>>) => B
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition<F, FI, G, GI> extends FoldableComposition<F, G> {
|
||||
readonly reduceWithIndex: <A, B>(fga: HKT<F, HKT<G, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fga: HKT<F, HKT<G, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fga: HKT<F, HKT<G, A>>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition11<F extends URIS, FI, G extends URIS, GI>
|
||||
extends FoldableComposition11<F, G> {
|
||||
readonly reduceWithIndex: <A, B>(fga: Kind<F, Kind<G, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fga: Kind<F, Kind<G, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fga: Kind<F, Kind<G, A>>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition12<F extends URIS, FI, G extends URIS2, GI>
|
||||
extends FoldableComposition12<F, G> {
|
||||
readonly reduceWithIndex: <E, A, B>(fga: Kind<F, Kind2<G, E, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <E, A>(fga: Kind<F, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <E, A, B>(fga: Kind<F, Kind2<G, E, A>>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition12C<F extends URIS, FI, G extends URIS2, GI, E>
|
||||
extends FoldableComposition12C<F, G, E> {
|
||||
readonly reduceWithIndex: <A, B>(fga: Kind<F, Kind2<G, E, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fga: Kind<F, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fga: Kind<F, Kind2<G, E, A>>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition21<F extends URIS2, FI, G extends URIS, GI>
|
||||
extends FoldableComposition21<F, G> {
|
||||
readonly reduceWithIndex: <FE, A, B>(fga: Kind2<F, FE, Kind<G, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(
|
||||
M: Monoid<M>
|
||||
) => <FE, A>(fga: Kind2<F, FE, Kind<G, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <FE, A, B>(fga: Kind2<F, FE, Kind<G, A>>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition2C1<F extends URIS2, FI, G extends URIS, GI, FE>
|
||||
extends FoldableComposition2C1<F, G, FE> {
|
||||
readonly reduceWithIndex: <A, B>(fga: Kind2<F, FE, Kind<G, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(M: Monoid<M>) => <A>(fga: Kind2<F, FE, Kind<G, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <A, B>(fga: Kind2<F, FE, Kind<G, A>>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition22<F extends URIS2, FI, G extends URIS2, GI>
|
||||
extends FoldableComposition22<F, G> {
|
||||
readonly reduceWithIndex: <FE, GE, A, B>(
|
||||
fga: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
b: B,
|
||||
f: (i: [FI, GI], b: B, a: A) => B
|
||||
) => B
|
||||
readonly foldMapWithIndex: <M>(
|
||||
M: Monoid<M>
|
||||
) => <FE, GE, A>(fga: Kind2<F, FE, Kind2<G, GE, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <FE, GE, A, B>(
|
||||
fga: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
b: B,
|
||||
f: (i: [FI, GI], a: A, b: B) => B
|
||||
) => B
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FoldableWithIndexComposition22C<F extends URIS2, FI, G extends URIS2, GI, E>
|
||||
extends FoldableComposition22C<F, G, E> {
|
||||
readonly reduceWithIndex: <FE, A, B>(fga: Kind2<F, FE, Kind2<G, E, A>>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B
|
||||
readonly foldMapWithIndex: <M>(
|
||||
M: Monoid<M>
|
||||
) => <FE, A>(fga: Kind2<F, FE, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => M) => M
|
||||
readonly reduceRightWithIndex: <FE, A, B>(
|
||||
fga: Kind2<F, FE, Kind2<G, E, A>>,
|
||||
b: B,
|
||||
f: (i: [FI, GI], a: A, b: B) => B
|
||||
) => B
|
||||
}
|
||||
/**
|
||||
* Use
|
||||
*
|
||||
* - [reduceWithIndex](#reducewithindex)
|
||||
* - [foldMapWithIndex](#foldmapwithindex)
|
||||
* - [reduceRightWithIndex](#reducerightwithindex)
|
||||
*
|
||||
* instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS2, FI, G extends URIS2, GI, E>(
|
||||
F: FoldableWithIndex2<F, FI>,
|
||||
G: FoldableWithIndex2C<G, GI, E>
|
||||
): FoldableWithIndexComposition22C<F, FI, G, GI, E>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS2, FI, G extends URIS2, GI>(
|
||||
F: FoldableWithIndex2<F, FI>,
|
||||
G: FoldableWithIndex2<G, GI>
|
||||
): FoldableWithIndexComposition22<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS2, FI, G extends URIS, GI, E>(
|
||||
F: FoldableWithIndex2C<F, FI, E>,
|
||||
G: FoldableWithIndex1<G, GI>
|
||||
): FoldableWithIndexComposition2C1<F, FI, G, GI, E>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS2, FI, G extends URIS, GI>(
|
||||
F: FoldableWithIndex2<F, FI>,
|
||||
G: FoldableWithIndex1<G, GI>
|
||||
): FoldableWithIndexComposition21<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS, FI, G extends URIS2, GI>(
|
||||
F: FoldableWithIndex1<F, FI>,
|
||||
G: FoldableWithIndex2<G, GI>
|
||||
): FoldableWithIndexComposition12<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS, FI, G extends URIS2, GI>(
|
||||
F: FoldableWithIndex1<F, FI>,
|
||||
G: FoldableWithIndex2<G, GI>
|
||||
): FoldableWithIndexComposition12<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F extends URIS, FI, G extends URIS, GI>(
|
||||
F: FoldableWithIndex1<F, FI>,
|
||||
G: FoldableWithIndex1<G, GI>
|
||||
): FoldableWithIndexComposition11<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFoldableWithIndexComposition<F, FI, G, GI>(
|
||||
F: FoldableWithIndex<F, FI>,
|
||||
G: FoldableWithIndex<G, GI>
|
||||
): FoldableWithIndexComposition<F, FI, G, GI>
|
||||
55
node_modules/fp-ts/lib/FoldableWithIndex.js
generated
vendored
Normal file
55
node_modules/fp-ts/lib/FoldableWithIndex.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.reduceWithIndex = reduceWithIndex;
|
||||
exports.foldMapWithIndex = foldMapWithIndex;
|
||||
exports.reduceRightWithIndex = reduceRightWithIndex;
|
||||
exports.getFoldableWithIndexComposition = getFoldableWithIndexComposition;
|
||||
/**
|
||||
* A `Foldable` with an additional index.
|
||||
* A `FoldableWithIndex` instance must be compatible with its `Foldable` instance
|
||||
*
|
||||
* ```ts
|
||||
* reduce(fa, b, f) = reduceWithIndex(fa, b, (_, b, a) => f(b, a))
|
||||
* foldMap(M)(fa, f) = foldMapWithIndex(M)(fa, (_, a) => f(a))
|
||||
* reduceRight(fa, b, f) = reduceRightWithIndex(fa, b, (_, a, b) => f(a, b))
|
||||
* ```
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var Foldable_1 = require("./Foldable");
|
||||
var function_1 = require("./function");
|
||||
function reduceWithIndex(F, G) {
|
||||
return function (b, f) { return function (fga) {
|
||||
return F.reduceWithIndex(fga, b, function (i, b, ga) { return G.reduceWithIndex(ga, b, function (j, b, a) { return f([i, j], b, a); }); });
|
||||
}; };
|
||||
}
|
||||
function foldMapWithIndex(F, G) {
|
||||
return function (M) {
|
||||
var foldMapWithIndexF = F.foldMapWithIndex(M);
|
||||
var foldMapWithIndexG = G.foldMapWithIndex(M);
|
||||
return function (f) { return function (fga) { return foldMapWithIndexF(fga, function (i, ga) { return foldMapWithIndexG(ga, function (j, a) { return f([i, j], a); }); }); }; };
|
||||
};
|
||||
}
|
||||
function reduceRightWithIndex(F, G) {
|
||||
return function (b, f) { return function (fga) {
|
||||
return F.reduceRightWithIndex(fga, b, function (i, ga, b) { return G.reduceRightWithIndex(ga, b, function (j, a, b) { return f([i, j], a, b); }); });
|
||||
}; };
|
||||
}
|
||||
/** @deprecated */
|
||||
function getFoldableWithIndexComposition(F, G) {
|
||||
var FC = (0, Foldable_1.getFoldableComposition)(F, G);
|
||||
var _reduceWithIndex = reduceWithIndex(F, G);
|
||||
var _foldMapWithIndex = foldMapWithIndex(F, G);
|
||||
var _reduceRightWithIndex = reduceRightWithIndex(F, G);
|
||||
return {
|
||||
reduce: FC.reduce,
|
||||
foldMap: FC.foldMap,
|
||||
reduceRight: FC.reduceRight,
|
||||
reduceWithIndex: function (fga, b, f) { return (0, function_1.pipe)(fga, _reduceWithIndex(b, f)); },
|
||||
foldMapWithIndex: function (M) {
|
||||
var foldMapWithIndexM = _foldMapWithIndex(M);
|
||||
return function (fga, f) { return (0, function_1.pipe)(fga, foldMapWithIndexM(f)); };
|
||||
},
|
||||
reduceRightWithIndex: function (fga, b, f) { return (0, function_1.pipe)(fga, _reduceRightWithIndex(b, f)); }
|
||||
};
|
||||
}
|
||||
337
node_modules/fp-ts/lib/FromEither.d.ts
generated
vendored
Normal file
337
node_modules/fp-ts/lib/FromEither.d.ts
generated
vendored
Normal file
@@ -0,0 +1,337 @@
|
||||
/**
|
||||
* The `FromEither` type class represents those data types which support errors.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C, Chain4 } from './Chain'
|
||||
import { Either } from './Either'
|
||||
import { LazyArg } from './function'
|
||||
import { HKT2, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Option } from './Option'
|
||||
import { Predicate } from './Predicate'
|
||||
import { Refinement } from './Refinement'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromEither<F> {
|
||||
readonly URI: F
|
||||
readonly fromEither: <E, A>(e: Either<E, A>) => HKT2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromEither1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly fromEither: <A>(fa: Either<unknown, A>) => Kind<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromEither2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly fromEither: <E, A>(fa: Either<E, A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromEither2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromEither: <A>(fa: Either<E, A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromEither3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly fromEither: <E, A, R>(fa: Either<E, A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromEither3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromEither: <A, R>(fa: Either<E, A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromEither4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly fromEither: <E, A, S, R>(fa: Either<E, A>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fromOption<F extends URIS4>(
|
||||
F: FromEither4<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A, S, R>(fa: Option<A>) => Kind4<F, S, R, E, A>
|
||||
export declare function fromOption<F extends URIS3>(
|
||||
F: FromEither3<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A, R>(fa: Option<A>) => Kind3<F, R, E, A>
|
||||
export declare function fromOption<F extends URIS3, E>(
|
||||
F: FromEither3C<F, E>
|
||||
): (onNone: LazyArg<E>) => <A, R>(fa: Option<A>) => Kind3<F, R, E, A>
|
||||
export declare function fromOption<F extends URIS2>(
|
||||
F: FromEither2<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A>(fa: Option<A>) => Kind2<F, E, A>
|
||||
export declare function fromOption<F extends URIS2, E>(
|
||||
F: FromEither2C<F, E>
|
||||
): (onNone: LazyArg<E>) => <A>(fa: Option<A>) => Kind2<F, E, A>
|
||||
export declare function fromOption<F>(F: FromEither<F>): <E>(onNone: LazyArg<E>) => <A>(ma: Option<A>) => HKT2<F, E, A>
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fromPredicate<F extends URIS4>(
|
||||
F: FromEither4<F>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <S, R>(a: A) => Kind4<F, S, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <S, R, B extends A>(b: B) => Kind4<F, S, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <S, R>(a: A) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
export declare function fromPredicate<F extends URIS3>(
|
||||
F: FromEither3<F>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(a: A) => Kind3<F, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(b: B) => Kind3<F, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(a: A) => Kind3<F, R, E, A>
|
||||
}
|
||||
export declare function fromPredicate<F extends URIS3, E>(
|
||||
F: FromEither3C<F, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(a: A) => Kind3<F, R, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(b: B) => Kind3<F, R, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(a: A) => Kind3<F, R, E, A>
|
||||
}
|
||||
export declare function fromPredicate<F extends URIS2>(
|
||||
F: FromEither2<F>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (a: A) => Kind2<F, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(b: B) => Kind2<F, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): (a: A) => Kind2<F, E, A>
|
||||
}
|
||||
export declare function fromPredicate<F extends URIS2, E>(
|
||||
F: FromEither2C<F, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (a: A) => Kind2<F, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(b: B) => Kind2<F, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): (a: A) => Kind2<F, E, A>
|
||||
}
|
||||
export declare function fromPredicate<F>(F: FromEither<F>): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (a: A) => HKT2<F, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(b: B) => HKT2<F, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): (a: A) => HKT2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fromOptionK<F extends URIS4>(
|
||||
F: FromEither4<F>
|
||||
): <E>(
|
||||
onNone: LazyArg<E>
|
||||
) => <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Option<B>) => <S, R>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromOptionK<F extends URIS3>(
|
||||
F: FromEither3<F>
|
||||
): <E>(
|
||||
onNone: LazyArg<E>
|
||||
) => <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Option<B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromOptionK<F extends URIS3, E>(
|
||||
F: FromEither3C<F, E>
|
||||
): (
|
||||
onNone: LazyArg<E>
|
||||
) => <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Option<B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromOptionK<F extends URIS2>(
|
||||
F: FromEither2<F>
|
||||
): <E>(
|
||||
onNone: LazyArg<E>
|
||||
) => <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Option<B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromOptionK<F extends URIS2, E>(
|
||||
F: FromEither2C<F, E>
|
||||
): (
|
||||
onNone: LazyArg<E>
|
||||
) => <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Option<B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromOptionK<F>(
|
||||
F: FromEither<F>
|
||||
): <E>(
|
||||
onNone: LazyArg<E>
|
||||
) => <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Option<B>) => (...a: A) => HKT2<F, E, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainOptionK<F extends URIS4>(
|
||||
F: FromEither4<F>,
|
||||
M: Chain4<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A, B>(f: (a: A) => Option<B>) => <S, R>(ma: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
|
||||
export declare function chainOptionK<F extends URIS3>(
|
||||
F: FromEither3<F>,
|
||||
M: Chain3<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
|
||||
export declare function chainOptionK<F extends URIS3, E>(
|
||||
F: FromEither3C<F, E>,
|
||||
M: Chain3C<F, E>
|
||||
): (onNone: LazyArg<E>) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
|
||||
export declare function chainOptionK<F extends URIS2>(
|
||||
F: FromEither2<F>,
|
||||
M: Chain2<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A, B>(f: (a: A) => Option<B>) => (ma: Kind2<F, E, A>) => Kind2<F, E, B>
|
||||
export declare function chainOptionK<F extends URIS2, E>(
|
||||
F: FromEither2C<F, E>,
|
||||
M: Chain2C<F, E>
|
||||
): (onNone: LazyArg<E>) => <A, B>(f: (a: A) => Option<B>) => (ma: Kind2<F, E, A>) => Kind2<F, E, B>
|
||||
export declare function chainOptionK<F>(
|
||||
F: FromEither<F>,
|
||||
M: Chain<F>
|
||||
): <E>(onNone: LazyArg<E>) => <A, B>(f: (a: A) => Option<B>) => (ma: HKT2<F, E, A>) => HKT2<F, E, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fromEitherK<F extends URIS4>(
|
||||
F: FromEither4<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => Either<E, B>) => <S, R>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromEitherK<F extends URIS3>(
|
||||
F: FromEither3<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => Either<E, B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromEitherK<F extends URIS3, E>(
|
||||
F: FromEither3C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Either<E, B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromEitherK<F extends URIS2>(
|
||||
F: FromEither2<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => Either<E, B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromEitherK<F extends URIS2, E>(
|
||||
F: FromEither2C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Either<E, B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromEitherK<F extends URIS>(
|
||||
F: FromEither1<F>
|
||||
): <E, A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Either<E, B>) => (...a: A) => Kind<F, B>
|
||||
export declare function fromEitherK<F>(
|
||||
F: FromEither<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => Either<E, B>) => (...a: A) => HKT2<F, E, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainEitherK<M extends URIS4>(
|
||||
F: FromEither4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => <S, R>(ma: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, B>
|
||||
export declare function chainEitherK<M extends URIS3>(
|
||||
F: FromEither3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainEitherK<M extends URIS3, E>(
|
||||
F: FromEither3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, B>(f: (a: A) => Either<E, B>) => <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainEitherK<M extends URIS2>(
|
||||
F: FromEither2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => (ma: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
export declare function chainEitherK<M extends URIS2, E>(
|
||||
F: FromEither2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): <A, B>(f: (a: A) => Either<E, B>) => (ma: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
export declare function chainEitherK<M extends URIS>(
|
||||
F: FromEither1<M>,
|
||||
M: Chain1<M>
|
||||
): <E, A, B>(f: (a: A) => Either<E, B>) => (ma: Kind<M, A>) => Kind<M, B>
|
||||
export declare function chainEitherK<M>(
|
||||
F: FromEither<M>,
|
||||
M: Chain<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => (ma: HKT2<M, E, A>) => HKT2<M, E, B>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare function chainFirstEitherK<M extends URIS4>(
|
||||
F: FromEither4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => <S, R>(ma: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, A>
|
||||
export declare function chainFirstEitherK<M extends URIS3>(
|
||||
F: FromEither3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstEitherK<M extends URIS3, E>(
|
||||
F: FromEither3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, B>(f: (a: A) => Either<E, B>) => <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstEitherK<M extends URIS2>(
|
||||
F: FromEither2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => (ma: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirstEitherK<M extends URIS2, E>(
|
||||
F: FromEither2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): <A, B>(f: (a: A) => Either<E, B>) => (ma: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirstEitherK<M extends URIS>(
|
||||
F: FromEither1<M>,
|
||||
M: Chain1<M>
|
||||
): <E, A, B>(f: (a: A) => Either<E, B>) => (ma: Kind<M, A>) => Kind<M, A>
|
||||
export declare function chainFirstEitherK<M>(
|
||||
F: FromEither<M>,
|
||||
M: Chain<M>
|
||||
): <A, E, B>(f: (a: A) => Either<E, B>) => (ma: HKT2<M, E, A>) => HKT2<M, E, A>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function filterOrElse<M extends URIS4>(
|
||||
F: FromEither4<M>,
|
||||
M: Chain4<M>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <S, R>(
|
||||
ma: Kind4<M, S, R, E, A>
|
||||
) => Kind4<M, S, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <S, R, B extends A>(
|
||||
mb: Kind4<M, S, R, E, B>
|
||||
) => Kind4<M, S, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <S, R>(ma: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, A>
|
||||
}
|
||||
export declare function filterOrElse<M extends URIS3>(
|
||||
F: FromEither3<M>,
|
||||
M: Chain3<M>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(
|
||||
ma: Kind3<M, R, E, A>
|
||||
) => Kind3<M, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(mb: Kind3<M, R, E, B>) => Kind3<M, R, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
}
|
||||
export declare function filterOrElse<M extends URIS3, E>(
|
||||
F: FromEither3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(mb: Kind3<M, R, E, B>) => Kind3<M, R, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
}
|
||||
export declare function filterOrElse<M extends URIS2>(
|
||||
F: FromEither2<M>,
|
||||
M: Chain2<M>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (self: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(self: Kind2<M, E, B>) => Kind2<M, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): (self: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
}
|
||||
export declare function filterOrElse<M extends URIS2, E>(
|
||||
F: FromEither2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): {
|
||||
<A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (ma: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(mb: Kind2<M, E, B>) => Kind2<M, E, B>
|
||||
<A>(predicate: Predicate<A>, onFalse: (a: A) => E): (ma: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
}
|
||||
export declare function filterOrElse<M extends URIS2>(
|
||||
F: FromEither<M>,
|
||||
M: Chain<M>
|
||||
): {
|
||||
<A, B extends A, E>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (ma: HKT2<M, E, A>) => HKT2<M, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(mb: HKT2<M, E, B>) => HKT2<M, E, B>
|
||||
<A, E>(predicate: Predicate<A>, onFalse: (a: A) => E): (ma: HKT2<M, E, A>) => HKT2<M, E, A>
|
||||
}
|
||||
90
node_modules/fp-ts/lib/FromEither.js
generated
vendored
Normal file
90
node_modules/fp-ts/lib/FromEither.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
/**
|
||||
* The `FromEither` type class represents those data types which support errors.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromOption = fromOption;
|
||||
exports.fromPredicate = fromPredicate;
|
||||
exports.fromOptionK = fromOptionK;
|
||||
exports.chainOptionK = chainOptionK;
|
||||
exports.fromEitherK = fromEitherK;
|
||||
exports.chainEitherK = chainEitherK;
|
||||
exports.chainFirstEitherK = chainFirstEitherK;
|
||||
exports.filterOrElse = filterOrElse;
|
||||
exports.tapEither = tapEither;
|
||||
var Chain_1 = require("./Chain");
|
||||
var function_1 = require("./function");
|
||||
var _ = __importStar(require("./internal"));
|
||||
function fromOption(F) {
|
||||
return function (onNone) { return function (ma) { return F.fromEither(_.isNone(ma) ? _.left(onNone()) : _.right(ma.value)); }; };
|
||||
}
|
||||
function fromPredicate(F) {
|
||||
return function (predicate, onFalse) {
|
||||
return function (a) {
|
||||
return F.fromEither(predicate(a) ? _.right(a) : _.left(onFalse(a)));
|
||||
};
|
||||
};
|
||||
}
|
||||
function fromOptionK(F) {
|
||||
var fromOptionF = fromOption(F);
|
||||
return function (onNone) {
|
||||
var from = fromOptionF(onNone);
|
||||
return function (f) { return (0, function_1.flow)(f, from); };
|
||||
};
|
||||
}
|
||||
function chainOptionK(F, M) {
|
||||
var fromOptionKF = fromOptionK(F);
|
||||
return function (onNone) {
|
||||
var from = fromOptionKF(onNone);
|
||||
return function (f) { return function (ma) { return M.chain(ma, from(f)); }; };
|
||||
};
|
||||
}
|
||||
function fromEitherK(F) {
|
||||
return function (f) { return (0, function_1.flow)(f, F.fromEither); };
|
||||
}
|
||||
function chainEitherK(F, M) {
|
||||
var fromEitherKF = fromEitherK(F);
|
||||
return function (f) { return function (ma) { return M.chain(ma, fromEitherKF(f)); }; };
|
||||
}
|
||||
function chainFirstEitherK(F, M) {
|
||||
var tapEitherM = tapEither(F, M);
|
||||
return function (f) { return function (ma) { return tapEitherM(ma, f); }; };
|
||||
}
|
||||
function filterOrElse(F, M) {
|
||||
return function (predicate, onFalse) {
|
||||
return function (ma) {
|
||||
return M.chain(ma, function (a) { return F.fromEither(predicate(a) ? _.right(a) : _.left(onFalse(a))); });
|
||||
};
|
||||
};
|
||||
}
|
||||
/** @internal */
|
||||
function tapEither(F, M) {
|
||||
var fromEither = fromEitherK(F);
|
||||
var tapM = (0, Chain_1.tap)(M);
|
||||
return function (self, f) { return tapM(self, fromEither(f)); };
|
||||
}
|
||||
152
node_modules/fp-ts/lib/FromIO.d.ts
generated
vendored
Normal file
152
node_modules/fp-ts/lib/FromIO.d.ts
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* Lift a computation from the `IO` monad
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C, Chain4 } from './Chain'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { IO } from './IO'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO<F> {
|
||||
readonly URI: F
|
||||
readonly fromIO: <A>(fa: IO<A>) => HKT<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly fromIO: <A>(fa: IO<A>) => Kind<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly fromIO: <A, E>(fa: IO<A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromIO: <A>(fa: IO<A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly fromIO: <A, R, E>(fa: IO<A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromIO: <A, R>(fa: IO<A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromIO4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly fromIO: <A, S, R, E>(fa: IO<A>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fromIOK<F extends URIS4>(
|
||||
F: FromIO4<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => <S, R, E>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromIOK<F extends URIS3>(
|
||||
F: FromIO3<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => <R, E>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromIOK<F extends URIS3, E>(
|
||||
F: FromIO3C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromIOK<F extends URIS2>(
|
||||
F: FromIO2<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => <E>(...a: A) => Kind2<F, E, B>
|
||||
export declare function fromIOK<F extends URIS2, E>(
|
||||
F: FromIO2C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromIOK<F extends URIS>(
|
||||
F: FromIO1<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => (...a: A) => Kind<F, B>
|
||||
export declare function fromIOK<F>(
|
||||
F: FromIO<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => (...a: A) => HKT<F, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainIOK<M extends URIS4>(
|
||||
F: FromIO4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <S, R, E>(first: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, B>
|
||||
export declare function chainIOK<M extends URIS3>(
|
||||
F: FromIO3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <R, E>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainIOK<M extends URIS3, E>(
|
||||
F: FromIO3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <R>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainIOK<M extends URIS2>(
|
||||
F: FromIO2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <E>(first: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
export declare function chainIOK<M extends URIS2, E>(
|
||||
F: FromIO2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): <A, B>(f: (a: A) => IO<B>) => (first: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
export declare function chainIOK<M extends URIS>(
|
||||
F: FromIO1<M>,
|
||||
M: Chain1<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => (first: Kind<M, A>) => Kind<M, B>
|
||||
export declare function chainIOK<M>(
|
||||
F: FromIO<M>,
|
||||
M: Chain<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => (first: HKT<M, A>) => HKT<M, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainFirstIOK<M extends URIS4>(
|
||||
F: FromIO4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <S, R, E>(first: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, A>
|
||||
export declare function chainFirstIOK<M extends URIS3>(
|
||||
F: FromIO3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <R, E>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstIOK<M extends URIS3, E>(
|
||||
F: FromIO3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <R, E>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstIOK<M extends URIS2>(
|
||||
F: FromIO2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <E>(first: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirstIOK<M extends URIS2, E>(
|
||||
F: FromIO2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): <A, B>(f: (a: A) => IO<B>) => <E>(first: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirstIOK<M extends URIS>(
|
||||
F: FromIO1<M>,
|
||||
M: Chain1<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => (first: Kind<M, A>) => Kind<M, A>
|
||||
export declare function chainFirstIOK<M>(
|
||||
F: FromIO<M>,
|
||||
M: Chain<M>
|
||||
): <A, B>(f: (a: A) => IO<B>) => (first: HKT<M, A>) => HKT<M, A>
|
||||
31
node_modules/fp-ts/lib/FromIO.js
generated
vendored
Normal file
31
node_modules/fp-ts/lib/FromIO.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromIOK = fromIOK;
|
||||
exports.chainIOK = chainIOK;
|
||||
exports.chainFirstIOK = chainFirstIOK;
|
||||
exports.tapIO = tapIO;
|
||||
/**
|
||||
* Lift a computation from the `IO` monad
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var Chain_1 = require("./Chain");
|
||||
var function_1 = require("./function");
|
||||
function fromIOK(F) {
|
||||
return function (f) { return (0, function_1.flow)(f, F.fromIO); };
|
||||
}
|
||||
function chainIOK(F, M) {
|
||||
return function (f) {
|
||||
var g = (0, function_1.flow)(f, F.fromIO);
|
||||
return function (first) { return M.chain(first, g); };
|
||||
};
|
||||
}
|
||||
function chainFirstIOK(F, M) {
|
||||
var tapIOM = tapIO(F, M);
|
||||
return function (f) { return function (first) { return tapIOM(first, f); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function tapIO(F, M) {
|
||||
var chainFirstM = (0, Chain_1.tap)(M);
|
||||
return function (self, f) { return chainFirstM(self, (0, function_1.flow)(f, F.fromIO)); };
|
||||
}
|
||||
136
node_modules/fp-ts/lib/FromReader.d.ts
generated
vendored
Normal file
136
node_modules/fp-ts/lib/FromReader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Lift a computation from the `Reader` monad.
|
||||
*
|
||||
* @since 2.11.0
|
||||
*/
|
||||
import { Chain, Chain2, Chain3, Chain3C, Chain4 } from './Chain'
|
||||
import { HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import * as R from './Reader'
|
||||
import Reader = R.Reader
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromReader<F> {
|
||||
readonly URI: F
|
||||
readonly fromReader: <R, A>(fa: Reader<R, A>) => HKT2<F, R, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromReader2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly fromReader: <E, A>(fa: Reader<E, A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromReader3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly fromReader: <R, A, E>(fa: Reader<R, A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromReader3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromReader: <R, A>(fa: Reader<R, A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromReader4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly fromReader: <R, A, S, E>(fa: Reader<R, A>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function ask<F extends URIS4>(F: FromReader4<F>): <S, R, E>() => Kind4<F, S, R, E, R>
|
||||
export declare function ask<F extends URIS3>(F: FromReader3<F>): <R, E>() => Kind3<F, R, E, R>
|
||||
export declare function ask<F extends URIS3, E>(F: FromReader3C<F, E>): <R>() => Kind3<F, R, E, R>
|
||||
export declare function ask<F extends URIS2>(F: FromReader2<F>): <R>() => Kind2<F, R, R>
|
||||
export declare function ask<F>(F: FromReader<F>): <R>() => HKT2<F, R, R>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function asks<F extends URIS4>(F: FromReader4<F>): <R, A, S, E>(f: (r: R) => A) => Kind4<F, S, R, E, A>
|
||||
export declare function asks<F extends URIS3>(F: FromReader3<F>): <R, A, E>(f: (r: R) => A) => Kind3<F, R, E, A>
|
||||
export declare function asks<F extends URIS3, E>(F: FromReader3C<F, E>): <R, A>(f: (r: R) => A) => Kind3<F, R, E, A>
|
||||
export declare function asks<F extends URIS2>(F: FromReader2<F>): <R, A>(f: (r: R) => A) => Kind2<F, R, A>
|
||||
export declare function asks<F>(F: FromReader<F>): <R, A>(f: (r: R) => A) => HKT2<F, R, A>
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function fromReaderK<F extends URIS4>(
|
||||
F: FromReader4<F>
|
||||
): <A extends ReadonlyArray<unknown>, R, B>(f: (...a: A) => Reader<R, B>) => <S, E>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromReaderK<F extends URIS3>(
|
||||
F: FromReader3<F>
|
||||
): <A extends ReadonlyArray<unknown>, R, B>(f: (...a: A) => Reader<R, B>) => <E>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromReaderK<F extends URIS3, E>(
|
||||
F: FromReader3C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, R, B>(f: (...a: A) => Reader<R, B>) => (...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromReaderK<F extends URIS2>(
|
||||
F: FromReader2<F>
|
||||
): <A extends ReadonlyArray<unknown>, R, B>(f: (...a: A) => Reader<R, B>) => (...a: A) => Kind2<F, R, B>
|
||||
export declare function fromReaderK<F>(
|
||||
F: FromReader<F>
|
||||
): <A extends ReadonlyArray<unknown>, R, B>(f: (...a: A) => Reader<R, B>) => (...a: A) => HKT2<F, R, B>
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function chainReaderK<M extends URIS4>(
|
||||
F: FromReader4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => <S, E>(ma: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, B>
|
||||
export declare function chainReaderK<M extends URIS3>(
|
||||
F: FromReader3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => <E>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainReaderK<M extends URIS3, E>(
|
||||
F: FromReader3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => (ma: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainReaderK<M extends URIS2>(
|
||||
F: FromReader2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => (ma: Kind2<M, R, A>) => Kind2<M, R, B>
|
||||
export declare function chainReaderK<M>(
|
||||
F: FromReader<M>,
|
||||
M: Chain<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => (ma: HKT2<M, R, A>) => HKT2<M, R, B>
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function chainFirstReaderK<M extends URIS4>(
|
||||
F: FromReader4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => <S, E>(ma: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, A>
|
||||
export declare function chainFirstReaderK<M extends URIS3>(
|
||||
F: FromReader3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => <E>(ma: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstReaderK<M extends URIS3, E>(
|
||||
F: FromReader3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => (ma: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstReaderK<M extends URIS2>(
|
||||
F: FromReader2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => (ma: Kind2<M, R, A>) => Kind2<M, R, A>
|
||||
export declare function chainFirstReaderK<M>(
|
||||
F: FromReader<M>,
|
||||
M: Chain<M>
|
||||
): <A, R, B>(f: (a: A) => Reader<R, B>) => (ma: HKT2<M, R, A>) => HKT2<M, R, A>
|
||||
export declare function tapReader<M extends URIS2>(
|
||||
F: FromReader<M>,
|
||||
M: Chain<M>
|
||||
): <A, R, B>(self: HKT2<M, R, A>, f: (a: A) => Reader<R, B>) => HKT2<M, R, A>
|
||||
61
node_modules/fp-ts/lib/FromReader.js
generated
vendored
Normal file
61
node_modules/fp-ts/lib/FromReader.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ask = ask;
|
||||
exports.asks = asks;
|
||||
exports.fromReaderK = fromReaderK;
|
||||
exports.chainReaderK = chainReaderK;
|
||||
exports.chainFirstReaderK = chainFirstReaderK;
|
||||
exports.tapReader = tapReader;
|
||||
/**
|
||||
* Lift a computation from the `Reader` monad.
|
||||
*
|
||||
* @since 2.11.0
|
||||
*/
|
||||
var Chain_1 = require("./Chain");
|
||||
var function_1 = require("./function");
|
||||
var R = __importStar(require("./Reader"));
|
||||
function ask(F) {
|
||||
return function () { return F.fromReader(R.ask()); };
|
||||
}
|
||||
function asks(F) {
|
||||
return F.fromReader;
|
||||
}
|
||||
function fromReaderK(F) {
|
||||
return function (f) { return (0, function_1.flow)(f, F.fromReader); };
|
||||
}
|
||||
function chainReaderK(F, M) {
|
||||
var fromReaderKF = fromReaderK(F);
|
||||
return function (f) { return function (ma) { return M.chain(ma, fromReaderKF(f)); }; };
|
||||
}
|
||||
function chainFirstReaderK(F, M) {
|
||||
var tapM = tapReader(F, M);
|
||||
return function (f) { return function (self) { return tapM(self, f); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function tapReader(F, M) {
|
||||
var tapM = (0, Chain_1.tap)(M);
|
||||
return function (self, f) { return tapM(self, (0, function_1.flow)(f, F.fromReader)); };
|
||||
}
|
||||
128
node_modules/fp-ts/lib/FromState.d.ts
generated
vendored
Normal file
128
node_modules/fp-ts/lib/FromState.d.ts
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* Lift a computation from the `State` monad.
|
||||
*
|
||||
* @since 2.11.0
|
||||
*/
|
||||
import { Chain, Chain2, Chain3, Chain4 } from './Chain'
|
||||
import { Endomorphism } from './Endomorphism'
|
||||
import { HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import * as S from './State'
|
||||
import State = S.State
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromState<F> {
|
||||
readonly URI: F
|
||||
readonly fromState: <S, A>(fa: State<S, A>) => HKT2<F, S, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromState2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly fromState: <S, A>(fa: State<S, A>) => Kind2<F, S, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromState3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly fromState: <S, A, E>(fa: State<S, A>) => Kind3<F, S, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromState3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromState: <S, A>(fa: State<S, A>) => Kind3<F, S, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromState4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly fromState: <S, A, R, E>(fa: State<S, A>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function get<F extends URIS4>(F: FromState4<F>): <S, R, E>() => Kind4<F, S, R, E, S>
|
||||
export declare function get<F extends URIS3>(F: FromState3<F>): <S, E>() => Kind3<F, S, E, S>
|
||||
export declare function get<F extends URIS3, E>(F: FromState3C<F, E>): <S>() => Kind3<F, S, E, S>
|
||||
export declare function get<F extends URIS2>(F: FromState2<F>): <S>() => Kind2<F, S, S>
|
||||
export declare function get<F>(F: FromState<F>): <S>() => HKT2<F, S, S>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function put<F extends URIS4>(F: FromState4<F>): <S, R, E>(s: S) => Kind4<F, S, R, E, void>
|
||||
export declare function put<F extends URIS3>(F: FromState3<F>): <S, E>(s: S) => Kind3<F, S, E, void>
|
||||
export declare function put<F extends URIS3, E>(F: FromState3C<F, E>): <S>(s: S) => Kind3<F, S, E, void>
|
||||
export declare function put<F extends URIS2>(F: FromState2<F>): <S>(s: S) => Kind2<F, S, void>
|
||||
export declare function put<F>(F: FromState<F>): <S>(s: S) => HKT2<F, S, void>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function modify<F extends URIS4>(
|
||||
F: FromState4<F>
|
||||
): <S, R, E>(f: Endomorphism<S>) => Kind4<F, S, R, E, void>
|
||||
export declare function modify<F extends URIS3>(F: FromState3<F>): <S, E>(f: Endomorphism<S>) => Kind3<F, S, E, void>
|
||||
export declare function modify<F extends URIS3, E>(
|
||||
F: FromState3C<F, E>
|
||||
): <S>(f: Endomorphism<S>) => Kind3<F, S, E, void>
|
||||
export declare function modify<F extends URIS2>(F: FromState2<F>): <S>(f: Endomorphism<S>) => Kind2<F, S, void>
|
||||
export declare function modify<F>(F: FromState<F>): <S>(f: Endomorphism<S>) => HKT2<F, S, void>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function gets<F extends URIS4>(F: FromState4<F>): <S, R, E, A>(f: (s: S) => A) => Kind4<F, S, R, E, A>
|
||||
export declare function gets<F extends URIS3>(F: FromState3<F>): <S, E, A>(f: (s: S) => A) => Kind3<F, S, E, A>
|
||||
export declare function gets<F extends URIS3, E>(F: FromState3C<F, E>): <S, A>(f: (s: S) => A) => Kind3<F, S, E, A>
|
||||
export declare function gets<F extends URIS2>(F: FromState2<F>): <S, A>(f: (s: S) => A) => Kind2<F, S, A>
|
||||
export declare function gets<F>(F: FromState<F>): <S, A>(f: (s: S) => A) => HKT2<F, S, A>
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function fromStateK<F extends URIS4>(
|
||||
F: FromState4<F>
|
||||
): <A extends ReadonlyArray<unknown>, S, B>(f: (...a: A) => State<S, B>) => <R, E>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromStateK<F extends URIS3>(
|
||||
F: FromState3<F>
|
||||
): <A extends ReadonlyArray<unknown>, S, B>(f: (...a: A) => State<S, B>) => <E>(...a: A) => Kind3<F, S, E, B>
|
||||
export declare function fromStateK<F extends URIS3, E>(
|
||||
F: FromState3C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, S, B>(f: (...a: A) => State<S, B>) => (...a: A) => Kind3<F, S, E, B>
|
||||
export declare function fromStateK<F extends URIS2>(
|
||||
F: FromState2<F>
|
||||
): <A extends ReadonlyArray<unknown>, S, B>(f: (...a: A) => State<S, B>) => (...a: A) => Kind2<F, S, B>
|
||||
export declare function fromStateK<F>(
|
||||
F: FromState<F>
|
||||
): <A extends ReadonlyArray<unknown>, S, B>(f: (...a: A) => State<S, B>) => (...a: A) => HKT2<F, S, B>
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function chainStateK<M extends URIS4>(
|
||||
F: FromState4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, S, B>(f: (a: A) => State<S, B>) => <R, E>(ma: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, B>
|
||||
export declare function chainStateK<M extends URIS3>(
|
||||
F: FromState3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, S, B>(f: (a: A) => State<S, B>) => <E>(ma: Kind3<M, S, E, A>) => Kind3<M, S, E, B>
|
||||
export declare function chainStateK<M extends URIS2>(
|
||||
F: FromState2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, S, B>(f: (a: A) => State<S, B>) => (ma: Kind2<M, S, A>) => Kind2<M, S, B>
|
||||
export declare function chainStateK<M>(
|
||||
F: FromState<M>,
|
||||
M: Chain<M>
|
||||
): <A, S, B>(f: (a: A) => State<S, B>) => (ma: HKT2<M, S, A>) => HKT2<M, S, B>
|
||||
52
node_modules/fp-ts/lib/FromState.js
generated
vendored
Normal file
52
node_modules/fp-ts/lib/FromState.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.get = get;
|
||||
exports.put = put;
|
||||
exports.modify = modify;
|
||||
exports.gets = gets;
|
||||
exports.fromStateK = fromStateK;
|
||||
exports.chainStateK = chainStateK;
|
||||
var function_1 = require("./function");
|
||||
var S = __importStar(require("./State"));
|
||||
function get(F) {
|
||||
return function () { return F.fromState(S.get()); };
|
||||
}
|
||||
function put(F) {
|
||||
return function (s) { return F.fromState(S.put(s)); };
|
||||
}
|
||||
function modify(F) {
|
||||
return (0, function_1.flow)(S.modify, F.fromState);
|
||||
}
|
||||
function gets(F) {
|
||||
return (0, function_1.flow)(S.gets, F.fromState);
|
||||
}
|
||||
function fromStateK(F) {
|
||||
return function (f) { return (0, function_1.flow)(f, F.fromState); };
|
||||
}
|
||||
function chainStateK(F, M) {
|
||||
var fromStateKF = fromStateK(F);
|
||||
return function (f) { return function (ma) { return M.chain(ma, fromStateKF(f)); }; };
|
||||
}
|
||||
144
node_modules/fp-ts/lib/FromTask.d.ts
generated
vendored
Normal file
144
node_modules/fp-ts/lib/FromTask.d.ts
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
/**
|
||||
* Lift a computation from the `Task` monad
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C, Chain4 } from './Chain'
|
||||
import { FromIO, FromIO1, FromIO2, FromIO2C, FromIO3, FromIO3C, FromIO4 } from './FromIO'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { Task } from './Task'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask<F> extends FromIO<F> {
|
||||
readonly fromTask: <A>(fa: Task<A>) => HKT<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask1<F extends URIS> extends FromIO1<F> {
|
||||
readonly fromTask: <A>(fa: Task<A>) => Kind<F, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask2<F extends URIS2> extends FromIO2<F> {
|
||||
readonly fromTask: <A, E>(fa: Task<A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask2C<F extends URIS2, E> extends FromIO2C<F, E> {
|
||||
readonly fromTask: <A>(fa: Task<A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask3<F extends URIS3> extends FromIO3<F> {
|
||||
readonly fromTask: <A, R, E>(fa: Task<A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask3C<F extends URIS3, E> extends FromIO3C<F, E> {
|
||||
readonly fromTask: <A, R>(fa: Task<A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export interface FromTask4<F extends URIS4> extends FromIO4<F> {
|
||||
readonly fromTask: <A, S, R, E>(fa: Task<A>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function fromTaskK<F extends URIS4>(
|
||||
F: FromTask4<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => <S, R, E>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromTaskK<F extends URIS3>(
|
||||
F: FromTask3<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => <R, E>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromTaskK<F extends URIS3, E>(
|
||||
F: FromTask3C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromTaskK<F extends URIS2>(
|
||||
F: FromTask2<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => <E>(...a: A) => Kind2<F, E, B>
|
||||
export declare function fromTaskK<F extends URIS2, E>(
|
||||
F: FromTask2C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromTaskK<F extends URIS>(
|
||||
F: FromTask1<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => (...a: A) => Kind<F, B>
|
||||
export declare function fromTaskK<F>(
|
||||
F: FromTask<F>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => Task<B>) => (...a: A) => HKT<F, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainTaskK<M extends URIS4>(
|
||||
F: FromTask4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <S, R, E>(first: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, B>
|
||||
export declare function chainTaskK<M extends URIS3>(
|
||||
F: FromTask3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <R, E>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainTaskK<M extends URIS3, E>(
|
||||
F: FromTask3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <R>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, B>
|
||||
export declare function chainTaskK<M extends URIS2>(
|
||||
F: FromTask2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <E>(first: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
export declare function chainTaskK<M extends URIS2, E>(
|
||||
F: FromTask2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): <A, B>(f: (a: A) => Task<B>) => (first: Kind2<M, E, A>) => Kind2<M, E, B>
|
||||
export declare function chainTaskK<M extends URIS>(
|
||||
F: FromTask1<M>,
|
||||
M: Chain1<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => (first: Kind<M, A>) => Kind<M, B>
|
||||
export declare function chainTaskK<M>(
|
||||
F: FromTask<M>,
|
||||
M: Chain<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => (first: HKT<M, A>) => HKT<M, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function chainFirstTaskK<M extends URIS4>(
|
||||
F: FromTask4<M>,
|
||||
M: Chain4<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <S, R, E>(first: Kind4<M, S, R, E, A>) => Kind4<M, S, R, E, A>
|
||||
export declare function chainFirstTaskK<M extends URIS3>(
|
||||
F: FromTask3<M>,
|
||||
M: Chain3<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <R, E>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstTaskK<M extends URIS3, E>(
|
||||
F: FromTask3C<M, E>,
|
||||
M: Chain3C<M, E>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <R>(first: Kind3<M, R, E, A>) => Kind3<M, R, E, A>
|
||||
export declare function chainFirstTaskK<M extends URIS2>(
|
||||
F: FromTask2<M>,
|
||||
M: Chain2<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => <E>(first: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirstTaskK<M extends URIS2, E>(
|
||||
F: FromTask2C<M, E>,
|
||||
M: Chain2C<M, E>
|
||||
): <A, B>(f: (a: A) => Task<B>) => (first: Kind2<M, E, A>) => Kind2<M, E, A>
|
||||
export declare function chainFirstTaskK<M extends URIS>(
|
||||
F: FromTask1<M>,
|
||||
M: Chain1<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => (first: Kind<M, A>) => Kind<M, A>
|
||||
export declare function chainFirstTaskK<M>(
|
||||
F: FromTask<M>,
|
||||
M: Chain<M>
|
||||
): <A, B>(f: (a: A) => Task<B>) => (first: HKT<M, A>) => HKT<M, A>
|
||||
31
node_modules/fp-ts/lib/FromTask.js
generated
vendored
Normal file
31
node_modules/fp-ts/lib/FromTask.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromTaskK = fromTaskK;
|
||||
exports.chainTaskK = chainTaskK;
|
||||
exports.chainFirstTaskK = chainFirstTaskK;
|
||||
exports.tapTask = tapTask;
|
||||
/**
|
||||
* Lift a computation from the `Task` monad
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
var Chain_1 = require("./Chain");
|
||||
var function_1 = require("./function");
|
||||
function fromTaskK(F) {
|
||||
return function (f) { return (0, function_1.flow)(f, F.fromTask); };
|
||||
}
|
||||
function chainTaskK(F, M) {
|
||||
return function (f) {
|
||||
var g = (0, function_1.flow)(f, F.fromTask);
|
||||
return function (first) { return M.chain(first, g); };
|
||||
};
|
||||
}
|
||||
function chainFirstTaskK(F, M) {
|
||||
var tapTaskM = tapTask(F, M);
|
||||
return function (f) { return function (first) { return tapTaskM(first, f); }; };
|
||||
}
|
||||
/** @internal */
|
||||
function tapTask(F, M) {
|
||||
var tapM = (0, Chain_1.tap)(M);
|
||||
return function (self, f) { return tapM(self, (0, function_1.flow)(f, F.fromTask)); };
|
||||
}
|
||||
73
node_modules/fp-ts/lib/FromThese.d.ts
generated
vendored
Normal file
73
node_modules/fp-ts/lib/FromThese.d.ts
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
import { HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
|
||||
import { These } from './These'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromThese<F> {
|
||||
readonly URI: F
|
||||
readonly fromThese: <E, A>(e: These<E, A>) => HKT2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromThese2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly fromThese: <E, A>(fa: These<E, A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromThese2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromThese: <A>(fa: These<E, A>) => Kind2<F, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromThese3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly fromThese: <E, A, R>(fa: These<E, A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromThese3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly fromThese: <A, R>(fa: These<E, A>) => Kind3<F, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export interface FromThese4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly fromThese: <E, A, S, R>(fa: These<E, A>) => Kind4<F, S, R, E, A>
|
||||
}
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare function fromTheseK<F extends URIS4>(
|
||||
F: FromThese4<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => These<E, B>) => <S, R>(...a: A) => Kind4<F, S, R, E, B>
|
||||
export declare function fromTheseK<F extends URIS3>(
|
||||
F: FromThese3<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => These<E, B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromTheseK<F extends URIS3, E>(
|
||||
F: FromThese3C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => These<E, B>) => <R>(...a: A) => Kind3<F, R, E, B>
|
||||
export declare function fromTheseK<F extends URIS2>(
|
||||
F: FromThese2<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => These<E, B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromTheseK<F extends URIS2, E>(
|
||||
F: FromThese2C<F, E>
|
||||
): <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => These<E, B>) => (...a: A) => Kind2<F, E, B>
|
||||
export declare function fromTheseK<F>(
|
||||
F: FromThese<F>
|
||||
): <A extends ReadonlyArray<unknown>, E, B>(f: (...a: A) => These<E, B>) => (...a: A) => HKT2<F, E, B>
|
||||
12
node_modules/fp-ts/lib/FromThese.js
generated
vendored
Normal file
12
node_modules/fp-ts/lib/FromThese.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromTheseK = fromTheseK;
|
||||
/**
|
||||
* The `FromThese` type class represents those data types which support errors and warnings.
|
||||
*
|
||||
* @since 2.11.0
|
||||
*/
|
||||
var function_1 = require("./function");
|
||||
function fromTheseK(F) {
|
||||
return function (f) { return (0, function_1.flow)(f, F.fromThese); };
|
||||
}
|
||||
452
node_modules/fp-ts/lib/Functor.d.ts
generated
vendored
Normal file
452
node_modules/fp-ts/lib/Functor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,452 @@
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Functor<F> {
|
||||
readonly URI: F
|
||||
readonly map: <A, B>(fa: HKT<F, A>, f: (a: A) => B) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Functor1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly map: <A, B>(fa: Kind<F, A>, f: (a: A) => B) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Functor2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly map: <E, A, B>(fa: Kind2<F, E, A>, f: (a: A) => B) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Functor2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly map: <A, B>(fa: Kind2<F, E, A>, f: (a: A) => B) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Functor3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly map: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => B) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface Functor3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly map: <R, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => B) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Functor4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly map: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (a: A) => B) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
/**
|
||||
* `map` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function map<F extends URIS3, G extends URIS>(
|
||||
F: Functor3<F>,
|
||||
G: Functor1<G>
|
||||
): <A, B>(f: (a: A) => B) => <R, E>(fa: Kind3<F, R, E, Kind<G, A>>) => Kind3<F, R, E, Kind<G, B>>
|
||||
export declare function map<F extends URIS2, G extends URIS2>(
|
||||
F: Functor2<F>,
|
||||
G: Functor2<G>
|
||||
): <A, B>(f: (a: A) => B) => <EF, EG>(fa: Kind2<F, EF, Kind2<G, EG, A>>) => Kind2<F, EF, Kind2<G, EG, B>>
|
||||
export declare function map<F extends URIS2, G extends URIS>(
|
||||
F: Functor2<F>,
|
||||
G: Functor1<G>
|
||||
): <A, B>(f: (a: A) => B) => <E>(fa: Kind2<F, E, Kind<G, A>>) => Kind2<F, E, Kind<G, B>>
|
||||
export declare function map<F extends URIS, G extends URIS3>(
|
||||
F: Functor1<F>,
|
||||
G: Functor3<G>
|
||||
): <A, B>(f: (a: A) => B) => <R, E>(fa: Kind<F, Kind3<G, R, E, A>>) => Kind<F, Kind3<G, R, E, B>>
|
||||
export declare function map<F extends URIS, G extends URIS2>(
|
||||
F: Functor1<F>,
|
||||
G: Functor2<G>
|
||||
): <A, B>(f: (a: A) => B) => <E>(fa: Kind<F, Kind2<G, E, A>>) => Kind<F, Kind2<G, E, B>>
|
||||
export declare function map<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Functor1<G>
|
||||
): <A, B>(f: (a: A) => B) => (fa: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, B>>
|
||||
export declare function map<F, G extends URIS2>(
|
||||
F: Functor<F>,
|
||||
G: Functor2<G>
|
||||
): <A, B>(f: (a: A) => B) => <E>(fa: HKT<F, Kind2<G, E, A>>) => HKT<F, Kind2<G, E, B>>
|
||||
export declare function map<F, G extends URIS>(
|
||||
F: Functor<F>,
|
||||
G: Functor1<G>
|
||||
): <A, B>(f: (a: A) => B) => (fa: HKT<F, Kind<G, A>>) => HKT<F, Kind<G, B>>
|
||||
export declare function map<F, G>(
|
||||
F: Functor<F>,
|
||||
G: Functor<G>
|
||||
): <A, B>(f: (a: A) => B) => (fa: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, B>>
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function flap<F extends URIS4>(
|
||||
F: Functor4<F>
|
||||
): <A>(a: A) => <S, R, E, B>(fab: Kind4<F, S, R, E, (a: A) => B>) => Kind4<F, S, R, E, B>
|
||||
export declare function flap<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <A>(a: A) => <R, E, B>(fab: Kind3<F, R, E, (a: A) => B>) => Kind3<F, R, E, B>
|
||||
export declare function flap<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <A>(a: A) => <E, B>(fab: Kind2<F, E, (a: A) => B>) => Kind2<F, E, B>
|
||||
export declare function flap<F extends URIS>(F: Functor1<F>): <A>(a: A) => <B>(fab: Kind<F, (a: A) => B>) => Kind<F, B>
|
||||
export declare function flap<F>(F: Functor<F>): <A>(a: A) => <B>(fab: HKT<F, (a: A) => B>) => HKT<F, B>
|
||||
/**
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function bindTo<F extends URIS4>(
|
||||
F: Functor4<F>
|
||||
): <N extends string>(
|
||||
name: N
|
||||
) => <S, R, E, A>(
|
||||
fa: Kind4<F, S, R, E, A>
|
||||
) => Kind4<
|
||||
F,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
export declare function bindTo<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <N extends string>(
|
||||
name: N
|
||||
) => <R, E, A>(
|
||||
fa: Kind3<F, R, E, A>
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
export declare function bindTo<F extends URIS3, E>(
|
||||
F: Functor3C<F, E>
|
||||
): <N extends string>(
|
||||
name: N
|
||||
) => <R, A>(
|
||||
fa: Kind3<F, R, E, A>
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
export declare function bindTo<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <N extends string>(
|
||||
name: N
|
||||
) => <E, A>(
|
||||
fa: Kind2<F, E, A>
|
||||
) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
export declare function bindTo<F extends URIS2, E>(
|
||||
F: Functor2C<F, E>
|
||||
): <N extends string>(
|
||||
name: N
|
||||
) => <A>(fa: Kind2<F, E, A>) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
export declare function bindTo<F extends URIS>(
|
||||
F: Functor1<F>
|
||||
): <N extends string>(
|
||||
name: N
|
||||
) => <A>(fa: Kind<F, A>) => Kind<
|
||||
F,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
export declare function bindTo<F>(F: Functor<F>): <N extends string>(
|
||||
name: N
|
||||
) => <A>(fa: HKT<F, A>) => HKT<
|
||||
F,
|
||||
{
|
||||
readonly [K in N]: A
|
||||
}
|
||||
>
|
||||
/**
|
||||
* @since 2.13.0
|
||||
*/
|
||||
declare function let_<F extends URIS4>(
|
||||
F: Functor4<F>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => <S, R, E>(
|
||||
fa: Kind4<F, S, R, E, A>
|
||||
) => Kind4<
|
||||
F,
|
||||
S,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
declare function let_<F extends URIS3>(
|
||||
F: Functor3<F>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => <R, E>(
|
||||
fa: Kind3<F, R, E, A>
|
||||
) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
declare function let_<F extends URIS3, E>(
|
||||
F: Functor3C<F, E>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => <R>(fa: Kind3<F, R, E, A>) => Kind3<
|
||||
F,
|
||||
R,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
declare function let_<F extends URIS2>(
|
||||
F: Functor2<F>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => <E>(fa: Kind2<F, E, A>) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
declare function let_<F extends URIS2, E>(
|
||||
F: Functor2C<F, E>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => (fa: Kind2<F, E, A>) => Kind2<
|
||||
F,
|
||||
E,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
declare function let_<F extends URIS>(
|
||||
F: Functor1<F>
|
||||
): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => (fa: Kind<F, A>) => Kind<
|
||||
F,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
declare function let_<F>(F: Functor<F>): <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => (fa: HKT<F, A>) => HKT<
|
||||
F,
|
||||
{
|
||||
readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
|
||||
}
|
||||
>
|
||||
export {
|
||||
/**
|
||||
* @since 2.13.0
|
||||
*/
|
||||
let_ as let
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition<F, G> {
|
||||
readonly map: <A, B>(fa: HKT<F, HKT<G, A>>, f: (a: A) => B) => HKT<F, HKT<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorCompositionHKT1<F, G extends URIS> {
|
||||
readonly map: <A, B>(fa: HKT<F, Kind<G, A>>, f: (a: A) => B) => HKT<F, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorCompositionHKT2<F, G extends URIS2> {
|
||||
readonly map: <E, A, B>(fa: HKT<F, Kind2<G, E, A>>, f: (a: A) => B) => HKT<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorCompositionHKT2C<F, G extends URIS2, E> {
|
||||
readonly map: <A, B>(fa: HKT<F, Kind2<G, E, A>>, f: (a: A) => B) => HKT<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition11<F extends URIS, G extends URIS> {
|
||||
readonly map: <A, B>(fa: Kind<F, Kind<G, A>>, f: (a: A) => B) => Kind<F, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition12<F extends URIS, G extends URIS2> {
|
||||
readonly map: <E, A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (a: A) => B) => Kind<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition12C<F extends URIS, G extends URIS2, E> {
|
||||
readonly map: <A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (a: A) => B) => Kind<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition21<F extends URIS2, G extends URIS> {
|
||||
readonly map: <E, A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (a: A) => B) => Kind2<F, E, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition2C1<F extends URIS2, G extends URIS, E> {
|
||||
readonly map: <A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (a: A) => B) => Kind2<F, E, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition22<F extends URIS2, G extends URIS2> {
|
||||
readonly map: <FE, GE, A, B>(fa: Kind2<F, FE, Kind2<G, GE, A>>, f: (a: A) => B) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition22C<F extends URIS2, G extends URIS2, E> {
|
||||
readonly map: <FE, A, B>(fa: Kind2<F, FE, Kind2<G, E, A>>, f: (a: A) => B) => Kind2<F, FE, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.2.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition23<F extends URIS2, G extends URIS3> {
|
||||
readonly map: <FE, R, E, A, B>(fa: Kind2<F, FE, Kind3<G, R, E, A>>, f: (a: A) => B) => Kind2<F, FE, Kind3<G, R, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.2.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorComposition23C<F extends URIS2, G extends URIS3, E> {
|
||||
readonly map: <FE, R, A, B>(fa: Kind2<F, FE, Kind3<G, R, E, A>>, f: (a: A) => B) => Kind2<F, FE, Kind3<G, R, E, B>>
|
||||
}
|
||||
/**
|
||||
* Use [`map`](#map) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getFunctorComposition<F extends URIS2, G extends URIS3, E>(
|
||||
F: Functor2<F>,
|
||||
G: Functor3C<G, E>
|
||||
): FunctorComposition23C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS2, G extends URIS2, E>(
|
||||
F: Functor2<F>,
|
||||
G: Functor2C<G, E>
|
||||
): FunctorComposition22C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS2, G extends URIS2>(
|
||||
F: Functor2<F>,
|
||||
G: Functor2<G>
|
||||
): FunctorComposition22<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS2, G extends URIS, E>(
|
||||
F: Functor2C<F, E>,
|
||||
G: Functor1<G>
|
||||
): FunctorComposition2C1<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS2, G extends URIS>(
|
||||
F: Functor2<F>,
|
||||
G: Functor1<G>
|
||||
): FunctorComposition21<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS, G extends URIS2, E>(
|
||||
F: Functor1<F>,
|
||||
G: Functor2C<G, E>
|
||||
): FunctorComposition12C<F, G, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS, G extends URIS2>(
|
||||
F: Functor1<F>,
|
||||
G: Functor2<G>
|
||||
): FunctorComposition12<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F extends URIS, G extends URIS>(
|
||||
F: Functor1<F>,
|
||||
G: Functor1<G>
|
||||
): FunctorComposition11<F, G>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorComposition<F, G>(F: Functor<F>, G: Functor<G>): FunctorComposition<F, G>
|
||||
57
node_modules/fp-ts/lib/Functor.js
generated
vendored
Normal file
57
node_modules/fp-ts/lib/Functor.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.map = map;
|
||||
exports.flap = flap;
|
||||
exports.bindTo = bindTo;
|
||||
exports.let = let_;
|
||||
exports.getFunctorComposition = getFunctorComposition;
|
||||
exports.as = as;
|
||||
exports.asUnit = asUnit;
|
||||
/**
|
||||
* A `Functor` is a type constructor which supports a mapping operation `map`.
|
||||
*
|
||||
* `map` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return types use the type
|
||||
* constructor `f` to represent some computational context.
|
||||
*
|
||||
* Instances must satisfy the following laws:
|
||||
*
|
||||
* 1. Identity: `F.map(fa, a => a) <-> fa`
|
||||
* 2. Composition: `F.map(fa, a => bc(ab(a))) <-> F.map(F.map(fa, ab), bc)`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var function_1 = require("./function");
|
||||
function map(F, G) {
|
||||
return function (f) { return function (fa) { return F.map(fa, function (ga) { return G.map(ga, f); }); }; };
|
||||
}
|
||||
function flap(F) {
|
||||
return function (a) { return function (fab) { return F.map(fab, function (f) { return f(a); }); }; };
|
||||
}
|
||||
function bindTo(F) {
|
||||
return function (name) { return function (fa) { return F.map(fa, function (a) {
|
||||
var _a;
|
||||
return (_a = {}, _a[name] = a, _a);
|
||||
}); }; };
|
||||
}
|
||||
function let_(F) {
|
||||
return function (name, f) { return function (fa) { return F.map(fa, function (a) {
|
||||
var _a;
|
||||
return Object.assign({}, a, (_a = {}, _a[name] = f(a), _a));
|
||||
}); }; };
|
||||
}
|
||||
/** @deprecated */
|
||||
function getFunctorComposition(F, G) {
|
||||
var _map = map(F, G);
|
||||
return {
|
||||
map: function (fga, f) { return (0, function_1.pipe)(fga, _map(f)); }
|
||||
};
|
||||
}
|
||||
/** @internal */
|
||||
function as(F) {
|
||||
return function (self, b) { return F.map(self, function () { return b; }); };
|
||||
}
|
||||
/** @internal */
|
||||
function asUnit(F) {
|
||||
var asM = as(F);
|
||||
return function (self) { return asM(self, undefined); };
|
||||
}
|
||||
203
node_modules/fp-ts/lib/FunctorWithIndex.d.ts
generated
vendored
Normal file
203
node_modules/fp-ts/lib/FunctorWithIndex.d.ts
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
import {
|
||||
Functor,
|
||||
Functor1,
|
||||
Functor2,
|
||||
Functor2C,
|
||||
Functor3,
|
||||
Functor3C,
|
||||
Functor4,
|
||||
FunctorComposition,
|
||||
FunctorComposition2C1,
|
||||
FunctorComposition11,
|
||||
FunctorComposition12,
|
||||
FunctorComposition12C,
|
||||
FunctorComposition21,
|
||||
FunctorComposition22,
|
||||
FunctorComposition22C
|
||||
} from './Functor'
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FunctorWithIndex<F, I> extends Functor<F> {
|
||||
readonly mapWithIndex: <A, B>(fa: HKT<F, A>, f: (i: I, a: A) => B) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FunctorWithIndex1<F extends URIS, I> extends Functor1<F> {
|
||||
readonly mapWithIndex: <A, B>(fa: Kind<F, A>, f: (i: I, a: A) => B) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FunctorWithIndex2<F extends URIS2, I> extends Functor2<F> {
|
||||
readonly mapWithIndex: <E, A, B>(fa: Kind2<F, E, A>, f: (i: I, a: A) => B) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FunctorWithIndex2C<F extends URIS2, I, E> extends Functor2C<F, E> {
|
||||
readonly mapWithIndex: <A, B>(fa: Kind2<F, E, A>, f: (i: I, a: A) => B) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FunctorWithIndex3<F extends URIS3, I> extends Functor3<F> {
|
||||
readonly mapWithIndex: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => B) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.2.0
|
||||
*/
|
||||
export interface FunctorWithIndex3C<F extends URIS3, I, E> extends Functor3C<F, E> {
|
||||
readonly mapWithIndex: <R, A, B>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => B) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface FunctorWithIndex4<F extends URIS4, I> extends Functor4<F> {
|
||||
readonly mapWithIndex: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (i: I, a: A) => B) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
/**
|
||||
* `mapWithIndex` composition.
|
||||
*
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare function mapWithIndex<F extends URIS, I, G extends URIS, J>(
|
||||
F: FunctorWithIndex1<F, I>,
|
||||
G: FunctorWithIndex1<G, J>
|
||||
): <A, B>(f: (ij: readonly [I, J], a: A) => B) => (fa: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, B>>
|
||||
export declare function mapWithIndex<F, I, G, J>(
|
||||
F: FunctorWithIndex<F, I>,
|
||||
G: FunctorWithIndex<G, J>
|
||||
): <A, B>(f: (ij: readonly [I, J], a: A) => B) => (fa: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, B>>
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition<F, FI, G, GI> extends FunctorComposition<F, G> {
|
||||
readonly mapWithIndex: <A, B>(fga: HKT<F, HKT<G, A>>, f: (i: [FI, GI], a: A) => B) => HKT<F, HKT<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition11<F extends URIS, FI, G extends URIS, GI>
|
||||
extends FunctorComposition11<F, G> {
|
||||
readonly mapWithIndex: <A, B>(fa: Kind<F, Kind<G, A>>, f: (i: [FI, GI], a: A) => B) => Kind<F, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition12<F extends URIS, FI, G extends URIS2, GI>
|
||||
extends FunctorComposition12<F, G> {
|
||||
readonly mapWithIndex: <E, A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => B) => Kind<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition12C<F extends URIS, FI, G extends URIS2, GI, E>
|
||||
extends FunctorComposition12C<F, G, E> {
|
||||
readonly mapWithIndex: <A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => B) => Kind<F, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition21<F extends URIS2, FI, G extends URIS, GI>
|
||||
extends FunctorComposition21<F, G> {
|
||||
readonly mapWithIndex: <E, A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (i: [FI, GI], a: A) => B) => Kind2<F, E, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition2C1<F extends URIS2, FI, G extends URIS, GI, E>
|
||||
extends FunctorComposition2C1<F, G, E> {
|
||||
readonly mapWithIndex: <A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (i: [FI, GI], a: A) => B) => Kind2<F, E, Kind<G, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition22<F extends URIS2, FI, G extends URIS2, GI>
|
||||
extends FunctorComposition22<F, G> {
|
||||
readonly mapWithIndex: <FE, GE, A, B>(
|
||||
fa: Kind2<F, FE, Kind2<G, GE, A>>,
|
||||
f: (i: [FI, GI], a: A) => B
|
||||
) => Kind2<F, FE, Kind2<G, GE, B>>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export interface FunctorWithIndexComposition22C<F extends URIS2, FI, G extends URIS2, GI, E>
|
||||
extends FunctorComposition22C<F, G, E> {
|
||||
readonly mapWithIndex: <FE, A, B>(
|
||||
fa: Kind2<F, FE, Kind2<G, E, A>>,
|
||||
f: (i: [FI, GI], a: A) => B
|
||||
) => Kind2<F, FE, Kind2<G, E, B>>
|
||||
}
|
||||
/**
|
||||
* Use [`mapWithIndex`](#mapwithindex) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS2, GI, E>(
|
||||
F: FunctorWithIndex2<F, FI>,
|
||||
G: FunctorWithIndex2C<G, FI, E>
|
||||
): FunctorWithIndexComposition22C<F, FI, G, GI, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS2, GI>(
|
||||
F: FunctorWithIndex2<F, FI>,
|
||||
G: FunctorWithIndex2<G, FI>
|
||||
): FunctorWithIndexComposition22<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS, GI, E>(
|
||||
F: FunctorWithIndex2C<F, FI, E>,
|
||||
G: FunctorWithIndex1<G, GI>
|
||||
): FunctorWithIndexComposition2C1<F, FI, G, GI, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS, GI>(
|
||||
F: FunctorWithIndex2<F, FI>,
|
||||
G: FunctorWithIndex1<G, GI>
|
||||
): FunctorWithIndexComposition21<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS, FI, G extends URIS2, GI, E>(
|
||||
F: FunctorWithIndex1<F, FI>,
|
||||
G: FunctorWithIndex2C<G, GI, E>
|
||||
): FunctorWithIndexComposition12C<F, FI, G, GI, E>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS, FI, G extends URIS2, GI>(
|
||||
F: FunctorWithIndex1<F, FI>,
|
||||
G: FunctorWithIndex2<G, GI>
|
||||
): FunctorWithIndexComposition12<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F extends URIS, FI, G extends URIS, GI>(
|
||||
F: FunctorWithIndex1<F, FI>,
|
||||
G: FunctorWithIndex1<G, GI>
|
||||
): FunctorWithIndexComposition11<F, FI, G, GI>
|
||||
/** @deprecated */
|
||||
export declare function getFunctorWithIndexComposition<F, FI, G, GI>(
|
||||
F: FunctorWithIndex<F, FI>,
|
||||
G: FunctorWithIndex<G, GI>
|
||||
): FunctorWithIndexComposition<F, FI, G, GI>
|
||||
31
node_modules/fp-ts/lib/FunctorWithIndex.js
generated
vendored
Normal file
31
node_modules/fp-ts/lib/FunctorWithIndex.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mapWithIndex = mapWithIndex;
|
||||
exports.getFunctorWithIndexComposition = getFunctorWithIndexComposition;
|
||||
/**
|
||||
* A `FunctorWithIndex` is a type constructor which supports a mapping operation `mapWithIndex`.
|
||||
*
|
||||
* `mapWithIndex` can be used to turn functions `i -> a -> b` into functions `f a -> f b` whose argument and return types use the type
|
||||
* constructor `f` to represent some computational context.
|
||||
*
|
||||
* Instances must satisfy the following laws:
|
||||
*
|
||||
* 1. Identity: `F.mapWithIndex(fa, (_i, a) => a) <-> fa`
|
||||
* 2. Composition: `F.mapWithIndex(fa, (_i, a) => bc(ab(a))) <-> F.mapWithIndex(F.mapWithIndex(fa, ab), bc)`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
function mapWithIndex(F, G) {
|
||||
return function (f) { return function (fa) { return F.mapWithIndex(fa, function (i, ga) { return G.mapWithIndex(ga, function (j, a) { return f([i, j], a); }); }); }; };
|
||||
}
|
||||
/** @deprecated */
|
||||
function getFunctorWithIndexComposition(F, G) {
|
||||
var map = (0, Functor_1.getFunctorComposition)(F, G).map;
|
||||
var _mapWithIndex = mapWithIndex(F, G);
|
||||
return {
|
||||
map: map,
|
||||
mapWithIndex: function (fga, f) { return (0, function_1.pipe)(fga, _mapWithIndex(f)); }
|
||||
};
|
||||
}
|
||||
15
node_modules/fp-ts/lib/Group.d.ts
generated
vendored
Normal file
15
node_modules/fp-ts/lib/Group.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* A `Group` is a `Monoid` with inverses. Instances must satisfy the following law in addition to the monoid laws:
|
||||
*
|
||||
* - Inverse: `concat(inverse(a), a) <-> empty = concat(a, inverse(a))`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Monoid } from './Monoid'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Group<A> extends Monoid<A> {
|
||||
readonly inverse: (a: A) => A
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Group.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Group.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
7
node_modules/fp-ts/lib/HKT/index.js
generated
vendored
Normal file
7
node_modules/fp-ts/lib/HKT/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Type defunctionalization (as describe in [Lightweight higher-kinded polymorphism](https://www.cl.cam.ac.uk/~jdy22/papers/lightweight-higher-kinded-polymorphism.pdf))
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
3
node_modules/fp-ts/lib/HKT/package.json
generated
vendored
Normal file
3
node_modules/fp-ts/lib/HKT/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typings": "../../HKT.d.ts"
|
||||
}
|
||||
32
node_modules/fp-ts/lib/HeytingAlgebra.d.ts
generated
vendored
Normal file
32
node_modules/fp-ts/lib/HeytingAlgebra.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Heyting algebras are bounded (distributive) lattices that are also equipped with an additional binary operation
|
||||
* `implies` (also written as `→`). Heyting algebras also define a complement operation `not` (sometimes written as
|
||||
* `¬a`)
|
||||
*
|
||||
* However, in Heyting algebras this operation is only a pseudo-complement, since Heyting algebras do not necessarily
|
||||
* provide the law of the excluded middle. This means that there is no guarantee that `a ∨ ¬a = 1`.
|
||||
*
|
||||
* Heyting algebras model intuitionistic logic. For a model of classical logic, see the boolean algebra type class
|
||||
* implemented as `BooleanAlgebra`.
|
||||
*
|
||||
* A `HeytingAlgebra` must satisfy the following laws in addition to `BoundedDistributiveLattice` laws:
|
||||
*
|
||||
* - Implication:
|
||||
* - `a → a <-> 1`
|
||||
* - `a ∧ (a → b) <-> a ∧ b`
|
||||
* - `b ∧ (a → b) <-> b`
|
||||
* - `a → (b ∧ c) <-> (a → b) ∧ (a → c)`
|
||||
* - Complemented
|
||||
* - `¬a <-> a → 0`
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { BoundedDistributiveLattice } from './BoundedDistributiveLattice'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface HeytingAlgebra<A> extends BoundedDistributiveLattice<A> {
|
||||
readonly implies: (x: A, y: A) => A
|
||||
readonly not: (x: A) => A
|
||||
}
|
||||
2
node_modules/fp-ts/lib/HeytingAlgebra.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/HeytingAlgebra.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
311
node_modules/fp-ts/lib/IO.d.ts
generated
vendored
Normal file
311
node_modules/fp-ts/lib/IO.d.ts
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
/**
|
||||
* ```ts
|
||||
* interface IO<A> {
|
||||
* (): A
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* `IO<A>` represents a non-deterministic synchronous computation that can cause side effects, yields a value of
|
||||
* type `A` and **never fails**.
|
||||
*
|
||||
* If you want to represent a synchronous computation that may fail, please see `IOEither`.
|
||||
* If you want to represent a synchronous computation that may yield nothing, please see `IOOption`.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Applicative1 } from './Applicative'
|
||||
import { Apply1 } from './Apply'
|
||||
import * as chainable from './Chain'
|
||||
import { ChainRec1 } from './ChainRec'
|
||||
import { FromIO1 } from './FromIO'
|
||||
import { Functor1 } from './Functor'
|
||||
import { Monad1 } from './Monad'
|
||||
import { MonadIO1 } from './MonadIO'
|
||||
import { Monoid } from './Monoid'
|
||||
import { Pointed1 } from './Pointed'
|
||||
import { ReadonlyNonEmptyArray } from './ReadonlyNonEmptyArray'
|
||||
import { Semigroup } from './Semigroup'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface IO<A> {
|
||||
(): A
|
||||
}
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const map: <A, B>(f: (a: A) => B) => (fa: IO<A>) => IO<B>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const ap: <A>(fa: IO<A>) => <B>(fab: IO<(a: A) => B>) => IO<B>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const of: <A>(a: A) => IO<A>
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.14.0
|
||||
*/
|
||||
export declare const flatMap: {
|
||||
<A, B>(f: (a: A) => IO<B>): (ma: IO<A>) => IO<B>
|
||||
<A, B>(ma: IO<A>, f: (a: A) => IO<B>): IO<B>
|
||||
}
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const flatten: <A>(mma: IO<IO<A>>) => IO<A>
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const URI = 'IO'
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type URI = typeof URI
|
||||
declare module './HKT' {
|
||||
interface URItoKind<A> {
|
||||
readonly [URI]: IO<A>
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Functor: Functor1<URI>
|
||||
/**
|
||||
* Maps the value to the specified constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const as: {
|
||||
<A>(a: A): <_>(self: IO<_>) => IO<A>
|
||||
<_, A>(self: IO<_>, a: A): IO<A>
|
||||
}
|
||||
/**
|
||||
* Maps the value to the void constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const asUnit: <_>(self: IO<_>) => IO<void>
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const flap: <A>(
|
||||
a: A
|
||||
) => <B>(fab: import('./HKT').Kind<'IO', (a: A) => B>) => import('./HKT').Kind<'IO', B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Pointed: Pointed1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Apply: Apply1<URI>
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the first.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const apFirst: <B>(
|
||||
second: IO<B>
|
||||
) => <A>(first: import('./HKT').Kind<'IO', A>) => import('./HKT').Kind<'IO', A>
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the second.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const apSecond: <B>(
|
||||
second: IO<B>
|
||||
) => <A>(first: import('./HKT').Kind<'IO', A>) => import('./HKT').Kind<'IO', B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Applicative: Applicative1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Chain: chainable.Chain1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Monad: Monad1<URI>
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.15.0
|
||||
*/
|
||||
export declare const tap: {
|
||||
<A, _>(self: IO<A>, f: (a: A) => IO<_>): IO<A>
|
||||
<A, _>(f: (a: A) => IO<_>): (self: IO<A>) => IO<A>
|
||||
}
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.7.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const fromIO: <A>(fa: IO<A>) => IO<A>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const MonadIO: MonadIO1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const ChainRec: ChainRec1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const FromIO: FromIO1<URI>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.9.0
|
||||
*/
|
||||
export declare const Do: IO<{}>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare const bindTo: <N extends string>(
|
||||
name: N
|
||||
) => <A>(fa: import('./HKT').Kind<'IO', A>) => import('./HKT').Kind<'IO', { readonly [K in N]: A }>
|
||||
declare const let_: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => (
|
||||
fa: import('./HKT').Kind<'IO', A>
|
||||
) => import('./HKT').Kind<'IO', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
export {
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.13.0
|
||||
*/
|
||||
let_ as let
|
||||
}
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare const bind: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => import('./HKT').Kind<'IO', B>
|
||||
) => (
|
||||
ma: import('./HKT').Kind<'IO', A>
|
||||
) => import('./HKT').Kind<'IO', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare const apS: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: IO<B>
|
||||
) => (
|
||||
fa: import('./HKT').Kind<'IO', A>
|
||||
) => import('./HKT').Kind<'IO', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare const ApT: IO<readonly []>
|
||||
/**
|
||||
* Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare const traverseReadonlyNonEmptyArrayWithIndex: <A, B>(
|
||||
f: (index: number, a: A) => IO<B>
|
||||
) => (as: ReadonlyNonEmptyArray<A>) => IO<ReadonlyNonEmptyArray<B>>
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.11.0
|
||||
*/
|
||||
export declare const traverseReadonlyArrayWithIndex: <A, B>(
|
||||
f: (index: number, a: A) => IO<B>
|
||||
) => (as: ReadonlyArray<A>) => IO<ReadonlyArray<B>>
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.9.0
|
||||
*/
|
||||
export declare const traverseArrayWithIndex: <A, B>(
|
||||
f: (index: number, a: A) => IO<B>
|
||||
) => (as: ReadonlyArray<A>) => IO<ReadonlyArray<B>>
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverse(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.9.0
|
||||
*/
|
||||
export declare const traverseArray: <A, B>(f: (a: A) => IO<B>) => (as: ReadonlyArray<A>) => IO<ReadonlyArray<B>>
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#sequence(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.9.0
|
||||
*/
|
||||
export declare const sequenceArray: <A>(arr: ReadonlyArray<IO<A>>) => IO<ReadonlyArray<A>>
|
||||
/**
|
||||
* Alias of `flatMap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const chain: <A, B>(f: (a: A) => IO<B>) => (ma: IO<A>) => IO<B>
|
||||
/**
|
||||
* Alias of `tap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const chainFirst: <A, B>(f: (a: A) => IO<B>) => (first: IO<A>) => IO<A>
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Functor` instance, pass `IO.Functor` instead of `IO.io`
|
||||
* (where `IO` is from `import IO from 'fp-ts/IO'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const io: Monad1<URI> & MonadIO1<URI> & ChainRec1<URI>
|
||||
/**
|
||||
* Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const getSemigroup: <A>(S: Semigroup<A>) => Semigroup<IO<A>>
|
||||
/**
|
||||
* Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const getMonoid: <A>(M: Monoid<A>) => Monoid<IO<A>>
|
||||
366
node_modules/fp-ts/lib/IO.js
generated
vendored
Normal file
366
node_modules/fp-ts/lib/IO.js
generated
vendored
Normal file
@@ -0,0 +1,366 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getMonoid = exports.getSemigroup = exports.io = exports.chainFirst = exports.chain = exports.sequenceArray = exports.traverseArray = exports.traverseArrayWithIndex = exports.traverseReadonlyArrayWithIndex = exports.traverseReadonlyNonEmptyArrayWithIndex = exports.ApT = exports.apS = exports.bind = exports.let = exports.bindTo = exports.Do = exports.FromIO = exports.ChainRec = exports.MonadIO = exports.fromIO = exports.tap = exports.Monad = exports.Chain = exports.Applicative = exports.apSecond = exports.apFirst = exports.Apply = exports.Pointed = exports.flap = exports.asUnit = exports.as = exports.Functor = exports.URI = exports.flatten = exports.flatMap = exports.of = exports.ap = exports.map = void 0;
|
||||
/**
|
||||
* ```ts
|
||||
* interface IO<A> {
|
||||
* (): A
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* `IO<A>` represents a non-deterministic synchronous computation that can cause side effects, yields a value of
|
||||
* type `A` and **never fails**.
|
||||
*
|
||||
* If you want to represent a synchronous computation that may fail, please see `IOEither`.
|
||||
* If you want to represent a synchronous computation that may yield nothing, please see `IOOption`.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var Applicative_1 = require("./Applicative");
|
||||
var Apply_1 = require("./Apply");
|
||||
var chainable = __importStar(require("./Chain"));
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
var _ = __importStar(require("./internal"));
|
||||
var _map = function (ma, f) { return function () { return f(ma()); }; };
|
||||
var _ap = function (mab, ma) { return function () { return mab()(ma()); }; };
|
||||
var _chainRec = function (a, f) { return function () {
|
||||
var e = f(a)();
|
||||
while (e._tag === 'Left') {
|
||||
e = f(e.left)();
|
||||
}
|
||||
return e.right;
|
||||
}; };
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var map = function (f) { return function (fa) { return _map(fa, f); }; };
|
||||
exports.map = map;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var ap = function (fa) { return function (fab) { return _ap(fab, fa); }; };
|
||||
exports.ap = ap;
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.of = function_1.constant;
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.14.0
|
||||
*/
|
||||
exports.flatMap = (0, function_1.dual)(2, function (ma, f) {
|
||||
return function () {
|
||||
return f(ma())();
|
||||
};
|
||||
});
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.flatten = (0, exports.flatMap)(function_1.identity);
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.URI = 'IO';
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Functor = {
|
||||
URI: exports.URI,
|
||||
map: _map
|
||||
};
|
||||
/**
|
||||
* Maps the value to the specified constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.as = (0, function_1.dual)(2, (0, Functor_1.as)(exports.Functor));
|
||||
/**
|
||||
* Maps the value to the void constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.asUnit = (0, Functor_1.asUnit)(exports.Functor);
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.flap = (0, Functor_1.flap)(exports.Functor);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Pointed = {
|
||||
URI: exports.URI,
|
||||
of: exports.of
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Apply = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap
|
||||
};
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the first.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.apFirst = (0, Apply_1.apFirst)(exports.Apply);
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the second.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.apSecond = (0, Apply_1.apSecond)(exports.Apply);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Applicative = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Chain = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
chain: exports.flatMap
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Monad = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
chain: exports.flatMap
|
||||
};
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.15.0
|
||||
*/
|
||||
exports.tap = (0, function_1.dual)(2, chainable.tap(exports.Chain));
|
||||
/**
|
||||
* @category zone of death
|
||||
* @since 2.7.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.fromIO = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.MonadIO = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
chain: exports.flatMap,
|
||||
fromIO: exports.fromIO
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.ChainRec = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
chain: exports.flatMap,
|
||||
chainRec: _chainRec
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.FromIO = {
|
||||
URI: exports.URI,
|
||||
fromIO: function_1.identity
|
||||
};
|
||||
// -------------------------------------------------------------------------------------
|
||||
// do notation
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.9.0
|
||||
*/
|
||||
exports.Do = (0, exports.of)(_.emptyRecord);
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
exports.bindTo = (0, Functor_1.bindTo)(exports.Functor);
|
||||
var let_ = /*#__PURE__*/ (0, Functor_1.let)(exports.Functor);
|
||||
exports.let = let_;
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
exports.bind = chainable.bind(exports.Chain);
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
exports.apS = (0, Apply_1.apS)(exports.Apply);
|
||||
/**
|
||||
* @since 2.11.0
|
||||
*/
|
||||
exports.ApT = (0, exports.of)(_.emptyReadonlyArray);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// array utils
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.11.0
|
||||
*/
|
||||
var traverseReadonlyNonEmptyArrayWithIndex = function (f) {
|
||||
return function (as) {
|
||||
return function () {
|
||||
var out = [f(0, _.head(as))()];
|
||||
for (var i = 1; i < as.length; i++) {
|
||||
out.push(f(i, as[i])());
|
||||
}
|
||||
return out;
|
||||
};
|
||||
};
|
||||
};
|
||||
exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex;
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.11.0
|
||||
*/
|
||||
var traverseReadonlyArrayWithIndex = function (f) {
|
||||
var g = (0, exports.traverseReadonlyNonEmptyArrayWithIndex)(f);
|
||||
return function (as) { return (_.isNonEmpty(as) ? g(as) : exports.ApT); };
|
||||
};
|
||||
exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex;
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.9.0
|
||||
*/
|
||||
exports.traverseArrayWithIndex = exports.traverseReadonlyArrayWithIndex;
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverse(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.9.0
|
||||
*/
|
||||
var traverseArray = function (f) {
|
||||
return (0, exports.traverseReadonlyArrayWithIndex)(function (_, a) { return f(a); });
|
||||
};
|
||||
exports.traverseArray = traverseArray;
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#sequence(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.9.0
|
||||
*/
|
||||
exports.sequenceArray =
|
||||
/*#__PURE__*/ (0, exports.traverseArray)(function_1.identity);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// legacy
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Alias of `flatMap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.chain = exports.flatMap;
|
||||
/**
|
||||
* Alias of `tap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.chainFirst = exports.tap;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Functor` instance, pass `IO.Functor` instead of `IO.io`
|
||||
* (where `IO` is from `import IO from 'fp-ts/IO'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.io = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
of: exports.of,
|
||||
ap: _ap,
|
||||
chain: exports.flatMap,
|
||||
fromIO: exports.fromIO,
|
||||
chainRec: _chainRec
|
||||
};
|
||||
/**
|
||||
* Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.getSemigroup = (0, Apply_1.getApplySemigroup)(exports.Apply);
|
||||
/**
|
||||
* Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.getMonoid = (0, Applicative_1.getApplicativeMonoid)(exports.Applicative);
|
||||
1042
node_modules/fp-ts/lib/IOEither.d.ts
generated
vendored
Normal file
1042
node_modules/fp-ts/lib/IOEither.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1102
node_modules/fp-ts/lib/IOEither.js
generated
vendored
Normal file
1102
node_modules/fp-ts/lib/IOEither.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
616
node_modules/fp-ts/lib/IOOption.d.ts
generated
vendored
Normal file
616
node_modules/fp-ts/lib/IOOption.d.ts
generated
vendored
Normal file
@@ -0,0 +1,616 @@
|
||||
/**
|
||||
* `IOOption<A>` represents a synchronous computation that either yields a value of type `A` or nothing.
|
||||
*
|
||||
* If you want to represent a synchronous computation that never fails, please see `IO`.
|
||||
* If you want to represent a synchronous computation that may fail, please see `IOEither`.
|
||||
*
|
||||
* @since 2.12.0
|
||||
*/
|
||||
import { Alt1 } from './Alt'
|
||||
import { Alternative1 } from './Alternative'
|
||||
import { Applicative1 } from './Applicative'
|
||||
import { Apply1 } from './Apply'
|
||||
import * as chainable from './Chain'
|
||||
import { Compactable1 } from './Compactable'
|
||||
import { Either } from './Either'
|
||||
import { Filterable1 } from './Filterable'
|
||||
import { FromEither1 } from './FromEither'
|
||||
import { FromIO1 } from './FromIO'
|
||||
import { LazyArg } from './function'
|
||||
import { Functor1 } from './Functor'
|
||||
import * as I from './IO'
|
||||
import { IOEither } from './IOEither'
|
||||
import { Monad1 } from './Monad'
|
||||
import { MonadIO1 } from './MonadIO'
|
||||
import * as O from './Option'
|
||||
import { Pointed1 } from './Pointed'
|
||||
import { Predicate } from './Predicate'
|
||||
import { ReadonlyNonEmptyArray } from './ReadonlyNonEmptyArray'
|
||||
import { Refinement } from './Refinement'
|
||||
import { Separated } from './Separated'
|
||||
import { Zero1 } from './Zero'
|
||||
import IO = I.IO
|
||||
import Option = O.Option
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export interface IOOption<A> extends IO<Option<A>> {}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const some: <A>(a: A) => IOOption<A>
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromPredicate: {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (a: A) => IOOption<B>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(b: B) => IOOption<B>
|
||||
<A>(predicate: Predicate<A>): (a: A) => IOOption<A>
|
||||
}
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromOption: <A>(fa: Option<A>) => IOOption<A>
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromEither: <A>(fa: Either<unknown, A>) => IOOption<A>
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromIO: <A>(fa: IO<A>) => IOOption<A>
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromIOEither: <A>(fa: IOEither<unknown, A>) => IOOption<A>
|
||||
/**
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const match: <B, A>(onNone: () => B, onSome: (a: A) => B) => (ma: IOOption<A>) => IO<B>
|
||||
/**
|
||||
* Less strict version of [`match`](#match).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the handler return types will be merged.
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const matchW: <B, A, C>(onNone: () => B, onSome: (a: A) => C) => (ma: IOOption<A>) => IO<B | C>
|
||||
/**
|
||||
* The `E` suffix (short for **E**ffect) means that the handlers return an effect (`IO`).
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const matchE: <B, A>(onNone: () => IO<B>, onSome: (a: A) => IO<B>) => (ma: IOOption<A>) => IO<B>
|
||||
/**
|
||||
* Alias of [`matchE`](#matche).
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fold: <B, A>(onNone: () => IO<B>, onSome: (a: A) => IO<B>) => (ma: IOOption<A>) => IO<B>
|
||||
/**
|
||||
* Less strict version of [`matchE`](#matche).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the handler return types will be merged.
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const matchEW: <B, C, A>(onNone: () => IO<B>, onSome: (a: A) => IO<C>) => (ma: IOOption<A>) => IO<B | C>
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const getOrElse: <A>(onNone: LazyArg<IO<A>>) => (fa: IOOption<A>) => IO<A>
|
||||
/**
|
||||
* Less strict version of [`getOrElse`](#getorelse).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the handler return type will be merged.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const getOrElseW: <B>(onNone: LazyArg<IO<B>>) => <A>(ma: IOOption<A>) => IO<A | B>
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const toUndefined: <A>(ma: IOOption<A>) => IO<A | undefined>
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const toNullable: <A>(ma: IOOption<A>) => IO<A | null>
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromNullable: <A>(a: A) => IOOption<NonNullable<A>>
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromNullableK: <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => B | null | undefined
|
||||
) => (...a: A) => IOOption<NonNullable<B>>
|
||||
/**
|
||||
* Alias of `flatMapNullable`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainNullableK: <A, B>(
|
||||
f: (a: A) => B | null | undefined
|
||||
) => (ma: IOOption<A>) => IOOption<NonNullable<B>>
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromOptionK: <A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => Option<B>
|
||||
) => (...a: A) => IOOption<B>
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const map: <A, B>(f: (a: A) => B) => (fa: IOOption<A>) => IOOption<B>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const ap: <A>(fa: IOOption<A>) => <B>(fab: IOOption<(a: A) => B>) => IOOption<B>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const of: <A>(a: A) => IOOption<A>
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.14.0
|
||||
*/
|
||||
export declare const flatMap: {
|
||||
<A, B>(f: (a: A) => IOOption<B>): (ma: IOOption<A>) => IOOption<B>
|
||||
<A, B>(ma: IOOption<A>, f: (a: A) => IOOption<B>): IOOption<B>
|
||||
}
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const flatten: <A>(mma: IOOption<IOOption<A>>) => IOOption<A>
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const alt: <A>(second: LazyArg<IOOption<A>>) => (first: IOOption<A>) => IOOption<A>
|
||||
/**
|
||||
* Less strict version of [`alt`](#alt).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the return types will be merged.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const altW: <B>(second: LazyArg<IOOption<B>>) => <A>(first: IOOption<A>) => IOOption<A | B>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const zero: <A>() => IOOption<A>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const none: IOOption<never>
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const compact: Compactable1<URI>['compact']
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const separate: Compactable1<URI>['separate']
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const filter: {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (fb: IOOption<A>) => IOOption<B>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(fb: IOOption<B>) => IOOption<B>
|
||||
<A>(predicate: Predicate<A>): (fa: IOOption<A>) => IOOption<A>
|
||||
}
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const filterMap: <A, B>(f: (a: A) => Option<B>) => (fga: IOOption<A>) => IOOption<B>
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const partition: {
|
||||
<A, B extends A>(refinement: Refinement<A, B>): (fb: IOOption<A>) => Separated<IOOption<A>, IOOption<B>>
|
||||
<A>(predicate: Predicate<A>): <B extends A>(fb: IOOption<B>) => Separated<IOOption<B>, IOOption<B>>
|
||||
<A>(predicate: Predicate<A>): (fa: IOOption<A>) => Separated<IOOption<A>, IOOption<A>>
|
||||
}
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const partitionMap: <A, B, C>(
|
||||
f: (a: A) => Either<B, C>
|
||||
) => (fa: IOOption<A>) => Separated<IOOption<B>, IOOption<C>>
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const URI = 'IOOption'
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export type URI = typeof URI
|
||||
declare module './HKT' {
|
||||
interface URItoKind<A> {
|
||||
readonly [URI]: IOOption<A>
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Functor: Functor1<URI>
|
||||
/**
|
||||
* Maps the `Some` value of this `IOOption` to the specified constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const as: {
|
||||
<A>(a: A): <_>(self: IOOption<_>) => IOOption<A>
|
||||
<_, A>(self: IOOption<_>, a: A): IOOption<A>
|
||||
}
|
||||
/**
|
||||
* Maps the `Some` value of this `IOOption` to the void constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const asUnit: <_>(self: IOOption<_>) => IOOption<void>
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const flap: <A>(
|
||||
a: A
|
||||
) => <B>(fab: import('./HKT').Kind<'IOOption', (a: A) => B>) => import('./HKT').Kind<'IOOption', B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Pointed: Pointed1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Apply: Apply1<URI>
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the first.
|
||||
*
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const apFirst: <B>(
|
||||
second: IOOption<B>
|
||||
) => <A>(first: import('./HKT').Kind<'IOOption', A>) => import('./HKT').Kind<'IOOption', A>
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the second.
|
||||
*
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const apSecond: <B>(
|
||||
second: IOOption<B>
|
||||
) => <A>(first: import('./HKT').Kind<'IOOption', A>) => import('./HKT').Kind<'IOOption', B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Applicative: Applicative1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Chain: chainable.Chain1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const FromEither: FromEither1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const FromIO: FromIO1<URI>
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.15.0
|
||||
*/
|
||||
export declare const tap: {
|
||||
<A, _>(self: IOOption<A>, f: (a: A) => IOOption<_>): IOOption<A>
|
||||
<A, _>(f: (a: A) => IOOption<_>): (self: IOOption<A>) => IOOption<A>
|
||||
}
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @example
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
* import * as IOO from 'fp-ts/IOOption'
|
||||
* import * as O from 'fp-ts/Option'
|
||||
* import * as E from 'fp-ts/Either'
|
||||
*
|
||||
* const compute = (value: number) => pipe(
|
||||
* IOO.of(value),
|
||||
* IOO.tapEither((value) => value > 0 ? E.right('ok') : E.left('error')),
|
||||
* )
|
||||
*
|
||||
* assert.deepStrictEqual(compute(1)(), O.of(1))
|
||||
* assert.deepStrictEqual(compute(-1)(), O.none)
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const tapEither: {
|
||||
<A, E, _>(f: (a: A) => Either<E, _>): (self: IOOption<A>) => IOOption<A>
|
||||
<A, E, _>(self: IOOption<A>, f: (a: A) => Either<E, _>): IOOption<A>
|
||||
}
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @example
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
* import * as IOO from 'fp-ts/IOOption'
|
||||
* import * as O from 'fp-ts/Option'
|
||||
* import * as Console from 'fp-ts/Console'
|
||||
*
|
||||
* // Will produce `Hello, fp-ts` to the stdout
|
||||
* const effectA = pipe(
|
||||
* IOO.of('fp-ts'),
|
||||
* IOO.tapIO((value) => Console.log(`Hello, ${value}`)),
|
||||
* )
|
||||
*
|
||||
* // No output to the stdout
|
||||
* const effectB = pipe(
|
||||
* IOO.none as IOO.IOOption<string>,
|
||||
* IOO.tapIO((value) => Console.log(`Hello, ${value}`)),
|
||||
* )
|
||||
*
|
||||
* async function test() {
|
||||
* assert.deepStrictEqual(effectA(), O.of('fp-ts'))
|
||||
* assert.deepStrictEqual(effectB(), O.none)
|
||||
* }
|
||||
*
|
||||
* test()
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const tapIO: {
|
||||
<A, _>(f: (a: A) => IO<_>): (self: IOOption<A>) => IOOption<A>
|
||||
<A, _>(self: IOOption<A>, f: (a: A) => IO<_>): IOOption<A>
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Alt: Alt1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Zero: Zero1<URI>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const guard: (b: boolean) => import('./HKT').Kind<'IOOption', void>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Alternative: Alternative1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Monad: Monad1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const MonadIO: MonadIO1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Compactable: Compactable1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Filterable: Filterable1<URI>
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const flatMapIO: {
|
||||
<A, B>(f: (a: A) => IO<B>): (self: IOOption<A>) => IOOption<B>
|
||||
<A, B>(self: IOOption<A>, f: (a: A) => IO<B>): IOOption<B>
|
||||
}
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const flatMapOption: {
|
||||
<A, B>(f: (a: A) => Option<B>): (self: IOOption<A>) => IOOption<B>
|
||||
<A, B>(self: IOOption<A>, f: (a: A) => Option<B>): IOOption<B>
|
||||
}
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const flatMapEither: {
|
||||
<A, B, _>(f: (a: A) => Either<_, B>): (self: IOOption<A>) => IOOption<B>
|
||||
<A, B, _>(self: IOOption<A>, f: (a: A) => Either<_, B>): IOOption<B>
|
||||
}
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
export declare const flatMapNullable: {
|
||||
<A, B>(f: (a: A) => B | null | undefined): (self: IOOption<A>) => IOOption<B>
|
||||
<A, B>(self: IOOption<A>, f: (a: A) => B | null | undefined): IOOption<B>
|
||||
}
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromIOK: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => I.IO<B>) => (...a: A) => IOOption<B>
|
||||
/**
|
||||
* Alias of `flatMapIO`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainIOK: <A, B>(f: (a: A) => I.IO<B>) => (first: IOOption<A>) => IOOption<B>
|
||||
/**
|
||||
* Alias of `tapIO`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainFirstIOK: <A, B>(f: (a: A) => I.IO<B>) => (first: IOOption<A>) => IOOption<A>
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const fromEitherK: <E, A extends ReadonlyArray<unknown>, B>(
|
||||
f: (...a: A) => Either<E, B>
|
||||
) => (...a: A) => IOOption<B>
|
||||
/**
|
||||
* Alias of `flatMapEither`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainEitherK: <E, A, B>(f: (a: A) => Either<E, B>) => (ma: IOOption<A>) => IOOption<B>
|
||||
/**
|
||||
* Alias of `tapEither`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainFirstEitherK: <E, A, B>(f: (a: A) => Either<E, B>) => (ma: IOOption<A>) => IOOption<A>
|
||||
/**
|
||||
* Alias of `flatMapOption`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainOptionK: <A, B>(f: (a: A) => Option<B>) => (ma: IOOption<A>) => IOOption<B>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const Do: IOOption<{}>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const bindTo: <N extends string>(
|
||||
name: N
|
||||
) => <A>(fa: import('./HKT').Kind<'IOOption', A>) => import('./HKT').Kind<'IOOption', { readonly [K in N]: A }>
|
||||
declare const let_: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => (
|
||||
fa: import('./HKT').Kind<'IOOption', A>
|
||||
) => import('./HKT').Kind<'IOOption', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
export {
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.13.0
|
||||
*/
|
||||
let_ as let
|
||||
}
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const bind: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => import('./HKT').Kind<'IOOption', B>
|
||||
) => (
|
||||
ma: import('./HKT').Kind<'IOOption', A>
|
||||
) => import('./HKT').Kind<'IOOption', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const apS: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: IOOption<B>
|
||||
) => (
|
||||
fa: import('./HKT').Kind<'IOOption', A>
|
||||
) => import('./HKT').Kind<'IOOption', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const ApT: IOOption<readonly []>
|
||||
/**
|
||||
* Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const traverseReadonlyNonEmptyArrayWithIndex: <A, B>(
|
||||
f: (index: number, a: A) => IOOption<B>
|
||||
) => (as: ReadonlyNonEmptyArray<A>) => IOOption<ReadonlyNonEmptyArray<B>>
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const traverseReadonlyArrayWithIndex: <A, B>(
|
||||
f: (index: number, a: A) => IOOption<B>
|
||||
) => (as: ReadonlyArray<A>) => IOOption<ReadonlyArray<B>>
|
||||
/**
|
||||
* Alias of `flatMap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chain: <A, B>(f: (a: A) => IOOption<B>) => (ma: IOOption<A>) => IOOption<B>
|
||||
/**
|
||||
* Alias of `tap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
export declare const chainFirst: <A, B>(f: (a: A) => IOOption<B>) => (first: IOOption<A>) => IOOption<A>
|
||||
650
node_modules/fp-ts/lib/IOOption.js
generated
vendored
Normal file
650
node_modules/fp-ts/lib/IOOption.js
generated
vendored
Normal file
@@ -0,0 +1,650 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tapIO = exports.tapEither = exports.tap = exports.FromIO = exports.FromEither = exports.Chain = exports.Applicative = exports.apSecond = exports.apFirst = exports.Apply = exports.Pointed = exports.flap = exports.asUnit = exports.as = exports.Functor = exports.URI = exports.partitionMap = exports.partition = exports.filterMap = exports.filter = exports.separate = exports.compact = exports.none = exports.zero = exports.altW = exports.alt = exports.flatten = exports.flatMap = exports.of = exports.ap = exports.map = exports.fromOptionK = exports.chainNullableK = exports.fromNullableK = exports.fromNullable = exports.toNullable = exports.toUndefined = exports.getOrElseW = exports.getOrElse = exports.matchEW = exports.fold = exports.matchE = exports.matchW = exports.match = exports.fromIOEither = exports.fromIO = exports.fromEither = exports.fromOption = exports.fromPredicate = exports.some = void 0;
|
||||
exports.chainFirst = exports.chain = exports.traverseReadonlyArrayWithIndex = exports.traverseReadonlyNonEmptyArrayWithIndex = exports.ApT = exports.apS = exports.bind = exports.let = exports.bindTo = exports.Do = exports.chainOptionK = exports.chainFirstEitherK = exports.chainEitherK = exports.fromEitherK = exports.chainFirstIOK = exports.chainIOK = exports.fromIOK = exports.flatMapNullable = exports.flatMapEither = exports.flatMapOption = exports.flatMapIO = exports.Filterable = exports.Compactable = exports.MonadIO = exports.Monad = exports.Alternative = exports.guard = exports.Zero = exports.Alt = void 0;
|
||||
var Apply_1 = require("./Apply");
|
||||
var chainable = __importStar(require("./Chain"));
|
||||
var Compactable_1 = require("./Compactable");
|
||||
var Filterable_1 = require("./Filterable");
|
||||
var FromEither_1 = require("./FromEither");
|
||||
var FromIO_1 = require("./FromIO");
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
var _ = __importStar(require("./internal"));
|
||||
var I = __importStar(require("./IO"));
|
||||
var O = __importStar(require("./Option"));
|
||||
var OT = __importStar(require("./OptionT"));
|
||||
var Zero_1 = require("./Zero");
|
||||
// -------------------------------------------------------------------------------------
|
||||
// constructors
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.some = OT.some(I.Pointed);
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromPredicate = OT.fromPredicate(I.Pointed);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// conversions
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromOption = I.of;
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromEither = OT.fromEither(I.Pointed);
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromIO = OT.fromF(I.Functor);
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromIOEither = I.map(O.fromEither);
|
||||
/**
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.match = OT.match(I.Functor);
|
||||
/**
|
||||
* Less strict version of [`match`](#match).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the handler return types will be merged.
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.matchW = exports.match;
|
||||
/**
|
||||
* The `E` suffix (short for **E**ffect) means that the handlers return an effect (`IO`).
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.matchE =
|
||||
/*#__PURE__*/ OT.matchE(I.Chain);
|
||||
/**
|
||||
* Alias of [`matchE`](#matche).
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fold = exports.matchE;
|
||||
/**
|
||||
* Less strict version of [`matchE`](#matche).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the handler return types will be merged.
|
||||
*
|
||||
* @category pattern matching
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.matchEW = exports.matchE;
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.getOrElse = OT.getOrElse(I.Monad);
|
||||
/**
|
||||
* Less strict version of [`getOrElse`](#getorelse).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the handler return type will be merged.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.getOrElseW = exports.getOrElse;
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.toUndefined = I.map(O.toUndefined);
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.toNullable = I.map(O.toNullable);
|
||||
/**
|
||||
* @category conversions
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromNullable = OT.fromNullable(I.Pointed);
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromNullableK = OT.fromNullableK(I.Pointed);
|
||||
/**
|
||||
* Alias of `flatMapNullable`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainNullableK = OT.chainNullableK(I.Monad);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// combinators
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromOptionK =
|
||||
/*#__PURE__*/ OT.fromOptionK(I.Pointed);
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.map = OT.map(I.Functor);
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.ap = OT.ap(I.Apply);
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.of = exports.some;
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.14.0
|
||||
*/
|
||||
exports.flatMap = (0, function_1.dual)(2, OT.flatMap(I.Monad));
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.flatten = (0, exports.flatMap)(function_1.identity);
|
||||
/**
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.alt = OT.alt(I.Monad);
|
||||
/**
|
||||
* Less strict version of [`alt`](#alt).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the return types will be merged.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.altW = exports.alt;
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.zero = OT.zero(I.Pointed);
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.none = (0, exports.zero)();
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.compact = (0, Compactable_1.compact)(I.Functor, O.Compactable);
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.separate = (0, Compactable_1.separate)(I.Functor, O.Compactable, O.Functor);
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.filter = (0, Filterable_1.filter)(I.Functor, O.Filterable);
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.filterMap = (0, Filterable_1.filterMap)(I.Functor, O.Filterable);
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.partition = (0, Filterable_1.partition)(I.Functor, O.Filterable);
|
||||
/**
|
||||
* @category filtering
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.partitionMap = (0, Filterable_1.partitionMap)(I.Functor, O.Filterable);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// instances
|
||||
// -------------------------------------------------------------------------------------
|
||||
var _map = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.map)(f)); };
|
||||
/* istanbul ignore next */
|
||||
var _ap = function (fab, fa) { return (0, function_1.pipe)(fab, (0, exports.ap)(fa)); };
|
||||
/* istanbul ignore next */
|
||||
var _alt = function (fa, that) { return (0, function_1.pipe)(fa, (0, exports.alt)(that)); };
|
||||
/* istanbul ignore next */
|
||||
var _filter = function (fa, predicate) { return (0, function_1.pipe)(fa, (0, exports.filter)(predicate)); };
|
||||
/* istanbul ignore next */
|
||||
var _filterMap = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.filterMap)(f)); };
|
||||
/* istanbul ignore next */
|
||||
var _partition = function (fa, predicate) {
|
||||
return (0, function_1.pipe)(fa, (0, exports.partition)(predicate));
|
||||
};
|
||||
/* istanbul ignore next */
|
||||
var _partitionMap = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.partitionMap)(f)); };
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.URI = 'IOOption';
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Functor = {
|
||||
URI: exports.URI,
|
||||
map: _map
|
||||
};
|
||||
/**
|
||||
* Maps the `Some` value of this `IOOption` to the specified constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.as = (0, function_1.dual)(2, (0, Functor_1.as)(exports.Functor));
|
||||
/**
|
||||
* Maps the `Some` value of this `IOOption` to the void constant value.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.asUnit = (0, Functor_1.asUnit)(exports.Functor);
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.flap = (0, Functor_1.flap)(exports.Functor);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Pointed = {
|
||||
URI: exports.URI,
|
||||
of: exports.of
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Apply = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap
|
||||
};
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the first.
|
||||
*
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.apFirst = (0, Apply_1.apFirst)(exports.Apply);
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the second.
|
||||
*
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.apSecond = (0, Apply_1.apSecond)(exports.Apply);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Applicative = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Chain = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
chain: exports.flatMap
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.FromEither = {
|
||||
URI: exports.URI,
|
||||
fromEither: exports.fromEither
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.FromIO = {
|
||||
URI: exports.URI,
|
||||
fromIO: exports.fromIO
|
||||
};
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.15.0
|
||||
*/
|
||||
exports.tap = (0, function_1.dual)(2, chainable.tap(exports.Chain));
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @example
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
* import * as IOO from 'fp-ts/IOOption'
|
||||
* import * as O from 'fp-ts/Option'
|
||||
* import * as E from 'fp-ts/Either'
|
||||
*
|
||||
* const compute = (value: number) => pipe(
|
||||
* IOO.of(value),
|
||||
* IOO.tapEither((value) => value > 0 ? E.right('ok') : E.left('error')),
|
||||
* )
|
||||
*
|
||||
* assert.deepStrictEqual(compute(1)(), O.of(1))
|
||||
* assert.deepStrictEqual(compute(-1)(), O.none)
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.tapEither = (0, function_1.dual)(2, (0, FromEither_1.tapEither)(exports.FromEither, exports.Chain));
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @example
|
||||
* import { pipe } from 'fp-ts/function'
|
||||
* import * as IOO from 'fp-ts/IOOption'
|
||||
* import * as O from 'fp-ts/Option'
|
||||
* import * as Console from 'fp-ts/Console'
|
||||
*
|
||||
* // Will produce `Hello, fp-ts` to the stdout
|
||||
* const effectA = pipe(
|
||||
* IOO.of('fp-ts'),
|
||||
* IOO.tapIO((value) => Console.log(`Hello, ${value}`)),
|
||||
* )
|
||||
*
|
||||
* // No output to the stdout
|
||||
* const effectB = pipe(
|
||||
* IOO.none as IOO.IOOption<string>,
|
||||
* IOO.tapIO((value) => Console.log(`Hello, ${value}`)),
|
||||
* )
|
||||
*
|
||||
* async function test() {
|
||||
* assert.deepStrictEqual(effectA(), O.of('fp-ts'))
|
||||
* assert.deepStrictEqual(effectB(), O.none)
|
||||
* }
|
||||
*
|
||||
* test()
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.tapIO = (0, function_1.dual)(2, (0, FromIO_1.tapIO)(exports.FromIO, exports.Chain));
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Alt = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
alt: _alt
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Zero = {
|
||||
URI: exports.URI,
|
||||
zero: exports.zero
|
||||
};
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.guard = (0, Zero_1.guard)(exports.Zero, exports.Pointed);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Alternative = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
alt: _alt,
|
||||
zero: exports.zero
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Monad = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
chain: exports.flatMap
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.MonadIO = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
chain: exports.flatMap,
|
||||
fromIO: exports.fromIO
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Compactable = {
|
||||
URI: exports.URI,
|
||||
compact: exports.compact,
|
||||
separate: exports.separate
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Filterable = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
compact: exports.compact,
|
||||
separate: exports.separate,
|
||||
filter: _filter,
|
||||
filterMap: _filterMap,
|
||||
partition: _partition,
|
||||
partitionMap: _partitionMap
|
||||
};
|
||||
/** @internal */
|
||||
var _FlatMap = {
|
||||
flatMap: exports.flatMap
|
||||
};
|
||||
/** @internal */
|
||||
var _FromIO = {
|
||||
fromIO: exports.FromIO.fromIO
|
||||
};
|
||||
/** @internal */
|
||||
var _FromEither = {
|
||||
fromEither: exports.fromEither
|
||||
};
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.flatMapIO = _.flatMapIO(_FromIO, _FlatMap);
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.flatMapOption = (0, function_1.dual)(2, function (self, f) { return (0, exports.flatMap)(self, (0, exports.fromOptionK)(f)); });
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.flatMapEither = _.flatMapEither(_FromEither, _FlatMap);
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.16.0
|
||||
*/
|
||||
exports.flatMapNullable = (0, function_1.dual)(2, function (self, f) { return (0, exports.flatMap)(self, (0, exports.fromNullableK)(f)); });
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromIOK =
|
||||
/*#__PURE__*/ (0, FromIO_1.fromIOK)(exports.FromIO);
|
||||
/**
|
||||
* Alias of `flatMapIO`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainIOK = exports.flatMapIO;
|
||||
/**
|
||||
* Alias of `tapIO`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainFirstIOK = exports.tapIO;
|
||||
/**
|
||||
* @category lifting
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.fromEitherK = (0, FromEither_1.fromEitherK)(exports.FromEither);
|
||||
/**
|
||||
* Alias of `flatMapEither`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainEitherK = exports.flatMapEither;
|
||||
/**
|
||||
* Alias of `tapEither`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainFirstEitherK = exports.tapEither;
|
||||
/**
|
||||
* Alias of `flatMapOption`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainOptionK = exports.flatMapOption;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// do notation
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.Do = (0, exports.of)(_.emptyRecord);
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.bindTo = (0, Functor_1.bindTo)(exports.Functor);
|
||||
var let_ = /*#__PURE__*/ (0, Functor_1.let)(exports.Functor);
|
||||
exports.let = let_;
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.bind = chainable.bind(exports.Chain);
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.apS = (0, Apply_1.apS)(exports.Apply);
|
||||
/**
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.ApT = (0, exports.of)(_.emptyReadonlyArray);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// array utils
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.12.0
|
||||
*/
|
||||
var traverseReadonlyNonEmptyArrayWithIndex = function (f) {
|
||||
return (0, function_1.flow)(I.traverseReadonlyNonEmptyArrayWithIndex(f), I.map(O.traverseReadonlyNonEmptyArrayWithIndex(function_1.SK)));
|
||||
};
|
||||
exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex;
|
||||
/**
|
||||
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
||||
*
|
||||
* @category traversing
|
||||
* @since 2.12.0
|
||||
*/
|
||||
var traverseReadonlyArrayWithIndex = function (f) {
|
||||
var g = (0, exports.traverseReadonlyNonEmptyArrayWithIndex)(f);
|
||||
return function (as) { return (_.isNonEmpty(as) ? g(as) : exports.ApT); };
|
||||
};
|
||||
exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// legacy
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Alias of `flatMap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chain = exports.flatMap;
|
||||
/**
|
||||
* Alias of `tap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.12.0
|
||||
*/
|
||||
exports.chainFirst = exports.tap;
|
||||
37
node_modules/fp-ts/lib/IORef.d.ts
generated
vendored
Normal file
37
node_modules/fp-ts/lib/IORef.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Mutable references in the `IO` monad
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { IO } from './IO'
|
||||
/**
|
||||
* @example
|
||||
* import { flatMap } from 'fp-ts/IO'
|
||||
* import { newIORef } from 'fp-ts/IORef'
|
||||
*
|
||||
* assert.strictEqual(flatMap(newIORef(1), ref => flatMap(ref.write(2), () => ref.read))(), 2)
|
||||
*
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare class IORef<A> {
|
||||
private value
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
readonly read: IO<A>
|
||||
constructor(value: A)
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
write(a: A): IO<void>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
modify(f: (a: A) => A): IO<void>
|
||||
}
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function newIORef<A>(a: A): IO<IORef<A>>
|
||||
50
node_modules/fp-ts/lib/IORef.js
generated
vendored
Normal file
50
node_modules/fp-ts/lib/IORef.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IORef = void 0;
|
||||
exports.newIORef = newIORef;
|
||||
/**
|
||||
* @example
|
||||
* import { flatMap } from 'fp-ts/IO'
|
||||
* import { newIORef } from 'fp-ts/IORef'
|
||||
*
|
||||
* assert.strictEqual(flatMap(newIORef(1), ref => flatMap(ref.write(2), () => ref.read))(), 2)
|
||||
*
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var IORef = /** @class */ (function () {
|
||||
function IORef(value) {
|
||||
var _this = this;
|
||||
this.value = value;
|
||||
this.read = function () { return _this.value; };
|
||||
this.write = this.write.bind(this);
|
||||
this.modify = this.modify.bind(this);
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
IORef.prototype.write = function (a) {
|
||||
var _this = this;
|
||||
return function () {
|
||||
_this.value = a;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
IORef.prototype.modify = function (f) {
|
||||
var _this = this;
|
||||
return function () {
|
||||
_this.value = f(_this.value);
|
||||
};
|
||||
};
|
||||
return IORef;
|
||||
}());
|
||||
exports.IORef = IORef;
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function newIORef(a) {
|
||||
return function () { return new IORef(a); };
|
||||
}
|
||||
295
node_modules/fp-ts/lib/Identity.d.ts
generated
vendored
Normal file
295
node_modules/fp-ts/lib/Identity.d.ts
generated
vendored
Normal file
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { Alt1 } from './Alt'
|
||||
import { Applicative1 } from './Applicative'
|
||||
import { Apply1 } from './Apply'
|
||||
import { Chain1 } from './Chain'
|
||||
import { ChainRec1 } from './ChainRec'
|
||||
import { Comonad1 } from './Comonad'
|
||||
import { Eq } from './Eq'
|
||||
import { Foldable1 } from './Foldable'
|
||||
import { Functor1 } from './Functor'
|
||||
import { Monad1 } from './Monad'
|
||||
import { Monoid } from './Monoid'
|
||||
import { Pointed1 } from './Pointed'
|
||||
import { Show } from './Show'
|
||||
import { PipeableTraverse1, Traversable1 } from './Traversable'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type Identity<A> = A
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const map: <A, B>(f: (a: A) => B) => (fa: Identity<A>) => Identity<B>
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const ap: <A>(fa: Identity<A>) => <B>(fab: Identity<(a: A) => B>) => Identity<B>
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const of: <A>(a: A) => Identity<A>
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.14.0
|
||||
*/
|
||||
export declare const flatMap: {
|
||||
<A, B>(f: (a: A) => Identity<B>): (ma: Identity<A>) => Identity<B>
|
||||
<A, B>(ma: Identity<A>, f: (a: A) => Identity<B>): Identity<B>
|
||||
}
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const extend: <A, B>(f: (wa: Identity<A>) => B) => (wa: Identity<A>) => Identity<B>
|
||||
/**
|
||||
* @category Extract
|
||||
* @since 2.6.2
|
||||
*/
|
||||
export declare const extract: <A>(wa: Identity<A>) => A
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const duplicate: <A>(ma: Identity<A>) => Identity<Identity<A>>
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const flatten: <A>(mma: Identity<Identity<A>>) => Identity<A>
|
||||
/**
|
||||
* @category folding
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const reduce: <A, B>(b: B, f: (b: B, a: A) => B) => (fa: Identity<A>) => B
|
||||
/**
|
||||
* @category folding
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const foldMap: <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: Identity<A>) => M
|
||||
/**
|
||||
* @category folding
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const reduceRight: <A, B>(b: B, f: (a: A, b: B) => B) => (fa: Identity<A>) => B
|
||||
/**
|
||||
* @category traversing
|
||||
* @since 2.6.3
|
||||
*/
|
||||
export declare const traverse: PipeableTraverse1<URI>
|
||||
/**
|
||||
* @category traversing
|
||||
* @since 2.6.3
|
||||
*/
|
||||
export declare const sequence: Traversable1<URI>['sequence']
|
||||
/**
|
||||
* Less strict version of [`alt`](#alt).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the return types will be merged.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.9.0
|
||||
*/
|
||||
export declare const altW: <B>(that: () => Identity<B>) => <A>(fa: Identity<A>) => Identity<A | B>
|
||||
/**
|
||||
* Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
|
||||
* types of kind `* -> *`.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const alt: <A>(that: () => Identity<A>) => (fa: Identity<A>) => Identity<A>
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const URI = 'Identity'
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export type URI = typeof URI
|
||||
declare module './HKT' {
|
||||
interface URItoKind<A> {
|
||||
readonly [URI]: Identity<A>
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const getShow: <A>(S: Show<A>) => Show<Identity<A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const getEq: <A>(E: Eq<A>) => Eq<Identity<A>>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Functor: Functor1<URI>
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const flap: <A>(
|
||||
a: A
|
||||
) => <B>(fab: import('./HKT').Kind<'Identity', (a: A) => B>) => import('./HKT').Kind<'Identity', B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Pointed: Pointed1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Apply: Apply1<URI>
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the first.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const apFirst: <B>(
|
||||
second: B
|
||||
) => <A>(first: import('./HKT').Kind<'Identity', A>) => import('./HKT').Kind<'Identity', A>
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the second.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const apSecond: <B>(
|
||||
second: B
|
||||
) => <A>(first: import('./HKT').Kind<'Identity', A>) => import('./HKT').Kind<'Identity', B>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Applicative: Applicative1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
export declare const Chain: Chain1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Monad: Monad1<URI>
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.16.7
|
||||
*/
|
||||
export declare const tap: {
|
||||
<A, _>(self: Identity<A>, f: (a: A) => Identity<_>): Identity<A>
|
||||
<A, _>(f: (a: A) => Identity<_>): (self: Identity<A>) => Identity<A>
|
||||
}
|
||||
/**
|
||||
* Alias of `tap`
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const chainFirst: <A, B>(f: (a: A) => B) => (first: A) => A
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Foldable: Foldable1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Traversable: Traversable1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Alt: Alt1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const Comonad: Comonad1<URI>
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
export declare const ChainRec: ChainRec1<URI>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.9.0
|
||||
*/
|
||||
export declare const Do: Identity<{}>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare const bindTo: <N extends string>(
|
||||
name: N
|
||||
) => <A>(fa: import('./HKT').Kind<'Identity', A>) => import('./HKT').Kind<'Identity', { readonly [K in N]: A }>
|
||||
declare const let_: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => B
|
||||
) => (
|
||||
fa: import('./HKT').Kind<'Identity', A>
|
||||
) => import('./HKT').Kind<'Identity', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
export {
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.13.0
|
||||
*/
|
||||
let_ as let
|
||||
}
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare const bind: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
f: (a: A) => import('./HKT').Kind<'Identity', B>
|
||||
) => (
|
||||
ma: import('./HKT').Kind<'Identity', A>
|
||||
) => import('./HKT').Kind<'Identity', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
export declare const apS: <N extends string, A, B>(
|
||||
name: Exclude<N, keyof A>,
|
||||
fb: B
|
||||
) => (
|
||||
fa: import('./HKT').Kind<'Identity', A>
|
||||
) => import('./HKT').Kind<'Identity', { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }>
|
||||
/**
|
||||
* Alias of `flatMap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare const chain: <A, B>(f: (a: A) => Identity<B>) => (ma: Identity<A>) => Identity<B>
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Functor` instance, pass `I.Functor` instead of `I.identity`
|
||||
* (where `I` is from `import I from 'fp-ts/Identity'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const identity: Monad1<URI> &
|
||||
Foldable1<URI> &
|
||||
Traversable1<URI> &
|
||||
Alt1<URI> &
|
||||
Comonad1<URI> &
|
||||
ChainRec1<URI>
|
||||
370
node_modules/fp-ts/lib/Identity.js
generated
vendored
Normal file
370
node_modules/fp-ts/lib/Identity.js
generated
vendored
Normal file
@@ -0,0 +1,370 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.identity = exports.chain = exports.apS = exports.bind = exports.let = exports.bindTo = exports.Do = exports.ChainRec = exports.Comonad = exports.Alt = exports.Traversable = exports.Foldable = exports.chainFirst = exports.tap = exports.Monad = exports.Chain = exports.Applicative = exports.apSecond = exports.apFirst = exports.Apply = exports.Pointed = exports.flap = exports.Functor = exports.getEq = exports.getShow = exports.URI = exports.alt = exports.altW = exports.sequence = exports.traverse = exports.reduceRight = exports.foldMap = exports.reduce = exports.flatten = exports.duplicate = exports.extract = exports.extend = exports.flatMap = exports.of = exports.ap = exports.map = void 0;
|
||||
var Apply_1 = require("./Apply");
|
||||
var Chain_1 = require("./Chain");
|
||||
var ChainRec_1 = require("./ChainRec");
|
||||
var function_1 = require("./function");
|
||||
var Functor_1 = require("./Functor");
|
||||
var _ = __importStar(require("./internal"));
|
||||
var _map = function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.map)(f)); };
|
||||
var _ap = function (fab, fa) { return (0, function_1.pipe)(fab, (0, exports.ap)(fa)); };
|
||||
/* istanbul ignore next */
|
||||
var _reduce = function (fa, b, f) { return (0, function_1.pipe)(fa, (0, exports.reduce)(b, f)); };
|
||||
/* istanbul ignore next */
|
||||
var _foldMap = function (M) { return function (fa, f) { return (0, function_1.pipe)(fa, (0, exports.foldMap)(M)(f)); }; };
|
||||
/* istanbul ignore next */
|
||||
var _reduceRight = function (fa, b, f) { return (0, function_1.pipe)(fa, (0, exports.reduceRight)(b, f)); };
|
||||
/* istanbul ignore next */
|
||||
var _alt = function (fa, that) { return (0, function_1.pipe)(fa, (0, exports.alt)(that)); };
|
||||
/* istanbul ignore next */
|
||||
var _extend = function (wa, f) { return (0, function_1.pipe)(wa, (0, exports.extend)(f)); };
|
||||
/* istanbul ignore next */
|
||||
var _traverse = function (F) {
|
||||
var traverseF = (0, exports.traverse)(F);
|
||||
return function (ta, f) { return (0, function_1.pipe)(ta, traverseF(f)); };
|
||||
};
|
||||
var _chainRec = ChainRec_1.tailRec;
|
||||
/**
|
||||
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
||||
* use the type constructor `F` to represent some computational context.
|
||||
*
|
||||
* @category mapping
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var map = function (f) { return function (fa) { return f(fa); }; };
|
||||
exports.map = map;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var ap = function (fa) { return function (fab) { return fab(fa); }; };
|
||||
exports.ap = ap;
|
||||
/**
|
||||
* @category constructors
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.of = function_1.identity;
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.14.0
|
||||
*/
|
||||
exports.flatMap = (0, function_1.dual)(2, function (ma, f) { return f(ma); });
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var extend = function (f) { return function (wa) { return f(wa); }; };
|
||||
exports.extend = extend;
|
||||
/**
|
||||
* @category Extract
|
||||
* @since 2.6.2
|
||||
*/
|
||||
exports.extract = function_1.identity;
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.duplicate = (0, exports.extend)(function_1.identity);
|
||||
/**
|
||||
* @category sequencing
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.flatten = (0, exports.flatMap)(function_1.identity);
|
||||
/**
|
||||
* @category folding
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var reduce = function (b, f) { return function (fa) { return f(b, fa); }; };
|
||||
exports.reduce = reduce;
|
||||
/**
|
||||
* @category folding
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var foldMap = function () { return function (f) { return function (fa) { return f(fa); }; }; };
|
||||
exports.foldMap = foldMap;
|
||||
/**
|
||||
* @category folding
|
||||
* @since 2.0.0
|
||||
*/
|
||||
var reduceRight = function (b, f) { return function (fa) { return f(fa, b); }; };
|
||||
exports.reduceRight = reduceRight;
|
||||
/**
|
||||
* @category traversing
|
||||
* @since 2.6.3
|
||||
*/
|
||||
var traverse = function (F) {
|
||||
return function (f) {
|
||||
return function (ta) {
|
||||
return F.map(f(ta), function_1.identity);
|
||||
};
|
||||
};
|
||||
};
|
||||
exports.traverse = traverse;
|
||||
/**
|
||||
* @category traversing
|
||||
* @since 2.6.3
|
||||
*/
|
||||
var sequence = function (F) {
|
||||
return function (ta) {
|
||||
return F.map(ta, function_1.identity);
|
||||
};
|
||||
};
|
||||
exports.sequence = sequence;
|
||||
/**
|
||||
* Less strict version of [`alt`](#alt).
|
||||
*
|
||||
* The `W` suffix (short for **W**idening) means that the return types will be merged.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.9.0
|
||||
*/
|
||||
var altW = function () { return function_1.identity; };
|
||||
exports.altW = altW;
|
||||
/**
|
||||
* Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
|
||||
* types of kind `* -> *`.
|
||||
*
|
||||
* @category error handling
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.alt = exports.altW;
|
||||
/**
|
||||
* @category type lambdas
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.URI = 'Identity';
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.getShow = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.getEq = function_1.identity;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Functor = {
|
||||
URI: exports.URI,
|
||||
map: _map
|
||||
};
|
||||
/**
|
||||
* @category mapping
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.flap = (0, Functor_1.flap)(exports.Functor);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Pointed = {
|
||||
URI: exports.URI,
|
||||
of: exports.of
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Apply = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap
|
||||
};
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the first.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.apFirst = (0, Apply_1.apFirst)(exports.Apply);
|
||||
/**
|
||||
* Combine two effectful actions, keeping only the result of the second.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.apSecond = (0, Apply_1.apSecond)(exports.Apply);
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Applicative = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.10.0
|
||||
*/
|
||||
exports.Chain = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
chain: exports.flatMap
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Monad = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
chain: exports.flatMap
|
||||
};
|
||||
/**
|
||||
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
||||
* keeping only the result of the first.
|
||||
*
|
||||
* @category combinators
|
||||
* @since 2.16.7
|
||||
*/
|
||||
exports.tap = (0, function_1.dual)(2, (0, Chain_1.tap)(exports.Chain));
|
||||
/**
|
||||
* Alias of `tap`
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.chainFirst = exports.tap;
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Foldable = {
|
||||
URI: exports.URI,
|
||||
reduce: _reduce,
|
||||
foldMap: _foldMap,
|
||||
reduceRight: _reduceRight
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Traversable = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
reduce: _reduce,
|
||||
foldMap: _foldMap,
|
||||
reduceRight: _reduceRight,
|
||||
traverse: _traverse,
|
||||
sequence: exports.sequence
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Alt = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
alt: _alt
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.Comonad = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
extend: _extend,
|
||||
extract: exports.extract
|
||||
};
|
||||
/**
|
||||
* @category instances
|
||||
* @since 2.7.0
|
||||
*/
|
||||
exports.ChainRec = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
chain: exports.flatMap,
|
||||
chainRec: _chainRec
|
||||
};
|
||||
// -------------------------------------------------------------------------------------
|
||||
// do notation
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.9.0
|
||||
*/
|
||||
exports.Do = (0, exports.of)(_.emptyRecord);
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
exports.bindTo = (0, Functor_1.bindTo)(exports.Functor);
|
||||
var let_ = /*#__PURE__*/ (0, Functor_1.let)(exports.Functor);
|
||||
exports.let = let_;
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
exports.bind = (0, Chain_1.bind)(exports.Chain);
|
||||
/**
|
||||
* @category do notation
|
||||
* @since 2.8.0
|
||||
*/
|
||||
exports.apS = (0, Apply_1.apS)(exports.Apply);
|
||||
// -------------------------------------------------------------------------------------
|
||||
// legacy
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Alias of `flatMap`.
|
||||
*
|
||||
* @category legacy
|
||||
* @since 2.0.0
|
||||
*/
|
||||
exports.chain = exports.flatMap;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// deprecated
|
||||
// -------------------------------------------------------------------------------------
|
||||
/**
|
||||
* This instance is deprecated, use small, specific instances instead.
|
||||
* For example if a function needs a `Functor` instance, pass `I.Functor` instead of `I.identity`
|
||||
* (where `I` is from `import I from 'fp-ts/Identity'`)
|
||||
*
|
||||
* @category zone of death
|
||||
* @since 2.0.0
|
||||
* @deprecated
|
||||
*/
|
||||
exports.identity = {
|
||||
URI: exports.URI,
|
||||
map: _map,
|
||||
ap: _ap,
|
||||
of: exports.of,
|
||||
chain: exports.flatMap,
|
||||
reduce: _reduce,
|
||||
foldMap: _foldMap,
|
||||
reduceRight: _reduceRight,
|
||||
traverse: _traverse,
|
||||
sequence: exports.sequence,
|
||||
alt: _alt,
|
||||
extract: exports.extract,
|
||||
extend: _extend,
|
||||
chainRec: _chainRec
|
||||
};
|
||||
62
node_modules/fp-ts/lib/Invariant.d.ts
generated
vendored
Normal file
62
node_modules/fp-ts/lib/Invariant.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Invariant<F> {
|
||||
readonly URI: F
|
||||
readonly imap: <A, B>(fa: HKT<F, A>, f: (a: A) => B, g: (b: B) => A) => HKT<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Invariant1<F extends URIS> {
|
||||
readonly URI: F
|
||||
readonly imap: <A, B>(fa: Kind<F, A>, f: (a: A) => B, g: (b: B) => A) => Kind<F, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Invariant2<F extends URIS2> {
|
||||
readonly URI: F
|
||||
readonly imap: <E, A, B>(fa: Kind2<F, E, A>, f: (a: A) => B, g: (b: B) => A) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Invariant2C<F extends URIS2, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly imap: <A, B>(fa: Kind2<F, E, A>, f: (a: A) => B, g: (b: B) => A) => Kind2<F, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface Invariant3<F extends URIS3> {
|
||||
readonly URI: F
|
||||
readonly imap: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => B, g: (b: B) => A) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.4.2
|
||||
*/
|
||||
export interface Invariant3C<F extends URIS3, E> {
|
||||
readonly URI: F
|
||||
readonly _E: E
|
||||
readonly imap: <R, A, B>(fa: Kind3<F, R, E, A>, f: (a: A) => B, g: (b: B) => A) => Kind3<F, R, E, B>
|
||||
}
|
||||
/**
|
||||
* @category model
|
||||
* @since 2.4.2
|
||||
*/
|
||||
export interface Invariant4<F extends URIS4> {
|
||||
readonly URI: F
|
||||
readonly imap: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (a: A) => B, g: (b: B) => A) => Kind4<F, S, R, E, B>
|
||||
}
|
||||
2
node_modules/fp-ts/lib/Invariant.js
generated
vendored
Normal file
2
node_modules/fp-ts/lib/Invariant.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user