@fp-ts/core
Advanced tools
Comparing version 0.0.10 to 0.0.11
30
HKT.d.ts
@@ -12,3 +12,3 @@ /** | ||
export interface TypeClass<F extends TypeLambda> { | ||
[URI]?: F; | ||
readonly [URI]?: F; | ||
} | ||
@@ -19,6 +19,6 @@ /** | ||
export interface TypeLambda { | ||
In: unknown; | ||
Out2: unknown; | ||
Out1: unknown; | ||
Target: unknown; | ||
readonly In: unknown; | ||
readonly Out2: unknown; | ||
readonly Out1: unknown; | ||
readonly Target: unknown; | ||
} | ||
@@ -29,15 +29,15 @@ /** | ||
export type Kind<F extends TypeLambda, In, Out2, Out1, Target> = F extends { | ||
type: unknown; | ||
readonly type: unknown; | ||
} ? (F & { | ||
In: In; | ||
Out2: Out2; | ||
Out1: Out1; | ||
Target: Target; | ||
readonly In: In; | ||
readonly Out2: Out2; | ||
readonly Out1: Out1; | ||
readonly Target: Target; | ||
})["type"] : { | ||
F: F; | ||
In: (_: In) => void; | ||
Out2: () => Out2; | ||
Out1: () => Out1; | ||
Target: (_: Target) => Target; | ||
readonly F: F; | ||
readonly In: (_: In) => void; | ||
readonly Out2: () => Out2; | ||
readonly Out1: () => Out1; | ||
readonly Target: (_: Target) => Target; | ||
}; | ||
//# sourceMappingURL=HKT.d.ts.map |
{ | ||
"name": "@fp-ts/core", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -14,3 +14,3 @@ /** | ||
export interface TypeClass<F extends TypeLambda> { | ||
[URI]?: F | ||
readonly [URI]?: F | ||
} | ||
@@ -22,6 +22,6 @@ | ||
export interface TypeLambda { | ||
In: unknown | ||
Out2: unknown | ||
Out1: unknown | ||
Target: unknown | ||
readonly In: unknown | ||
readonly Out2: unknown | ||
readonly Out1: unknown | ||
readonly Target: unknown | ||
} | ||
@@ -33,15 +33,15 @@ | ||
export type Kind<F extends TypeLambda, In, Out2, Out1, Target> = F extends { | ||
type: unknown | ||
readonly type: unknown | ||
} ? (F & { | ||
In: In | ||
Out2: Out2 | ||
Out1: Out1 | ||
Target: Target | ||
readonly In: In | ||
readonly Out2: Out2 | ||
readonly Out1: Out1 | ||
readonly Target: Target | ||
})["type"] | ||
: { | ||
F: F | ||
In: (_: In) => void | ||
Out2: () => Out2 | ||
Out1: () => Out1 | ||
Target: (_: Target) => Target | ||
readonly F: F | ||
readonly In: (_: In) => void | ||
readonly Out2: () => Out2 | ||
readonly Out1: () => Out1 | ||
readonly Target: (_: Target) => Target | ||
} |
@@ -13,3 +13,3 @@ /** | ||
export interface Bicovariant<F extends TypeLambda> extends TypeClass<F> { | ||
bimap: <E1, E2, A, B>( | ||
readonly bimap: <E1, E2, A, B>( | ||
f: (e: E1) => E2, | ||
@@ -16,0 +16,0 @@ g: (a: A) => B |
@@ -13,4 +13,4 @@ /** | ||
export interface Bounded<A> extends Order<A> { | ||
maxBound: A | ||
minBound: A | ||
readonly maxBound: A | ||
readonly minBound: A | ||
} | ||
@@ -23,3 +23,3 @@ | ||
export interface BoundedTypeLambda extends TypeLambda { | ||
type: Bounded<this["Target"]> | ||
readonly type: Bounded<this["Target"]> | ||
} | ||
@@ -26,0 +26,0 @@ |
@@ -59,3 +59,3 @@ /** | ||
E1 | E2, | ||
{ [K in keyof A | N]: K extends keyof A ? A[K] : B } | ||
{ readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } | ||
> => | ||
@@ -62,0 +62,0 @@ F.flatMap(a => |
@@ -12,3 +12,3 @@ /** | ||
export interface Contravariant<F extends TypeLambda> extends Invariant<F> { | ||
contramap: <B, A>( | ||
readonly contramap: <B, A>( | ||
f: (b: B) => A | ||
@@ -15,0 +15,0 @@ ) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B> |
@@ -14,5 +14,5 @@ /** | ||
export interface Coproduct<F extends TypeLambda> extends SemiCoproduct<F> { | ||
zero: <A>() => Kind<F, unknown, never, never, A> | ||
readonly zero: <A>() => Kind<F, unknown, never, never, A> | ||
coproductAll: <R, O, E, A>( | ||
readonly coproductAll: <R, O, E, A>( | ||
collection: Iterable<Kind<F, R, O, E, A>> | ||
@@ -19,0 +19,0 @@ ) => Kind<F, R, O, E, A> |
@@ -12,3 +12,3 @@ /** | ||
export interface Covariant<F extends TypeLambda> extends Invariant<F> { | ||
map: <A, B>( | ||
readonly map: <A, B>( | ||
f: (a: A) => B | ||
@@ -15,0 +15,0 @@ ) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B> |
@@ -12,3 +12,3 @@ /** | ||
export interface FlatMap<F extends TypeLambda> extends TypeClass<F> { | ||
flatMap: <A, R2, O2, E2, B>( | ||
readonly flatMap: <A, R2, O2, E2, B>( | ||
f: (a: A) => Kind<F, R2, O2, E2, B> | ||
@@ -15,0 +15,0 @@ ) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, B> |
@@ -16,3 +16,3 @@ /** | ||
export interface Foldable<F extends TypeLambda> extends TypeClass<F> { | ||
reduce: <A, B>( | ||
readonly reduce: <A, B>( | ||
b: B, | ||
@@ -19,0 +19,0 @@ f: (b: B, a: A) => B |
@@ -11,3 +11,3 @@ /** | ||
export interface Invariant<F extends TypeLambda> extends TypeClass<F> { | ||
imap: <A, B>( | ||
readonly imap: <A, B>( | ||
to: (a: A) => B, | ||
@@ -42,3 +42,3 @@ from: (b: B) => A | ||
self: Kind<F, R, O, E, A> | ||
) => Kind<F, R, O, E, { [K in N]: A }>) => | ||
) => Kind<F, R, O, E, { readonly [K in N]: A }>) => | ||
F.imap(a => ({ [name]: a } as any), ({ [name]: a }) => a) | ||
@@ -51,3 +51,3 @@ | ||
F: Invariant<F> | ||
): (<R, O, E, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, [A]>) => | ||
F.imap(a => [a], ([a]) => a) | ||
): (<R, O, E, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, readonly [A]>) => | ||
F.imap(a => [a] as const, ([a]) => a) |
@@ -13,4 +13,4 @@ /** | ||
export interface Monoid<A> extends Semigroup<A> { | ||
empty: A | ||
combineAll: (collection: Iterable<A>) => A | ||
readonly empty: A | ||
readonly combineAll: (collection: Iterable<A>) => A | ||
} | ||
@@ -63,4 +63,4 @@ | ||
export const struct = <A>( | ||
monoids: { [K in keyof A]: Monoid<A[K]> } | ||
): Monoid<{ [K in keyof A]: A[K] }> => { | ||
monoids: { readonly [K in keyof A]: Monoid<A[K]> } | ||
): Monoid<{ readonly [K in keyof A]: A[K] }> => { | ||
const empty: A = {} as any | ||
@@ -80,7 +80,7 @@ for (const k in monoids) { | ||
*/ | ||
export const tuple = <A extends Array<any>>( | ||
export const tuple = <A extends ReadonlyArray<any>>( | ||
...monoids: { [K in keyof A]: Monoid<A[K]> } | ||
): Monoid<A> => { | ||
): Monoid<Readonly<A>> => { | ||
const empty: A = monoids.map((m) => m.empty) as any | ||
return fromSemigroup(semigroup.tuple<A>(...monoids), empty) | ||
return fromSemigroup(semigroup.tuple(...monoids), empty) | ||
} |
@@ -16,3 +16,3 @@ /** | ||
export interface NonEmptyTraversable<T extends TypeLambda> extends TypeClass<T> { | ||
traverseNonEmpty: <F extends TypeLambda>( | ||
readonly traverseNonEmpty: <F extends TypeLambda>( | ||
F: SemiApplicative<F> | ||
@@ -25,3 +25,3 @@ ) => <A, R, O, E, B>( | ||
sequenceNonEmpty: <F extends TypeLambda>( | ||
readonly sequenceNonEmpty: <F extends TypeLambda>( | ||
F: SemiApplicative<F> | ||
@@ -28,0 +28,0 @@ ) => <TR, TO, TE, R, O, E, A>( |
@@ -11,3 +11,3 @@ /** | ||
export interface Of<F extends TypeLambda> extends TypeClass<F> { | ||
of: <A>(a: A) => Kind<F, unknown, never, never, A> | ||
readonly of: <A>(a: A) => Kind<F, unknown, never, never, A> | ||
} | ||
@@ -14,0 +14,0 @@ |
@@ -18,3 +18,3 @@ /** | ||
export interface Order<A> { | ||
compare: (that: A) => (self: A) => -1 | 0 | 1 | ||
readonly compare: (that: A) => (self: A) => -1 | 0 | 1 | ||
} | ||
@@ -27,3 +27,3 @@ | ||
export interface OrderTypeLambda extends TypeLambda { | ||
type: Order<this["Target"]> | ||
readonly type: Order<this["Target"]> | ||
} | ||
@@ -46,3 +46,3 @@ | ||
*/ | ||
export const tuple = <A extends Array<any>>( | ||
export const tuple = <A extends ReadonlyArray<any>>( | ||
...orders: { [K in keyof A]: Order<A[K]> } | ||
@@ -49,0 +49,0 @@ ): Order<Readonly<A>> => |
@@ -14,5 +14,5 @@ /** | ||
export interface Product<F extends TypeLambda> extends SemiProduct<F>, Of<F> { | ||
productAll: <R, O, E, A>( | ||
readonly productAll: <R, O, E, A>( | ||
collection: Iterable<Kind<F, R, O, E, A>> | ||
) => Kind<F, R, O, E, Array<A>> | ||
) => Kind<F, R, O, E, ReadonlyArray<A>> | ||
} | ||
@@ -24,3 +24,3 @@ | ||
export const tuple = <F extends TypeLambda>(F: Product<F>) => | ||
<T extends Array<Kind<F, any, any, any, any>>>(...components: T): Kind< | ||
<T extends ReadonlyArray<Kind<F, any, any, any, any>>>(...components: T): Kind< | ||
F, | ||
@@ -30,3 +30,3 @@ ([T[number]] extends [Kind<F, infer R, any, any, any>] ? R : never), | ||
([T[number]] extends [Kind<F, any, any, infer E, any>] ? E : never), | ||
{ [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never } | ||
Readonly<{ [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never }> | ||
> => F.productAll(components) as any | ||
@@ -43,3 +43,3 @@ | ||
([R[keyof R]] extends [Kind<F, any, any, infer E, any>] ? E : never), | ||
{ [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never } | ||
{ readonly [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never } | ||
> => { | ||
@@ -46,0 +46,0 @@ const keys = Object.keys(fields) |
@@ -13,3 +13,3 @@ /** | ||
export interface SemiCoproduct<F extends TypeLambda> extends Invariant<F> { | ||
coproduct: <R2, O2, E2, B>( | ||
readonly coproduct: <R2, O2, E2, B>( | ||
that: Kind<F, R2, O2, E2, B> | ||
@@ -20,3 +20,3 @@ ) => <R1, O1, E1, A>( | ||
coproductMany: <R, O, E, A>( | ||
readonly coproductMany: <R, O, E, A>( | ||
collection: Iterable<Kind<F, R, O, E, A>> | ||
@@ -23,0 +23,0 @@ ) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, A> |
@@ -35,4 +35,4 @@ /** | ||
export interface Semigroup<A> { | ||
combine: (that: A) => (self: A) => A | ||
combineMany: (collection: Iterable<A>) => (self: A) => A | ||
readonly combine: (that: A) => (self: A) => A | ||
readonly combineMany: (collection: Iterable<A>) => (self: A) => A | ||
} | ||
@@ -45,3 +45,3 @@ | ||
export interface SemigroupTypeLambda extends TypeLambda { | ||
type: Semigroup<this["Target"]> | ||
readonly type: Semigroup<this["Target"]> | ||
} | ||
@@ -117,3 +117,3 @@ | ||
{ | ||
[K in keyof A]: A[K] | ||
readonly [K in keyof A]: A[K] | ||
} | ||
@@ -138,5 +138,5 @@ > => | ||
*/ | ||
export const tuple = <A extends Array<any>>( | ||
export const tuple = <A extends ReadonlyArray<any>>( | ||
...semigroups: { [K in keyof A]: Semigroup<A[K]> } | ||
): Semigroup<A> => | ||
): Semigroup<Readonly<A>> => | ||
fromCombine((that) => (self) => semigroups.map((S, i) => S.combine(that[i])(self[i])) as any) | ||
@@ -143,0 +143,0 @@ |
@@ -15,11 +15,11 @@ /** | ||
export interface SemiProduct<F extends TypeLambda> extends Invariant<F> { | ||
product: <R2, O2, E2, B>( | ||
readonly product: <R2, O2, E2, B>( | ||
that: Kind<F, R2, O2, E2, B> | ||
) => <R1, O1, E1, A>( | ||
self: Kind<F, R1, O1, E1, A> | ||
) => Kind<F, R1 & R2, O1 | O2, E1 | E2, [A, B]> | ||
) => Kind<F, R1 & R2, O1 | O2, E1 | E2, readonly [A, B]> | ||
productMany: <R, O, E, A>( | ||
readonly productMany: <R, O, E, A>( | ||
collection: Iterable<Kind<F, R, O, E, A>> | ||
) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, [A, ...Array<A>]> | ||
) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, readonly [A, ...Array<A>]> | ||
} | ||
@@ -46,3 +46,3 @@ | ||
FE1 | FE2, | ||
Kind<G, GR1 & GR2, GO1 | GO2, GE1 | GE2, [A, B]> | ||
Kind<G, GR1 & GR2, GO1 | GO2, GE1 | GE2, readonly [A, B]> | ||
> => pipe(self, F.product(that), F.map(([ga, gb]) => pipe(ga, G.product(gb)))) | ||
@@ -64,3 +64,3 @@ | ||
self: Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, A>> | ||
): Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, [A, ...Array<A>]>> => | ||
): Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, readonly [A, ...Array<A>]>> => | ||
pipe( | ||
@@ -88,3 +88,3 @@ self, | ||
self, | ||
Covariant.map((a): [A, ...Array<A>] => [a]) | ||
Covariant.map((a): readonly [A, ...Array<A>] => [a]) | ||
) | ||
@@ -95,3 +95,3 @@ for (const fa of collection) { | ||
product(fa), | ||
Covariant.map(([[head, ...tail], a]): [A, ...Array<A>] => [head, ...tail, a]) | ||
Covariant.map(([[head, ...tail], a]): readonly [A, ...Array<A>] => [head, ...tail, a]) | ||
) | ||
@@ -117,3 +117,3 @@ } | ||
E1 | E2, | ||
{ [K in keyof A | N]: K extends keyof A ? A[K] : B } | ||
{ readonly [K in keyof A | N]: K extends keyof A ? A[K] : B } | ||
> => | ||
@@ -136,9 +136,9 @@ pipe( | ||
) => | ||
<R1, O1, E1, A extends Array<any>>( | ||
<R1, O1, E1, A extends ReadonlyArray<any>>( | ||
self: Kind<F, R1, O1, E1, A> | ||
): Kind<F, R1 & R2, O1 | O2, E1 | E2, [...A, B]> => | ||
): Kind<F, R1 & R2, O1 | O2, E1 | E2, readonly [...A, B]> => | ||
pipe( | ||
self, | ||
F.product(that), | ||
F.imap(([a, b]) => [...a, b], ab => [ab.slice(0, -1), ab[ab.length - 1]] as any) | ||
F.imap(([a, b]) => [...a, b] as const, ab => [ab.slice(0, -1), ab[ab.length - 1]] as any) | ||
) | ||
@@ -150,3 +150,3 @@ | ||
export const nonEmptyTuple = <F extends TypeLambda>(F: SemiProduct<F>) => | ||
<T extends [Kind<F, any, any, any, any>, ...Array<Kind<F, any, any, any, any>>]>( | ||
<T extends readonly [Kind<F, any, any, any, any>, ...Array<Kind<F, any, any, any, any>>]>( | ||
...components: T | ||
@@ -158,3 +158,3 @@ ): Kind< | ||
([T[number]] extends [Kind<F, any, any, infer E, any>] ? E : never), | ||
{ [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never } | ||
Readonly<{ [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never }> | ||
> => F.productMany(components.slice(1))(components[0]) as any | ||
@@ -168,3 +168,3 @@ | ||
export const nonEmptyStruct = <F extends TypeLambda>(F: SemiProduct<F>) => | ||
<R extends Record<string, Kind<F, any, any, any, any>>>( | ||
<R extends Readonly<Record<string, Kind<F, any, any, any, any>>>>( | ||
fields: EnforceNonEmptyRecord<R> & Record<string, Kind<F, any, any, any, any>> | ||
@@ -176,3 +176,3 @@ ): Kind< | ||
([R[keyof R]] extends [Kind<F, any, any, infer E, any>] ? E : never), | ||
{ [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never } | ||
{ readonly [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never } | ||
> => { | ||
@@ -179,0 +179,0 @@ const keys = Object.keys(fields) |
@@ -14,3 +14,3 @@ /** | ||
export interface Traversable<T extends TypeLambda> extends TypeClass<T> { | ||
traverse: <F extends TypeLambda>( | ||
readonly traverse: <F extends TypeLambda>( | ||
F: Applicative<F> | ||
@@ -21,3 +21,3 @@ ) => <A, R, O, E, B>( | ||
sequence: <F extends TypeLambda>(F: Applicative<F>) => <TR, TO, TE, R, O, E, A>( | ||
readonly sequence: <F extends TypeLambda>(F: Applicative<F>) => <TR, TO, TE, R, O, E, A>( | ||
self: Kind<T, TR, TO, TE, Kind<F, R, O, E, A>> | ||
@@ -24,0 +24,0 @@ ) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>> |
@@ -11,3 +11,3 @@ /** | ||
export interface Bicovariant<F extends TypeLambda> extends TypeClass<F> { | ||
bimap: <E1, E2, A, B>(f: (e: E1) => E2, g: (a: A) => B) => <R, O>(self: Kind<F, R, O, E1, A>) => Kind<F, R, O, E2, B>; | ||
readonly bimap: <E1, E2, A, B>(f: (e: E1) => E2, g: (a: A) => B) => <R, O>(self: Kind<F, R, O, E1, A>) => Kind<F, R, O, E2, B>; | ||
} | ||
@@ -14,0 +14,0 @@ /** |
@@ -11,4 +11,4 @@ /** | ||
export interface Bounded<A> extends Order<A> { | ||
maxBound: A; | ||
minBound: A; | ||
readonly maxBound: A; | ||
readonly minBound: A; | ||
} | ||
@@ -20,3 +20,3 @@ /** | ||
export interface BoundedTypeLambda extends TypeLambda { | ||
type: Bounded<this["Target"]>; | ||
readonly type: Bounded<this["Target"]>; | ||
} | ||
@@ -23,0 +23,0 @@ /** |
@@ -30,3 +30,3 @@ /** | ||
*/ | ||
export declare const bind: <F extends TypeLambda>(F: Chainable<F>) => <N extends string, A extends object, R2, O2, E2, B>(name: Exclude<N, keyof A>, f: (a: A) => Kind<F, R2, O2, E2, B>) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, { [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; | ||
export declare const bind: <F extends TypeLambda>(F: Chainable<F>) => <N extends string, A extends object, R2, O2, E2, B>(name: Exclude<N, keyof A>, f: (a: A) => Kind<F, R2, O2, E2, B>) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; | ||
//# sourceMappingURL=Chainable.d.ts.map |
@@ -11,3 +11,3 @@ /** | ||
export interface Contravariant<F extends TypeLambda> extends Invariant<F> { | ||
contramap: <B, A>(f: (b: B) => A) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B>; | ||
readonly contramap: <B, A>(f: (b: B) => A) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B>; | ||
} | ||
@@ -14,0 +14,0 @@ /** |
@@ -12,4 +12,4 @@ /** | ||
export interface Coproduct<F extends TypeLambda> extends SemiCoproduct<F> { | ||
zero: <A>() => Kind<F, unknown, never, never, A>; | ||
coproductAll: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, A>; | ||
readonly zero: <A>() => Kind<F, unknown, never, never, A>; | ||
readonly coproductAll: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, A>; | ||
} | ||
@@ -16,0 +16,0 @@ /** |
@@ -11,3 +11,3 @@ /** | ||
export interface Covariant<F extends TypeLambda> extends Invariant<F> { | ||
map: <A, B>(f: (a: A) => B) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B>; | ||
readonly map: <A, B>(f: (a: A) => B) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B>; | ||
} | ||
@@ -14,0 +14,0 @@ /** |
@@ -10,3 +10,3 @@ /** | ||
export interface FlatMap<F extends TypeLambda> extends TypeClass<F> { | ||
flatMap: <A, R2, O2, E2, B>(f: (a: A) => Kind<F, R2, O2, E2, B>) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, B>; | ||
readonly flatMap: <A, R2, O2, E2, B>(f: (a: A) => Kind<F, R2, O2, E2, B>) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, B>; | ||
} | ||
@@ -13,0 +13,0 @@ /** |
@@ -13,3 +13,3 @@ /** | ||
export interface Foldable<F extends TypeLambda> extends TypeClass<F> { | ||
reduce: <A, B>(b: B, f: (b: B, a: A) => B) => <R, O, E>(self: Kind<F, R, O, E, A>) => B; | ||
readonly reduce: <A, B>(b: B, f: (b: B, a: A) => B) => <R, O, E>(self: Kind<F, R, O, E, A>) => B; | ||
} | ||
@@ -16,0 +16,0 @@ /** |
@@ -10,3 +10,3 @@ /** | ||
export interface Invariant<F extends TypeLambda> extends TypeClass<F> { | ||
imap: <A, B>(to: (a: A) => B, from: (b: B) => A) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B>; | ||
readonly imap: <A, B>(to: (a: A) => B, from: (b: B) => A) => <R, O, E>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, B>; | ||
} | ||
@@ -22,7 +22,7 @@ /** | ||
*/ | ||
export declare const bindTo: <F extends TypeLambda>(F: Invariant<F>) => <N extends string>(name: N) => <R, O, E, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, { [K in N]: A; }>; | ||
export declare const bindTo: <F extends TypeLambda>(F: Invariant<F>) => <N extends string>(name: N) => <R, O, E, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, { readonly [K in N]: A; }>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const tupled: <F extends TypeLambda>(F: Invariant<F>) => <R, O, E, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, [A]>; | ||
export declare const tupled: <F extends TypeLambda>(F: Invariant<F>) => <R, O, E, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, readonly [A]>; | ||
//# sourceMappingURL=Invariant.d.ts.map |
@@ -11,4 +11,4 @@ /** | ||
export interface Monoid<A> extends Semigroup<A> { | ||
empty: A; | ||
combineAll: (collection: Iterable<A>) => A; | ||
readonly empty: A; | ||
readonly combineAll: (collection: Iterable<A>) => A; | ||
} | ||
@@ -51,3 +51,3 @@ /** | ||
*/ | ||
export declare const struct: <A>(monoids: { [K in keyof A]: Monoid<A[K]>; }) => Monoid<{ [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const struct: <A>(monoids: { readonly [K in keyof A]: Monoid<A[K]>; }) => Monoid<{ readonly [K_1 in keyof A]: A[K_1]; }>; | ||
/** | ||
@@ -58,3 +58,3 @@ * Given a tuple of monoids returns a monoid for the tuple. | ||
*/ | ||
export declare const tuple: <A extends any[]>(...monoids: { [K in keyof A]: Monoid<A[K]>; }) => Monoid<A>; | ||
export declare const tuple: <A extends readonly any[]>(...monoids: { [K in keyof A]: Monoid<A[K]>; }) => Monoid<Readonly<A>>; | ||
//# sourceMappingURL=Monoid.d.ts.map |
@@ -14,4 +14,4 @@ /** | ||
export interface NonEmptyTraversable<T extends TypeLambda> extends TypeClass<T> { | ||
traverseNonEmpty: <F extends TypeLambda>(F: SemiApplicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>; | ||
sequenceNonEmpty: <F extends TypeLambda>(F: SemiApplicative<F>) => <TR, TO, TE, R, O, E, A>(self: Kind<T, TR, TO, TE, Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>; | ||
readonly traverseNonEmpty: <F extends TypeLambda>(F: SemiApplicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>; | ||
readonly sequenceNonEmpty: <F extends TypeLambda>(F: SemiApplicative<F>) => <TR, TO, TE, R, O, E, A>(self: Kind<T, TR, TO, TE, Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>; | ||
} | ||
@@ -18,0 +18,0 @@ /** |
@@ -10,3 +10,3 @@ /** | ||
export interface Of<F extends TypeLambda> extends TypeClass<F> { | ||
of: <A>(a: A) => Kind<F, unknown, never, never, A>; | ||
readonly of: <A>(a: A) => Kind<F, unknown, never, never, A>; | ||
} | ||
@@ -13,0 +13,0 @@ /** |
@@ -16,3 +16,3 @@ /** | ||
export interface Order<A> { | ||
compare: (that: A) => (self: A) => -1 | 0 | 1; | ||
readonly compare: (that: A) => (self: A) => -1 | 0 | 1; | ||
} | ||
@@ -24,3 +24,3 @@ /** | ||
export interface OrderTypeLambda extends TypeLambda { | ||
type: Order<this["Target"]>; | ||
readonly type: Order<this["Target"]>; | ||
} | ||
@@ -39,3 +39,3 @@ /** | ||
*/ | ||
export declare const tuple: <A extends any[]>(...orders: { [K in keyof A]: Order<A[K]>; }) => Order<Readonly<A>>; | ||
export declare const tuple: <A extends readonly any[]>(...orders: { [K in keyof A]: Order<A[K]>; }) => Order<Readonly<A>>; | ||
/** | ||
@@ -42,0 +42,0 @@ * @since 1.0.0 |
@@ -12,3 +12,3 @@ /** | ||
export interface Product<F extends TypeLambda> extends SemiProduct<F>, Of<F> { | ||
productAll: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Array<A>>; | ||
readonly productAll: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, ReadonlyArray<A>>; | ||
} | ||
@@ -18,7 +18,7 @@ /** | ||
*/ | ||
export declare const tuple: <F extends TypeLambda>(F: Product<F>) => <T extends Kind<F, any, any, any, any>[]>(...components: T) => Kind<F, [T[number]] extends [Kind<F, infer R, any, any, any>] ? R : never, [T[number]] extends [Kind<F, any, infer O, any, any>] ? O : never, [T[number]] extends [Kind<F, any, any, infer E, any>] ? E : never, { [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>; | ||
export declare const tuple: <F extends TypeLambda>(F: Product<F>) => <T extends readonly Kind<F, any, any, any, any>[]>(...components: T) => Kind<F, [T[number]] extends [Kind<F, infer R, any, any, any>] ? R : never, [T[number]] extends [Kind<F, any, infer O, any, any>] ? O : never, [T[number]] extends [Kind<F, any, any, infer E, any>] ? E : never, Readonly<{ [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const struct: <F extends TypeLambda>(F: Product<F>) => <R extends Record<string, Kind<F, any, any, any, any>>>(fields: R) => Kind<F, [R[keyof R]] extends [Kind<F, infer R_1, any, any, any>] ? R_1 : never, [R[keyof R]] extends [Kind<F, any, infer O, any, any>] ? O : never, [R[keyof R]] extends [Kind<F, any, any, infer E, any>] ? E : never, { [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>; | ||
export declare const struct: <F extends TypeLambda>(F: Product<F>) => <R extends Record<string, Kind<F, any, any, any, any>>>(fields: R) => Kind<F, [R[keyof R]] extends [Kind<F, infer R_1, any, any, any>] ? R_1 : never, [R[keyof R]] extends [Kind<F, any, infer O, any, any>] ? O : never, [R[keyof R]] extends [Kind<F, any, any, infer E, any>] ? E : never, { readonly [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>; | ||
//# sourceMappingURL=Product.d.ts.map |
@@ -12,4 +12,4 @@ /** | ||
export interface SemiCoproduct<F extends TypeLambda> extends Invariant<F> { | ||
coproduct: <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, A | B>; | ||
coproductMany: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, A>; | ||
readonly coproduct: <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, A | B>; | ||
readonly coproductMany: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, A>; | ||
} | ||
@@ -16,0 +16,0 @@ /** |
@@ -33,4 +33,4 @@ /** | ||
export interface Semigroup<A> { | ||
combine: (that: A) => (self: A) => A; | ||
combineMany: (collection: Iterable<A>) => (self: A) => A; | ||
readonly combine: (that: A) => (self: A) => A; | ||
readonly combineMany: (collection: Iterable<A>) => (self: A) => A; | ||
} | ||
@@ -42,3 +42,3 @@ /** | ||
export interface SemigroupTypeLambda extends TypeLambda { | ||
type: Semigroup<this["Target"]>; | ||
readonly type: Semigroup<this["Target"]>; | ||
} | ||
@@ -82,3 +82,3 @@ /** | ||
*/ | ||
export declare const struct: <A>(semigroups: { [K in keyof A]: Semigroup<A[K]>; }) => Semigroup<{ [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const struct: <A>(semigroups: { [K in keyof A]: Semigroup<A[K]>; }) => Semigroup<{ readonly [K_1 in keyof A]: A[K_1]; }>; | ||
/** | ||
@@ -89,3 +89,3 @@ * Given a tuple of associatives returns an associative for the tuple. | ||
*/ | ||
export declare const tuple: <A extends any[]>(...semigroups: { [K in keyof A]: Semigroup<A[K]>; }) => Semigroup<A>; | ||
export declare const tuple: <A extends readonly any[]>(...semigroups: { [K in keyof A]: Semigroup<A[K]>; }) => Semigroup<Readonly<A>>; | ||
/** | ||
@@ -92,0 +92,0 @@ * @since 1.0.0 |
@@ -13,4 +13,4 @@ /** | ||
export interface SemiProduct<F extends TypeLambda> extends Invariant<F> { | ||
product: <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, [A, B]>; | ||
productMany: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, [A, ...Array<A>]>; | ||
readonly product: <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O1 | O2, E1 | E2, readonly [A, B]>; | ||
readonly productMany: <R, O, E, A>(collection: Iterable<Kind<F, R, O, E, A>>) => (self: Kind<F, R, O, E, A>) => Kind<F, R, O, E, readonly [A, ...Array<A>]>; | ||
} | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export declare const productComposition: <F extends TypeLambda, G extends TypeLambda>(F: SemiApplicative<F>, G: SemiProduct<G>) => <FR2, FO2, FE2, GR2, GO2, GE2, B>(that: Kind<F, FR2, FO2, FE2, Kind<G, GR2, GO2, GE2, B>>) => <FR1, FO1, FE1, GR1, GO1, GE1, A>(self: Kind<F, FR1, FO1, FE1, Kind<G, GR1, GO1, GE1, A>>) => Kind<F, FR1 & FR2, FO2 | FO1, FE2 | FE1, Kind<G, GR1 & GR2, GO2 | GO1, GE2 | GE1, [A, B]>>; | ||
export declare const productComposition: <F extends TypeLambda, G extends TypeLambda>(F: SemiApplicative<F>, G: SemiProduct<G>) => <FR2, FO2, FE2, GR2, GO2, GE2, B>(that: Kind<F, FR2, FO2, FE2, Kind<G, GR2, GO2, GE2, B>>) => <FR1, FO1, FE1, GR1, GO1, GE1, A>(self: Kind<F, FR1, FO1, FE1, Kind<G, GR1, GO1, GE1, A>>) => Kind<F, FR1 & FR2, FO2 | FO1, FE2 | FE1, Kind<G, GR1 & GR2, GO2 | GO1, GE2 | GE1, readonly [A, B]>>; | ||
/** | ||
@@ -29,3 +29,3 @@ * Returns a default `productMany` composition. | ||
*/ | ||
export declare const productManyComposition: <F extends TypeLambda, G extends TypeLambda>(F: SemiApplicative<F>, G: SemiProduct<G>) => <FR, FO, FE, GR, GO, GE, A>(collection: Iterable<Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, A>>>) => (self: Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, A>>) => Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, [A, ...A[]]>>; | ||
export declare const productManyComposition: <F extends TypeLambda, G extends TypeLambda>(F: SemiApplicative<F>, G: SemiProduct<G>) => <FR, FO, FE, GR, GO, GE, A>(collection: Iterable<Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, A>>>) => (self: Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, A>>) => Kind<F, FR, FO, FE, Kind<G, GR, GO, GE, readonly [A, ...A[]]>>; | ||
/** | ||
@@ -37,15 +37,15 @@ * Returns a default `productMany` implementation (useful for tests). | ||
*/ | ||
export declare const productMany: <F extends TypeLambda>(Covariant: Covariant<F>, product: <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, [A, B]>) => <R, O, E, A_1>(collection: Iterable<Kind<F, R, O, E, A_1>>) => (self: Kind<F, R, O, E, A_1>) => Kind<F, R, O, E, [A_1, ...A_1[]]>; | ||
export declare const productMany: <F extends TypeLambda>(Covariant: Covariant<F>, product: <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, readonly [A, B]>) => <R, O, E, A_1>(collection: Iterable<Kind<F, R, O, E, A_1>>) => (self: Kind<F, R, O, E, A_1>) => Kind<F, R, O, E, readonly [A_1, ...A_1[]]>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const andThenBind: <F extends TypeLambda>(F: SemiProduct<F>) => <N extends string, A extends object, R2, O2, E2, B>(name: Exclude<N, keyof A>, that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, { [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; | ||
export declare const andThenBind: <F extends TypeLambda>(F: SemiProduct<F>) => <N extends string, A extends object, R2, O2, E2, B>(name: Exclude<N, keyof A>, that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const productFlatten: <F extends TypeLambda>(F: SemiProduct<F>) => <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A extends any[]>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, [...A, B]>; | ||
export declare const productFlatten: <F extends TypeLambda>(F: SemiProduct<F>) => <R2, O2, E2, B>(that: Kind<F, R2, O2, E2, B>) => <R1, O1, E1, A extends readonly any[]>(self: Kind<F, R1, O1, E1, A>) => Kind<F, R1 & R2, O2 | O1, E2 | E1, readonly [...A, B]>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const nonEmptyTuple: <F extends TypeLambda>(F: SemiProduct<F>) => <T extends [Kind<F, any, any, any, any>, ...Kind<F, any, any, any, any>[]]>(...components: T) => Kind<F, [T[number]] extends [Kind<F, infer R, any, any, any>] ? R : never, [T[number]] extends [Kind<F, any, infer O, any, any>] ? O : never, [T[number]] extends [Kind<F, any, any, infer E, any>] ? E : never, { [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>; | ||
export declare const nonEmptyTuple: <F extends TypeLambda>(F: SemiProduct<F>) => <T extends readonly [Kind<F, any, any, any, any>, ...Kind<F, any, any, any, any>[]]>(...components: T) => Kind<F, [T[number]] extends [Kind<F, infer R, any, any, any>] ? R : never, [T[number]] extends [Kind<F, any, infer O, any, any>] ? O : never, [T[number]] extends [Kind<F, any, any, infer E, any>] ? E : never, Readonly<{ [I in keyof T]: [T[I]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>>; | ||
type EnforceNonEmptyRecord<R> = keyof R extends never ? never : R; | ||
@@ -55,4 +55,4 @@ /** | ||
*/ | ||
export declare const nonEmptyStruct: <F extends TypeLambda>(F: SemiProduct<F>) => <R extends Record<string, Kind<F, any, any, any, any>>>(fields: EnforceNonEmptyRecord<R> & Record<string, Kind<F, any, any, any, any>>) => Kind<F, [R[keyof R]] extends [Kind<F, infer R_1, any, any, any>] ? R_1 : never, [R[keyof R]] extends [Kind<F, any, infer O, any, any>] ? O : never, [R[keyof R]] extends [Kind<F, any, any, infer E, any>] ? E : never, { [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>; | ||
export declare const nonEmptyStruct: <F extends TypeLambda>(F: SemiProduct<F>) => <R extends Readonly<Record<string, Kind<F, any, any, any, any>>>>(fields: EnforceNonEmptyRecord<R> & Record<string, Kind<F, any, any, any, any>>) => Kind<F, [R[keyof R]] extends [Kind<F, infer R_1, any, any, any>] ? R_1 : never, [R[keyof R]] extends [Kind<F, any, infer O, any, any>] ? O : never, [R[keyof R]] extends [Kind<F, any, any, infer E, any>] ? E : never, { readonly [K in keyof R]: [R[K]] extends [Kind<F, any, any, any, infer A>] ? A : never; }>; | ||
export {}; | ||
//# sourceMappingURL=SemiProduct.d.ts.map |
@@ -12,4 +12,4 @@ /** | ||
export interface Traversable<T extends TypeLambda> extends TypeClass<T> { | ||
traverse: <F extends TypeLambda>(F: Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>; | ||
sequence: <F extends TypeLambda>(F: Applicative<F>) => <TR, TO, TE, R, O, E, A>(self: Kind<T, TR, TO, TE, Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>; | ||
readonly traverse: <F extends TypeLambda>(F: Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>; | ||
readonly sequence: <F extends TypeLambda>(F: Applicative<F>) => <TR, TO, TE, R, O, E, A>(self: Kind<T, TR, TO, TE, Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>; | ||
} | ||
@@ -16,0 +16,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
244578