@fncts/base 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_cjs/collection/Iterable/api/traverseConc.cjs +4 -1
- package/_cjs/collection/Iterable/api/traverseConc.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/api.cjs +16 -3
- package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Dictionary/api.cjs +44 -13
- package/_cjs/collection/immutable/Dictionary/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +3 -3
- package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
- package/_cjs/data/CaseClass.cjs.map +1 -1
- package/_cjs/data/Cause/api.cjs +106 -66
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +10 -0
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Exit/api.cjs.map +1 -1
- package/_cjs/data/Struct/api.cjs +111 -9
- package/_cjs/data/Struct/api.cjs.map +1 -1
- package/_cjs/data/exceptions/InterruptedException.cjs.map +1 -1
- package/_cjs/optics/Traversal/definition.cjs +12 -14
- package/_cjs/optics/Traversal/definition.cjs.map +1 -1
- package/_cjs/typeclass/Showable/show.cjs +8 -8
- package/_cjs/typeclass/Showable/show.cjs.map +1 -1
- package/_cjs/util/AnsiFormat.cjs +7 -7
- package/_cjs/util/AnsiFormat.cjs.map +1 -1
- package/_mjs/collection/Iterable/api/traverseConc.mjs +4 -1
- package/_mjs/collection/Iterable/api/traverseConc.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api.mjs +12 -3
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Dictionary/api.mjs +34 -10
- package/_mjs/collection/immutable/Dictionary/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +3 -3
- package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
- package/_mjs/data/CaseClass.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +89 -58
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +5 -0
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Exit/api.mjs.map +1 -1
- package/_mjs/data/Struct/api.mjs +85 -4
- package/_mjs/data/Struct/api.mjs.map +1 -1
- package/_mjs/data/exceptions/InterruptedException.mjs.map +1 -1
- package/_mjs/optics/Traversal/definition.mjs +12 -13
- package/_mjs/optics/Traversal/definition.mjs.map +1 -1
- package/_mjs/typeclass/Showable/show.mjs +8 -8
- package/_mjs/typeclass/Showable/show.mjs.map +1 -1
- package/_mjs/util/AnsiFormat.mjs +7 -7
- package/_mjs/util/AnsiFormat.mjs.map +1 -1
- package/_src/collection/Iterable/api/traverseConc.ts +1 -1
- package/_src/collection/immutable/Conc/api.ts +9 -1
- package/_src/collection/immutable/Conc/definition.ts +0 -1
- package/_src/collection/immutable/Dictionary/api.ts +21 -0
- package/_src/data/CaseClass.ts +2 -2
- package/_src/data/Cause/api.ts +88 -63
- package/_src/data/Const/instances.ts +1 -1
- package/_src/data/Either/api.ts +5 -0
- package/_src/data/Exit/api.ts +1 -1
- package/_src/data/Struct/api.ts +102 -3
- package/_src/data/exceptions/InterruptedException.ts +1 -1
- package/_src/typeclass/MonadExcept.ts +1 -1
- package/_src/typeclass/Showable/show.ts +4 -3
- package/_src/util/AnsiFormat.ts +5 -5
- package/collection/immutable/Conc/api.d.ts +6 -0
- package/collection/immutable/Conc/definition.d.ts +4 -0
- package/collection/immutable/Dictionary/api.d.ts +16 -0
- package/collection/immutable/HashMap/definition.d.ts +1 -0
- package/collection/immutable/HashMap/internal.d.ts +1 -1
- package/collection/immutable/HashSet/definition.d.ts +1 -0
- package/collection/immutable/ImmutableArray/definition.d.ts +1 -0
- package/collection/immutable/ImmutableNonEmptyArray/definition.d.ts +1 -0
- package/collection/immutable/RoseTree/definition.d.ts +1 -0
- package/collection/immutable/SortedMap/iterator.d.ts +1 -1
- package/collection/immutable/Vector/definition.d.ts +3 -0
- package/collection/mutable/HashMap.d.ts +2 -1
- package/collection/mutable/HashSet.d.ts +1 -0
- package/collection/mutable/ListBuffer.d.ts +1 -0
- package/control/Eval/definition.d.ts +1 -0
- package/control/Z/definition.d.ts +1 -0
- package/data/Cause/api.d.ts +23 -1
- package/data/Const/definition.d.ts +1 -0
- package/data/Decoder/definition.d.ts +1 -0
- package/data/Either/api.d.ts +6 -0
- package/data/Either/definition.d.ts +1 -0
- package/data/Exit/definition.d.ts +1 -0
- package/data/Identity/definition.d.ts +1 -0
- package/data/Maybe/definition.d.ts +3 -0
- package/data/Struct/api.d.ts +58 -2
- package/data/exceptions/InterruptedException.d.ts +2 -2
- package/package.json +2 -2
- package/typeclass/Guard/definition.d.ts +1 -0
- package/typeclass/MonadExcept.d.ts +1 -1
- package/typeclass/Showable/show.d.ts +1 -0
package/_src/data/Exit/api.ts
CHANGED
@@ -5,7 +5,7 @@ import { ExitTag } from "./definition.js";
|
|
5
5
|
* @tsplus fluent fncts.Exit ap
|
6
6
|
*/
|
7
7
|
export function ap_<E, A, G, B>(fab: Exit<G, (a: A) => B>, fa: Exit<E, A>): Exit<E | G, B> {
|
8
|
-
return
|
8
|
+
return fab.flatMap((f) => fa.map((a) => f(a)));
|
9
9
|
}
|
10
10
|
|
11
11
|
/**
|
package/_src/data/Struct/api.ts
CHANGED
@@ -1,5 +1,97 @@
|
|
1
|
+
import type { Union } from "@fncts/typelevel";
|
2
|
+
|
3
|
+
import { Eq } from "@fncts/base/typeclass";
|
4
|
+
|
1
5
|
import { Struct } from "./definition.js";
|
2
6
|
|
7
|
+
export type EnsureLiteral<N> = string extends N ? never : [N] extends [Union.IntersectionOf<N>] ? N : never;
|
8
|
+
|
9
|
+
export type TestLiteral<N> = string extends N ? unknown : [N] extends [Union.IntersectionOf<N>] ? N : unknown;
|
10
|
+
|
11
|
+
export type EnsureNonexistentProperty<T, N extends string> = Extract<keyof T, N> extends never ? T : never;
|
12
|
+
|
13
|
+
export type EnsureLiteralKeys<O> = string extends keyof O ? never : O;
|
14
|
+
|
15
|
+
export type EnsureLiteralTuple<A extends ReadonlyArray<unknown>> = unknown extends {
|
16
|
+
[K in keyof A]: A[K] extends string ? TestLiteral<A[K]> : unknown;
|
17
|
+
}[number]
|
18
|
+
? never
|
19
|
+
: A;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @tsplus static fncts.StructOps __call
|
23
|
+
* @tsplus macro identity
|
24
|
+
*/
|
25
|
+
export function makeStruct<A>(a: A): Struct<A> {
|
26
|
+
return Struct.get(a);
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* @tsplus fluent fncts.Struct set
|
31
|
+
*/
|
32
|
+
export function set_<A, N extends string, B>(
|
33
|
+
self: Struct<A>,
|
34
|
+
key: EnsureLiteral<N>,
|
35
|
+
value: B,
|
36
|
+
): Struct<{ [P in Exclude<keyof A, N> | N]: P extends Exclude<keyof A, N> ? A[P] : B }> {
|
37
|
+
return Struct.get({ ...self.getStruct, [key]: value }) as Struct<any>;
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @tsplus fluent fncts.Struct hmap
|
42
|
+
*/
|
43
|
+
export function hmap_<A extends {}, F extends { [N in keyof A]: (a: A[N]) => any }>(
|
44
|
+
self: Struct<A>,
|
45
|
+
fs: F,
|
46
|
+
): Struct<{ readonly [K in keyof F]: ReturnType<F[K]> }> {
|
47
|
+
const keys = self.keys;
|
48
|
+
const out = {} as any;
|
49
|
+
for (const key of keys) {
|
50
|
+
out[key] = fs[key](unsafeCoerce(self.getStruct[key]));
|
51
|
+
}
|
52
|
+
return out;
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @tsplus fluent fncts.Struct modify
|
57
|
+
*/
|
58
|
+
export function modify_<A, N extends keyof A, B>(
|
59
|
+
self: Struct<A>,
|
60
|
+
key: N,
|
61
|
+
f: (a: A[N]) => B,
|
62
|
+
): Struct<{ readonly [P in Exclude<keyof A, N> | N]: P extends Exclude<keyof A, N> ? A[P] : B }> {
|
63
|
+
return Struct.get({ ...self.getStruct, [key]: f(self.getStruct[key]) }) as Struct<any>;
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* @tsplus fluent fncts.Struct pick
|
68
|
+
*/
|
69
|
+
export function pick_<A, N extends ReadonlyArray<keyof A>>(
|
70
|
+
self: Struct<A>,
|
71
|
+
keys: [...N],
|
72
|
+
): Struct<{ readonly [P in N[number]]: A[P] }> {
|
73
|
+
const out = {} as Pick<A, N[number]>;
|
74
|
+
for (const key of keys) {
|
75
|
+
out[key] = self.getStruct[key];
|
76
|
+
}
|
77
|
+
return Struct.get(out);
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* @tsplus fluent fncts.Struct omit
|
82
|
+
*/
|
83
|
+
export function omit_<A extends {}, N extends ReadonlyArray<keyof A>>(
|
84
|
+
self: Struct<A>,
|
85
|
+
keys: [...N],
|
86
|
+
): Struct<{ readonly [P in Exclude<keyof A, N[number]>]: A[P] }> {
|
87
|
+
const newKeys = keys.asImmutableArray.difference(self.keys.asImmutableArray, Eq({ equals: (x, y) => x === y }));
|
88
|
+
const out = {} as any;
|
89
|
+
for (const key of newKeys) {
|
90
|
+
out[key] = self.getStruct[key];
|
91
|
+
}
|
92
|
+
return Struct.get(out);
|
93
|
+
}
|
94
|
+
|
3
95
|
/**
|
4
96
|
* @tsplus fluent fncts.Struct map
|
5
97
|
*/
|
@@ -8,15 +100,22 @@ export function map_<A, B>(self: Struct<A>, f: (a: A[keyof A]) => B): Struct<Rec
|
|
8
100
|
const keys = Object.keys(self);
|
9
101
|
for (let i = 0; i < keys.length; i++) {
|
10
102
|
const k = keys[i]! as keyof A;
|
11
|
-
out[k] = f(self.
|
103
|
+
out[k] = f(self.getStruct[k]);
|
12
104
|
}
|
13
105
|
return Struct.get(out);
|
14
106
|
}
|
15
107
|
|
16
108
|
/**
|
17
|
-
* @tsplus getter fncts.Struct
|
109
|
+
* @tsplus getter fncts.Struct keys
|
110
|
+
*/
|
111
|
+
export function keys<A extends {}>(self: Struct<A>): ReadonlyArray<keyof A> {
|
112
|
+
return unsafeCoerce(Object.keys(self.getStruct));
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @tsplus getter fncts.Struct getStruct
|
18
117
|
* @tsplus macro identity
|
19
118
|
*/
|
20
|
-
export function
|
119
|
+
export function getStruct<A>(self: Struct<A>): A {
|
21
120
|
return Struct.reverseGet(self);
|
22
121
|
}
|
@@ -5,7 +5,7 @@ export type InterruptedExceptionTypeId = typeof InterruptedExceptionTypeId;
|
|
5
5
|
|
6
6
|
export class InterruptedException {
|
7
7
|
readonly _typeId: InterruptedExceptionTypeId = InterruptedExceptionTypeId;
|
8
|
-
constructor(readonly message
|
8
|
+
constructor(readonly message?: string) {}
|
9
9
|
}
|
10
10
|
|
11
11
|
export function isInterruptedException(u: unknown): u is InterruptedException {
|
@@ -4,7 +4,7 @@ import type { Monad } from "@fncts/base/typeclass/Monad";
|
|
4
4
|
/**
|
5
5
|
* @tsplus type fncts.MonadExcept
|
6
6
|
*/
|
7
|
-
export interface MonadExcept<F> extends Monad<F>, ApplicativeExcept<F> {}
|
7
|
+
export interface MonadExcept<F extends HKT> extends Monad<F>, ApplicativeExcept<F> {}
|
8
8
|
|
9
9
|
/**
|
10
10
|
* @tsplus type fncts.MonadExceptOps
|
@@ -400,9 +400,9 @@ function showRaw(value: object, typedArray?: string): ShowComputation {
|
|
400
400
|
case "InspectionInfo": {
|
401
401
|
base = Z.succeedNow(info.base);
|
402
402
|
keys = Conc.from(info.keys)
|
403
|
-
.traverse((key) => showProperty(value, key, info.extrasType))
|
403
|
+
.traverse((key) => showProperty(value, key, info.extrasType), Z.Applicative)
|
404
404
|
.crossWith(
|
405
|
-
info.protoProps.traverse((key) => showProperty(value, key, PROTO_TYPE)),
|
405
|
+
info.protoProps.traverse((key) => showProperty(value, key, PROTO_TYPE), Z.Applicative),
|
406
406
|
(k1, k2) => k1.concat(k2),
|
407
407
|
);
|
408
408
|
indices = info.formatter(value);
|
@@ -546,6 +546,7 @@ function showMap(value: Map<unknown, unknown>): ShowComputationChunk {
|
|
546
546
|
.apSecond(
|
547
547
|
(value as Iterable<[unknown, unknown]>).traverseToConc(([k, v]) =>
|
548
548
|
_show(k).crossWith(_show(v), (k, v) => `${k} => ${v}`),
|
549
|
+
Z.Applicative
|
549
550
|
),
|
550
551
|
)
|
551
552
|
.apFirst(
|
@@ -577,7 +578,7 @@ function showTypedArray(value: TypedArray): ShowComputationChunk {
|
|
577
578
|
.apSecond(
|
578
579
|
Z.succeedNow(output).flatMap((output) =>
|
579
580
|
Conc("BYTES_PER_ELEMENT", "length", "byteLength", "byteOffset", "buffer")
|
580
|
-
.traverse((key) => _show(value[key as keyof TypedArray]).map((shown) => `[${key}]: ${shown}`))
|
581
|
+
.traverse((key) => _show(value[key as keyof TypedArray]).map((shown) => `[${key}]: ${shown}`), Z.Applicative)
|
581
582
|
.map((shownKeys) => output.concat(shownKeys)),
|
582
583
|
),
|
583
584
|
)
|
package/_src/util/AnsiFormat.ts
CHANGED
@@ -246,11 +246,11 @@ function generateStyles() {
|
|
246
246
|
}));
|
247
247
|
|
248
248
|
return {
|
249
|
-
...Struct
|
250
|
-
...Struct
|
251
|
-
...Struct
|
252
|
-
...Struct
|
253
|
-
...Struct
|
249
|
+
...Struct(modifiers).map(([open, close]) => style(open, close)).getStruct,
|
250
|
+
...Struct(colors).map(([open, close]) => style(open, close)).getStruct,
|
251
|
+
...Struct(colorsBright).map(([open, close]) => style(open, close)).getStruct,
|
252
|
+
...Struct(colorsBg).map(([open, close]) => style(open, close)).getStruct,
|
253
|
+
...Struct(colorsBrightBg).map(([open, close]) => style(open, close)).getStruct,
|
254
254
|
};
|
255
255
|
}
|
256
256
|
|
@@ -5,6 +5,7 @@ import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
5
5
|
import { Predicate, PredicateWithIndex } from "@fncts/base/data/Predicate/definition";
|
6
6
|
import { Refinement, RefinementWithIndex } from "@fncts/base/data/Refinement/definition";
|
7
7
|
import { HKT } from "@fncts/typelevel/HKT";
|
8
|
+
import { Byte } from "@fncts/base/data/Byte";
|
8
9
|
import type { ConcF } from "@fncts/base/collection/immutable/Conc/definition";
|
9
10
|
import type { Eq } from "@fncts/base/typeclass";
|
10
11
|
import type * as P from "@fncts/base/typeclass";
|
@@ -299,6 +300,11 @@ export declare const traverse: P.Traversable<ConcF>["traverse"];
|
|
299
300
|
*/
|
300
301
|
export declare function traverseWithIndex<G extends HKT, KG, QG, WG, XG, IG, SG, RG, EG, A, B>(self: Conc<A>, f: (i: number, a: A) => HKT.Kind<G, KG, QG, WG, XG, IG, SG, RG, EG, B>,
|
301
302
|
/** @tsplus auto */ G: P.Applicative<G>): HKT.Kind<G, KG, QG, WG, XG, IG, SG, RG, EG, Conc<B>>;
|
303
|
+
/**
|
304
|
+
* @tsplus getter fncts.Conc toBuffer
|
305
|
+
* @tsplus location "@fncts/base/collection/immutable/Conc/api"
|
306
|
+
*/
|
307
|
+
export declare function toBuffer(self: Conc<Byte>): Uint8Array;
|
302
308
|
/**
|
303
309
|
* @tsplus fluent fncts.ConcOps unfold
|
304
310
|
* @tsplus location "@fncts/base/collection/immutable/Conc/api"
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import { Hashable } from "@fncts/base/typeclass/Hashable";
|
2
2
|
import { Equatable } from "@fncts/base/typeclass/Equatable";
|
3
|
+
import { HKT } from "@fncts/typelevel/HKT";
|
4
|
+
import { isByte } from "@fncts/base/util/predicates";
|
5
|
+
import { IndexOutOfBoundsError, ArrayIndexOutOfBoundsError } from "@fncts/base/data/exceptions";
|
6
|
+
import { unsafeCoerce } from "@fncts/base/data/function/api";
|
3
7
|
export declare const BUFFER_SIZE = 64;
|
4
8
|
export declare const UPDATE_BUFFER_SIZE = 256;
|
5
9
|
export declare const ConcTypeId: unique symbol;
|
@@ -1,9 +1,20 @@
|
|
1
1
|
import { Dictionary } from "@fncts/base/collection/immutable/Dictionary/definition";
|
2
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
3
|
+
/**
|
4
|
+
* @tsplus fluent fncts.Dictionary foldLeft
|
5
|
+
* @tsplus location "@fncts/base/collection/immutable/Dictionary/api"
|
6
|
+
*/
|
7
|
+
export declare function foldLeft_<A, B>(self: Dictionary<A>, b: B, f: (b: B, a: A) => B): B;
|
2
8
|
/**
|
3
9
|
* @tsplus fluent fncts.Dictionary foldLeftWithIndex
|
4
10
|
* @tsplus location "@fncts/base/collection/immutable/Dictionary/api"
|
5
11
|
*/
|
6
12
|
export declare function foldLeftWithIndex_<A, B>(self: Dictionary<A>, b: B, f: (k: string, b: B, a: A) => B): B;
|
13
|
+
/**
|
14
|
+
* @tsplus fluent fncts.Dictionary get
|
15
|
+
* @tsplus location "@fncts/base/collection/immutable/Dictionary/api"
|
16
|
+
*/
|
17
|
+
export declare function get_<A>(self: Dictionary<A>, key: string): Maybe<A>;
|
7
18
|
/**
|
8
19
|
* @tsplus getter fncts.Dictionary keys
|
9
20
|
* @tsplus location "@fncts/base/collection/immutable/Dictionary/api"
|
@@ -25,3 +36,8 @@ export declare function mapWithIndex_<A, B>(self: Dictionary<A>, f: (k: string,
|
|
25
36
|
* @tsplus location "@fncts/base/collection/immutable/Dictionary/api"
|
26
37
|
*/
|
27
38
|
export declare function toRecord<A>(self: Dictionary<A>): Record<string, A>;
|
39
|
+
/**
|
40
|
+
* @tsplus fluent fncts.Dictionary unsafeGet
|
41
|
+
* @tsplus location "@fncts/base/collection/immutable/Dictionary/api"
|
42
|
+
*/
|
43
|
+
export declare function unsafeGet_<A>(self: Dictionary<A>, key: string): A | undefined;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Hashable } from "@fncts/base/typeclass/Hashable";
|
2
2
|
import { Equatable } from "@fncts/base/typeclass/Equatable";
|
3
|
+
import { HKT } from "@fncts/typelevel/HKT";
|
3
4
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
4
5
|
import type { Node } from "@fncts/base/collection/immutable/HashMap/internal";
|
5
6
|
import type { HashEq } from "@fncts/base/typeclass";
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Equatable } from "@fncts/base/typeclass/Equatable";
|
2
2
|
import { Hashable } from "@fncts/base/typeclass/Hashable";
|
3
|
+
import { HKT } from "@fncts/typelevel/HKT";
|
3
4
|
export declare const ImmutableArrayTypeId: unique symbol;
|
4
5
|
export declare type ImmutableArrayTypeId = typeof ImmutableArrayTypeId;
|
5
6
|
export interface ImmutableArrayF extends ImmutableArray<any> {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Hashable } from "@fncts/base/typeclass/Hashable";
|
2
2
|
import { Equatable } from "@fncts/base/typeclass/Equatable";
|
3
|
+
import { HKT } from "@fncts/typelevel/HKT";
|
3
4
|
import { Vector } from "@fncts/base/collection/immutable/Vector";
|
4
5
|
export declare const RoseTreeTypeId: unique symbol;
|
5
6
|
export declare type RoseTreeTypeId = typeof RoseTreeTypeId;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SortedMap } from "@fncts/base/collection/immutable/SortedMap/definition";
|
2
|
-
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
2
|
+
import { Maybe, Nothing, Just } from "@fncts/base/data/Maybe/definition";
|
3
3
|
import type { RBNode } from "@fncts/base/collection/immutable/SortedMap/node";
|
4
4
|
import type { Ord } from "@fncts/base/typeclass";
|
5
5
|
import { Node } from "@fncts/base/collection/immutable/SortedMap/node";
|
@@ -1,3 +1,6 @@
|
|
1
|
+
import { HKT } from "@fncts/typelevel/HKT";
|
2
|
+
import { Hashable } from "@fncts/base/typeclass/Hashable";
|
3
|
+
import { Equatable } from "@fncts/base/typeclass/Equatable";
|
1
4
|
import type { Node } from "@fncts/base/collection/immutable/Vector/internal";
|
2
5
|
export declare const VectorTypeId: unique symbol;
|
3
6
|
export declare type VectorTypeId = typeof VectorTypeId;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
1
|
+
import { Maybe, Just, Nothing } from "@fncts/base/data/Maybe/definition";
|
2
|
+
import { unsafeCoerce } from "@fncts/base/data/function/api";
|
2
3
|
import { HashEq } from "@fncts/base/typeclass/HashEq";
|
3
4
|
/**
|
4
5
|
* @tsplus type fncts.MutableHashMap
|
package/data/Cause/api.d.ts
CHANGED
@@ -6,6 +6,7 @@ import { Either } from "@fncts/base/data/Either/definition";
|
|
6
6
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
7
7
|
import { Predicate } from "@fncts/base/data/Predicate/definition";
|
8
8
|
import { FiberId } from "@fncts/base/data/FiberId/definition";
|
9
|
+
import { HashSet } from "@fncts/base/collection/immutable/HashSet/definition";
|
9
10
|
import { Both, Cause, Fail, Halt, Interrupt, Then } from "./definition.js";
|
10
11
|
/**
|
11
12
|
* @tsplus fluent fncts.Cause as
|
@@ -187,6 +188,12 @@ export declare function isThen<E>(self: Cause<E>): self is Then<E>;
|
|
187
188
|
* @tsplus location "@fncts/base/data/Cause/api"
|
188
189
|
*/
|
189
190
|
export declare function isInterrupt<E>(self: Cause<E>): self is Interrupt;
|
191
|
+
/**
|
192
|
+
* Determines if the `Cause` contains an interruption.
|
193
|
+
* @tsplus getter fncts.Cause isInterrupted
|
194
|
+
* @tsplus location "@fncts/base/data/Cause/api"
|
195
|
+
*/
|
196
|
+
export declare function isInterrupted<E>(self: Cause<E>): boolean;
|
190
197
|
/**
|
191
198
|
* A type-guard matching `Traced`
|
192
199
|
* @tsplus getter fncts.Cause isTraced
|
@@ -211,7 +218,7 @@ export declare function interruptOption<E>(self: Cause<E>): Maybe<FiberId>;
|
|
211
218
|
* @tsplus getter fncts.Cause interruptors
|
212
219
|
* @tsplus location "@fncts/base/data/Cause/api"
|
213
220
|
*/
|
214
|
-
export declare function interruptors<E>(self: Cause<E>):
|
221
|
+
export declare function interruptors<E>(self: Cause<E>): HashSet<FiberId>;
|
215
222
|
/**
|
216
223
|
* Determines if the `Cause` contains only interruptions and not any `Halt` or
|
217
224
|
* `Fail` causes.
|
@@ -248,6 +255,14 @@ export declare function stackless<E>(cause: Cause<E>, stackless: boolean): Cause
|
|
248
255
|
* @tsplus location "@fncts/base/data/Cause/api"
|
249
256
|
*/
|
250
257
|
export declare function stripFailures<A>(self: Cause<A>): Cause<never>;
|
258
|
+
/**
|
259
|
+
* Remove all `Halt` causes that the specified partial function is defined at,
|
260
|
+
* returning `Just` with the remaining causes or `Nothing` if there are no
|
261
|
+
* remaining causes.
|
262
|
+
* @tsplus fluent fncts.Cause stripSomeDefects
|
263
|
+
* @tsplus location "@fncts/base/data/Cause/api"
|
264
|
+
*/
|
265
|
+
export declare function stripSomeDefects<E>(self: Cause<E>, p: Predicate<unknown>): Maybe<Cause<E>>;
|
251
266
|
/**
|
252
267
|
* Converts the specified `Cause<Either<E, A>>` to an `Either<Cause<E>, A>`.
|
253
268
|
* @tsplus getter fncts.Cause sequenceCauseEither
|
@@ -260,6 +275,13 @@ export declare function sequenceCauseEither<E, A>(self: Cause<Either<E, A>>): Ei
|
|
260
275
|
* @tsplus location "@fncts/base/data/Cause/api"
|
261
276
|
*/
|
262
277
|
export declare function sequenceCauseMaybe<E>(self: Cause<Maybe<E>>): Maybe<Cause<E>>;
|
278
|
+
/**
|
279
|
+
* Squashes a `Cause` down to a single `Error`, chosen to be the
|
280
|
+
* "most important" `Error`.
|
281
|
+
* @tsplus fluent fncts.Cause squashWith
|
282
|
+
* @tsplus location "@fncts/base/data/Cause/api"
|
283
|
+
*/
|
284
|
+
export declare function squashWith_<E>(self: Cause<E>, f: (e: E) => unknown): unknown;
|
263
285
|
/**
|
264
286
|
* Constructs a `Cause` from two `Cause`s, representing sequential failures.
|
265
287
|
* @note If one of the `Cause`s is `Empty`, the non-empty `Cause` is returned
|
package/data/Either/api.d.ts
CHANGED
@@ -87,6 +87,12 @@ export declare function isRight<E, A>(self: Either<E, A>): self is Right<A>;
|
|
87
87
|
* @tsplus location "@fncts/base/data/Either/api"
|
88
88
|
*/
|
89
89
|
export declare function map_<E, A, B>(self: Either<E, A>, f: (a: A) => B): Either<E, B>;
|
90
|
+
/**
|
91
|
+
* @tsplus static fncts.EitherOps map
|
92
|
+
* @tsplus pipeable fncts.Either map
|
93
|
+
* @tsplus location "@fncts/base/data/Either/api"
|
94
|
+
*/
|
95
|
+
export declare const map: <A, B>(f: (a: A) => B) => <E>(self: import("./definition.js").Either<E, A>) => import("./definition.js").Either<E, B>;
|
90
96
|
/**
|
91
97
|
* @tsplus fluent fncts.Either mapLeft
|
92
98
|
* @tsplus location "@fncts/base/data/Either/api"
|
package/data/Struct/api.d.ts
CHANGED
@@ -1,12 +1,68 @@
|
|
1
|
+
import type { Union } from "@fncts/typelevel";
|
1
2
|
import { Struct } from "./definition.js";
|
3
|
+
export declare type EnsureLiteral<N> = string extends N ? never : [N] extends [Union.IntersectionOf<N>] ? N : never;
|
4
|
+
export declare type TestLiteral<N> = string extends N ? unknown : [N] extends [Union.IntersectionOf<N>] ? N : unknown;
|
5
|
+
export declare type EnsureNonexistentProperty<T, N extends string> = Extract<keyof T, N> extends never ? T : never;
|
6
|
+
export declare type EnsureLiteralKeys<O> = string extends keyof O ? never : O;
|
7
|
+
export declare type EnsureLiteralTuple<A extends ReadonlyArray<unknown>> = unknown extends {
|
8
|
+
[K in keyof A]: A[K] extends string ? TestLiteral<A[K]> : unknown;
|
9
|
+
}[number] ? never : A;
|
10
|
+
/**
|
11
|
+
* @tsplus static fncts.StructOps __call
|
12
|
+
* @tsplus macro identity
|
13
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
14
|
+
*/
|
15
|
+
export declare function makeStruct<A>(a: A): Struct<A>;
|
16
|
+
/**
|
17
|
+
* @tsplus fluent fncts.Struct set
|
18
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
19
|
+
*/
|
20
|
+
export declare function set_<A, N extends string, B>(self: Struct<A>, key: EnsureLiteral<N>, value: B): Struct<{
|
21
|
+
[P in Exclude<keyof A, N> | N]: P extends Exclude<keyof A, N> ? A[P] : B;
|
22
|
+
}>;
|
23
|
+
/**
|
24
|
+
* @tsplus fluent fncts.Struct hmap
|
25
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
26
|
+
*/
|
27
|
+
export declare function hmap_<A extends {}, F extends {
|
28
|
+
[N in keyof A]: (a: A[N]) => any;
|
29
|
+
}>(self: Struct<A>, fs: F): Struct<{
|
30
|
+
readonly [K in keyof F]: ReturnType<F[K]>;
|
31
|
+
}>;
|
32
|
+
/**
|
33
|
+
* @tsplus fluent fncts.Struct modify
|
34
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
35
|
+
*/
|
36
|
+
export declare function modify_<A, N extends keyof A, B>(self: Struct<A>, key: N, f: (a: A[N]) => B): Struct<{
|
37
|
+
readonly [P in Exclude<keyof A, N> | N]: P extends Exclude<keyof A, N> ? A[P] : B;
|
38
|
+
}>;
|
39
|
+
/**
|
40
|
+
* @tsplus fluent fncts.Struct pick
|
41
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
42
|
+
*/
|
43
|
+
export declare function pick_<A, N extends ReadonlyArray<keyof A>>(self: Struct<A>, keys: [...N]): Struct<{
|
44
|
+
readonly [P in N[number]]: A[P];
|
45
|
+
}>;
|
46
|
+
/**
|
47
|
+
* @tsplus fluent fncts.Struct omit
|
48
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
49
|
+
*/
|
50
|
+
export declare function omit_<A extends {}, N extends ReadonlyArray<keyof A>>(self: Struct<A>, keys: [...N]): Struct<{
|
51
|
+
readonly [P in Exclude<keyof A, N[number]>]: A[P];
|
52
|
+
}>;
|
2
53
|
/**
|
3
54
|
* @tsplus fluent fncts.Struct map
|
4
55
|
* @tsplus location "@fncts/base/data/Struct/api"
|
5
56
|
*/
|
6
57
|
export declare function map_<A, B>(self: Struct<A>, f: (a: A[keyof A]) => B): Struct<Record<keyof A, B>>;
|
7
58
|
/**
|
8
|
-
* @tsplus getter fncts.Struct
|
59
|
+
* @tsplus getter fncts.Struct keys
|
60
|
+
* @tsplus location "@fncts/base/data/Struct/api"
|
61
|
+
*/
|
62
|
+
export declare function keys<A extends {}>(self: Struct<A>): ReadonlyArray<keyof A>;
|
63
|
+
/**
|
64
|
+
* @tsplus getter fncts.Struct getStruct
|
9
65
|
* @tsplus macro identity
|
10
66
|
* @tsplus location "@fncts/base/data/Struct/api"
|
11
67
|
*/
|
12
|
-
export declare function
|
68
|
+
export declare function getStruct<A>(self: Struct<A>): A;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
export declare const InterruptedExceptionTypeId: unique symbol;
|
2
2
|
export declare type InterruptedExceptionTypeId = typeof InterruptedExceptionTypeId;
|
3
3
|
export declare class InterruptedException {
|
4
|
-
readonly message
|
4
|
+
readonly message?: string | undefined;
|
5
5
|
readonly _typeId: InterruptedExceptionTypeId;
|
6
|
-
constructor(message
|
6
|
+
constructor(message?: string | undefined);
|
7
7
|
}
|
8
8
|
export declare function isInterruptedException(u: unknown): u is InterruptedException;
|
package/package.json
CHANGED
@@ -5,7 +5,7 @@ import type { Monad } from "@fncts/base/typeclass/Monad";
|
|
5
5
|
/**
|
6
6
|
* @tsplus type fncts.MonadExcept
|
7
7
|
*/
|
8
|
-
export interface MonadExcept<F> extends Monad<F>, ApplicativeExcept<F> {
|
8
|
+
export interface MonadExcept<F extends HKT> extends Monad<F>, ApplicativeExcept<F> {
|
9
9
|
}
|
10
10
|
/**
|
11
11
|
* @tsplus type fncts.MonadExceptOps
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
|
2
|
+
import { CaseClass } from "@fncts/base/data/CaseClass";
|
2
3
|
import { Z } from "@fncts/base/control/Z/definition";
|
3
4
|
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
4
5
|
import type { StyleFunction } from "@fncts/base/typeclass/Showable/styles";
|