@fncts/base 0.0.27 → 0.0.28
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.cjs +3 -2
- package/_cjs/collection/Iterable/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/api.cjs +25 -12
- package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/api.cjs +9 -8
- package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/definition.cjs +3 -2
- package/_cjs/collection/immutable/HashMap/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/internal.cjs +7 -6
- package/_cjs/collection/immutable/HashMap/internal.cjs.map +1 -1
- package/_cjs/collection/immutable/HashSet/api.cjs +7 -6
- package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +18 -17
- package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/constructors.cjs +2 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/constructors.cjs.map +1 -1
- package/_cjs/collection/immutable/List/api.cjs +3 -2
- package/_cjs/collection/immutable/List/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Queue/api.cjs +7 -6
- package/_cjs/collection/immutable/Queue/api.cjs.map +1 -1
- package/_cjs/collection/immutable/SortedMap/api.cjs +23 -22
- package/_cjs/collection/immutable/SortedMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/SortedMap/iterator.cjs +7 -6
- package/_cjs/collection/immutable/SortedMap/iterator.cjs.map +1 -1
- package/_cjs/collection/mutable/HashMap.cjs +6 -19
- package/_cjs/collection/mutable/HashMap.cjs.map +1 -1
- package/_cjs/control/CompletablePromise.cjs +21 -0
- package/_cjs/control/CompletablePromise.cjs.map +1 -0
- package/_cjs/control/Z/api.cjs +1 -1
- package/_cjs/control/Z/api.cjs.map +1 -1
- package/_cjs/control/Z/runtime.cjs +2 -2
- package/_cjs/control/Z/runtime.cjs.map +1 -1
- package/_cjs/data/Cause/api/fold.cjs +8 -7
- package/_cjs/data/Cause/api/fold.cjs.map +1 -1
- package/_cjs/data/Cause/api.cjs +80 -79
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/DatumEither/api.cjs +5 -4
- package/_cjs/data/DatumEither/api.cjs.map +1 -1
- package/_cjs/data/Decoder/api.cjs +2 -1
- package/_cjs/data/Decoder/api.cjs.map +1 -1
- package/_cjs/data/Either/api/alignWith.cjs +2 -1
- package/_cjs/data/Either/api/alignWith.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +17 -16
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Either/constructors.cjs +10 -9
- package/_cjs/data/Either/constructors.cjs.map +1 -1
- package/_cjs/data/Either/definition.cjs +16 -12
- package/_cjs/data/Either/definition.cjs.map +1 -1
- package/_cjs/data/Either/instances.cjs +7 -6
- package/_cjs/data/Either/instances.cjs.map +1 -1
- package/_cjs/data/EitherT/api.cjs +4 -3
- package/_cjs/data/EitherT/api.cjs.map +1 -1
- package/_cjs/data/Eq/api.cjs +20 -0
- package/_cjs/data/Eq/api.cjs.map +1 -0
- package/_cjs/data/Eq.cjs +11 -0
- package/_cjs/data/Eq.cjs.map +1 -1
- package/_cjs/data/Equatable/api.cjs +27 -8
- package/_cjs/data/Equatable/api.cjs.map +1 -1
- package/_cjs/data/Equatable/definition.cjs +1 -1
- package/_cjs/data/Equatable/definition.cjs.map +1 -1
- package/_cjs/data/Exit/api.cjs +32 -6
- package/_cjs/data/Exit/api.cjs.map +1 -1
- package/_cjs/data/Exit/constructors.cjs +13 -12
- package/_cjs/data/Exit/constructors.cjs.map +1 -1
- package/_cjs/data/Exit/definition.cjs +11 -6
- package/_cjs/data/Exit/definition.cjs.map +1 -1
- package/_cjs/data/Interval.cjs +2 -1
- package/_cjs/data/Interval.cjs.map +1 -1
- package/_cjs/data/Maybe/api.cjs +8 -7
- package/_cjs/data/Maybe/api.cjs.map +1 -1
- package/_cjs/data/Maybe/constructors.cjs +11 -11
- package/_cjs/data/Maybe/constructors.cjs.map +1 -1
- package/_cjs/data/Maybe/definition.cjs +10 -5
- package/_cjs/data/Maybe/definition.cjs.map +1 -1
- package/_cjs/data/Maybe/instances.cjs +2 -1
- package/_cjs/data/Maybe/instances.cjs.map +1 -1
- package/_cjs/data/These/destructors.cjs +3 -2
- package/_cjs/data/These/destructors.cjs.map +1 -1
- package/_cjs/data/exceptions/IOError.cjs +25 -0
- package/_cjs/data/exceptions/IOError.cjs.map +1 -0
- package/_cjs/data/exceptions/NoSuchElementError.cjs.map +1 -1
- package/_cjs/data/exceptions.cjs +11 -0
- package/_cjs/data/exceptions.cjs.map +1 -1
- package/_cjs/optics/Lens/definition.cjs +2 -1
- package/_cjs/optics/Lens/definition.cjs.map +1 -1
- package/_cjs/optics/Prism/api/just.cjs +2 -1
- package/_cjs/optics/Prism/api/just.cjs.map +1 -1
- package/_cjs/typeclass/ApplicativeExcept.cjs +2 -1
- package/_cjs/typeclass/ApplicativeExcept.cjs.map +1 -1
- package/_cjs/typeclass/Semialign.cjs +2 -1
- package/_cjs/typeclass/Semialign.cjs.map +1 -1
- package/_cjs/typeclass/Witherable.cjs +2 -1
- package/_cjs/typeclass/Witherable.cjs.map +1 -1
- package/_cjs/typeclass/WitherableWithIndex.cjs +2 -1
- package/_cjs/typeclass/WitherableWithIndex.cjs.map +1 -1
- package/_cjs/types.cjs +0 -11
- package/_cjs/types.cjs.map +1 -1
- package/_mjs/collection/Iterable/api.mjs +3 -2
- package/_mjs/collection/Iterable/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api.mjs +24 -12
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/api.mjs +9 -8
- package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/definition.mjs +3 -2
- package/_mjs/collection/immutable/HashMap/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/internal.mjs +7 -6
- package/_mjs/collection/immutable/HashMap/internal.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/api.mjs +7 -6
- package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +18 -17
- package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/constructors.mjs +2 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/constructors.mjs.map +1 -1
- package/_mjs/collection/immutable/List/api.mjs +3 -2
- package/_mjs/collection/immutable/List/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Queue/api.mjs +7 -6
- package/_mjs/collection/immutable/Queue/api.mjs.map +1 -1
- package/_mjs/collection/immutable/SortedMap/api.mjs +23 -22
- package/_mjs/collection/immutable/SortedMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/SortedMap/iterator.mjs +7 -6
- package/_mjs/collection/immutable/SortedMap/iterator.mjs.map +1 -1
- package/_mjs/collection/mutable/HashMap.mjs +6 -5
- package/_mjs/collection/mutable/HashMap.mjs.map +1 -1
- package/_mjs/control/CompletablePromise.mjs +15 -0
- package/_mjs/control/CompletablePromise.mjs.map +1 -0
- package/_mjs/control/Z/api.mjs +1 -1
- package/_mjs/control/Z/api.mjs.map +1 -1
- package/_mjs/control/Z/runtime.mjs +2 -2
- package/_mjs/control/Z/runtime.mjs.map +1 -1
- package/_mjs/data/Cause/api/fold.mjs +8 -7
- package/_mjs/data/Cause/api/fold.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +80 -79
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/DatumEither/api.mjs +5 -4
- package/_mjs/data/DatumEither/api.mjs.map +1 -1
- package/_mjs/data/Decoder/api.mjs +2 -1
- package/_mjs/data/Decoder/api.mjs.map +1 -1
- package/_mjs/data/Either/api/alignWith.mjs +2 -1
- package/_mjs/data/Either/api/alignWith.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +17 -16
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/constructors.mjs +10 -9
- package/_mjs/data/Either/constructors.mjs.map +1 -1
- package/_mjs/data/Either/definition.mjs +15 -11
- package/_mjs/data/Either/definition.mjs.map +1 -1
- package/_mjs/data/Either/instances.mjs +7 -6
- package/_mjs/data/Either/instances.mjs.map +1 -1
- package/_mjs/data/EitherT/api.mjs +4 -3
- package/_mjs/data/EitherT/api.mjs.map +1 -1
- package/_mjs/data/Eq/api.mjs +12 -0
- package/_mjs/data/Eq/api.mjs.map +1 -0
- package/_mjs/data/Eq.mjs +1 -0
- package/_mjs/data/Eq.mjs.map +1 -1
- package/_mjs/data/Equatable/api.mjs +26 -7
- package/_mjs/data/Equatable/api.mjs.map +1 -1
- package/_mjs/data/Equatable/definition.mjs +1 -1
- package/_mjs/data/Equatable/definition.mjs.map +1 -1
- package/_mjs/data/Exit/api.mjs +30 -6
- package/_mjs/data/Exit/api.mjs.map +1 -1
- package/_mjs/data/Exit/constructors.mjs +13 -12
- package/_mjs/data/Exit/constructors.mjs.map +1 -1
- package/_mjs/data/Exit/definition.mjs +11 -6
- package/_mjs/data/Exit/definition.mjs.map +1 -1
- package/_mjs/data/Interval.mjs +2 -1
- package/_mjs/data/Interval.mjs.map +1 -1
- package/_mjs/data/Maybe/api.mjs +8 -7
- package/_mjs/data/Maybe/api.mjs.map +1 -1
- package/_mjs/data/Maybe/constructors.mjs +11 -11
- package/_mjs/data/Maybe/constructors.mjs.map +1 -1
- package/_mjs/data/Maybe/definition.mjs +10 -5
- package/_mjs/data/Maybe/definition.mjs.map +1 -1
- package/_mjs/data/Maybe/instances.mjs +2 -1
- package/_mjs/data/Maybe/instances.mjs.map +1 -1
- package/_mjs/data/These/destructors.mjs +3 -2
- package/_mjs/data/These/destructors.mjs.map +1 -1
- package/_mjs/data/exceptions/IOError.mjs +14 -0
- package/_mjs/data/exceptions/IOError.mjs.map +1 -0
- package/_mjs/data/exceptions/NoSuchElementError.mjs.map +1 -1
- package/_mjs/data/exceptions.mjs +1 -0
- package/_mjs/data/exceptions.mjs.map +1 -1
- package/_mjs/optics/Lens/definition.mjs +2 -1
- package/_mjs/optics/Lens/definition.mjs.map +1 -1
- package/_mjs/optics/Prism/api/just.mjs +2 -1
- package/_mjs/optics/Prism/api/just.mjs.map +1 -1
- package/_mjs/typeclass/ApplicativeExcept.mjs +2 -1
- package/_mjs/typeclass/ApplicativeExcept.mjs.map +1 -1
- package/_mjs/typeclass/Semialign.mjs +2 -1
- package/_mjs/typeclass/Semialign.mjs.map +1 -1
- package/_mjs/typeclass/Witherable.mjs +2 -1
- package/_mjs/typeclass/Witherable.mjs.map +1 -1
- package/_mjs/typeclass/WitherableWithIndex.mjs +2 -1
- package/_mjs/typeclass/WitherableWithIndex.mjs.map +1 -1
- package/_mjs/types.mjs +0 -1
- package/_mjs/types.mjs.map +1 -1
- package/_src/collection/immutable/Conc/api.ts +12 -0
- package/_src/control/CompletablePromise.ts +23 -0
- package/_src/control.ts +1 -0
- package/_src/data/Either/constructors.ts +4 -4
- package/_src/data/Either/definition.ts +13 -6
- package/_src/data/Eq/api.ts +8 -0
- package/_src/data/Eq.ts +1 -0
- package/_src/data/Equatable/api.ts +27 -10
- package/_src/data/Equatable/definition.ts +6 -2
- package/_src/data/Exit/api.ts +26 -0
- package/_src/data/Exit/constructors.ts +7 -7
- package/_src/data/Exit/definition.ts +9 -4
- package/_src/data/Maybe/constructors.ts +4 -6
- package/_src/data/Maybe/definition.ts +9 -1
- package/_src/data/exceptions/IOError.ts +11 -0
- package/_src/data/exceptions/NoSuchElementError.ts +1 -1
- package/_src/data/exceptions.ts +1 -0
- package/_src/types.ts +0 -1
- package/collection/immutable/Conc/api.d.ts +5 -0
- package/control/CompletablePromise.d.ts +13 -0
- package/control.d.ts +1 -0
- package/data/Either/constructors.d.ts +2 -2
- package/data/Either/definition.d.ts +12 -5
- package/data/Eq/api.d.ts +6 -0
- package/data/Eq.d.ts +1 -0
- package/data/Equatable/api.d.ts +1 -1
- package/data/Equatable/definition.d.ts +4 -1
- package/data/Exit/api.d.ts +12 -0
- package/data/Exit/constructors.d.ts +5 -5
- package/data/Exit/definition.d.ts +9 -2
- package/data/Maybe/constructors.d.ts +2 -2
- package/data/Maybe/definition.d.ts +9 -1
- package/data/exceptions/IOError.d.ts +9 -0
- package/data/exceptions/NoSuchElementError.d.ts +1 -1
- package/data/exceptions.d.ts +1 -0
- package/package.json +1 -1
- package/types.d.ts +0 -1
- package/_cjs/types/test.cjs +0 -6
- package/_cjs/types/test.cjs.map +0 -1
- package/_mjs/types/test.mjs +0 -2
- package/_mjs/types/test.mjs.map +0 -1
- package/_src/types/test.ts +0 -0
- package/types/test.d.ts +0 -1
package/_src/data/Eq.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { EqualsContext } from "@fncts/base/data/Equatable/definition";
|
|
2
|
+
|
|
1
3
|
import { isEquatable } from "@fncts/base/data/Equatable/definition";
|
|
2
4
|
import {
|
|
3
5
|
createCircularEqualCreator,
|
|
@@ -5,30 +7,45 @@ import {
|
|
|
5
7
|
sameValueZeroEqual,
|
|
6
8
|
} from "@fncts/base/data/Equatable/fast-equals";
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
* @tsplus static fncts.EquatableOps deepEquals
|
|
10
|
-
*/
|
|
11
|
-
export const deepEquals = createComparator(
|
|
10
|
+
const deepEqualsComparator = createComparator(
|
|
12
11
|
createCircularEqualCreator((eq) => (a, b, meta) => {
|
|
12
|
+
const equalsContext: EqualsContext = { comparator: deepEquals };
|
|
13
13
|
if (isEquatable(a)) {
|
|
14
|
-
return a[Symbol.equals](b);
|
|
14
|
+
return a[Symbol.equals](b, equalsContext);
|
|
15
15
|
} else if (isEquatable(b)) {
|
|
16
|
-
return b[Symbol.equals](a);
|
|
16
|
+
return b[Symbol.equals](a, equalsContext);
|
|
17
17
|
} else {
|
|
18
18
|
return eq(a, b, meta);
|
|
19
19
|
}
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus static fncts.EquatableOps deepEquals
|
|
25
|
+
*/
|
|
26
|
+
export function deepEquals<A>(a: A, b: unknown): boolean {
|
|
27
|
+
const context: EqualsContext = { comparator: deepEquals };
|
|
28
|
+
if (isEquatable(a)) {
|
|
29
|
+
return a[Symbol.equals](b, context);
|
|
30
|
+
} else if (isEquatable(b)) {
|
|
31
|
+
return b[Symbol.equals](a, context);
|
|
32
|
+
} else {
|
|
33
|
+
return deepEqualsComparator(a, b);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
/**
|
|
24
38
|
* @tsplus static fncts.EquatableOps strictEquals
|
|
25
39
|
* @tsplus operator fncts.Equatable ==
|
|
26
40
|
*/
|
|
27
41
|
export function strictEquals<A>(a: A, b: unknown): boolean {
|
|
42
|
+
const context: EqualsContext = {
|
|
43
|
+
comparator: strictEquals,
|
|
44
|
+
};
|
|
28
45
|
if (isEquatable(a)) {
|
|
29
|
-
return a[Symbol.equals](b);
|
|
46
|
+
return a[Symbol.equals](b, context);
|
|
30
47
|
} else if (isEquatable(b)) {
|
|
31
|
-
return b[Symbol.equals](a);
|
|
48
|
+
return b[Symbol.equals](a, context);
|
|
32
49
|
}
|
|
33
50
|
return sameValueZeroEqual(a, b);
|
|
34
51
|
}
|
|
@@ -38,5 +55,5 @@ export function strictEquals<A>(a: A, b: unknown): boolean {
|
|
|
38
55
|
* @tsplus operator fncts.Equatable !=
|
|
39
56
|
*/
|
|
40
57
|
export function strictNotEquals<A>(a: A, b: unknown): boolean {
|
|
41
|
-
return !strictEquals(a, b)
|
|
42
|
-
}
|
|
58
|
+
return !strictEquals(a, b);
|
|
59
|
+
}
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const equalsSymbol: unique symbol = Symbol.for("fncts.Equatable");
|
|
5
5
|
|
|
6
|
+
export interface EqualsContext {
|
|
7
|
+
comparator: (a: unknown, b: unknown) => boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
/**
|
|
7
11
|
* @tsplus type fncts.Equatable
|
|
8
12
|
*/
|
|
9
13
|
export interface Equatable {
|
|
10
|
-
[equalsSymbol](that: unknown): boolean;
|
|
14
|
+
[equalsSymbol](that: unknown, context: EqualsContext): boolean;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export function isEquatable(u: unknown): u is Equatable {
|
|
14
|
-
return isObject(u) && Symbol.equals
|
|
18
|
+
return isObject(u) && typeof u[Symbol.equals] === "function";
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
package/_src/data/Exit/api.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IOError } from "@fncts/base/data/exceptions";
|
|
2
|
+
|
|
1
3
|
import { identity, tuple } from "../function.js";
|
|
2
4
|
import { ExitTag } from "./definition.js";
|
|
3
5
|
|
|
@@ -201,3 +203,27 @@ export function zipWithCause<E, A, G, B, C>(
|
|
|
201
203
|
}
|
|
202
204
|
};
|
|
203
205
|
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Returns the Exit's Success value if it exists
|
|
209
|
+
*
|
|
210
|
+
* @tsplus getter fncts.Exit value
|
|
211
|
+
*/
|
|
212
|
+
export function value<E, A>(self: Exit<E, A>): A | undefined {
|
|
213
|
+
if (self.isFailure()) {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
return self.value;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Returns the Exit's Success value if it exists, or throws the pretty-printed Cause if it doesn't
|
|
221
|
+
*
|
|
222
|
+
* @tsplus getter fncts.Exit valueOrThrow
|
|
223
|
+
*/
|
|
224
|
+
export function valueOrThrow<E, A>(self: Exit<E, A>): A {
|
|
225
|
+
if (self.isFailure()) {
|
|
226
|
+
throw new IOError(self.cause);
|
|
227
|
+
}
|
|
228
|
+
return self.value;
|
|
229
|
+
}
|
|
@@ -3,14 +3,14 @@ import { Failure, Success } from "./definition.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* @tsplus static fncts.ExitOps halt
|
|
5
5
|
*/
|
|
6
|
-
export function halt(defect: unknown): Exit<never, never> {
|
|
6
|
+
export function halt(defect: unknown, __tsplusTrace?: string): Exit<never, never> {
|
|
7
7
|
return failCause(Cause.halt(defect));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @tsplus static fncts.ExitOps fail
|
|
12
12
|
*/
|
|
13
|
-
export function fail<E = never, A = never>(e: E): Exit<E, A> {
|
|
13
|
+
export function fail<E = never, A = never>(e: E, __tsplusTrace?: string): Exit<E, A> {
|
|
14
14
|
return failCause(Cause.fail(e));
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -31,22 +31,22 @@ export function fromMaybe<E, A>(fa: Maybe<A>, onNothing: () => E): Exit<E, A> {
|
|
|
31
31
|
/**
|
|
32
32
|
* @tsplus static fncts.ExitOps failCause
|
|
33
33
|
*/
|
|
34
|
-
export function failCause<E = never, A = never>(cause: Cause<E
|
|
35
|
-
return new Failure(cause);
|
|
34
|
+
export function failCause<E = never, A = never>(cause: Cause<E>, __tsplusTrace?: string): Exit<E, A> {
|
|
35
|
+
return new Failure(cause, __tsplusTrace);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @tsplus static fncts.ExitOps interrupt
|
|
40
40
|
*/
|
|
41
|
-
export function interrupt(id: FiberId): Exit<never, never> {
|
|
41
|
+
export function interrupt(id: FiberId, __tsplusTrace?: string): Exit<never, never> {
|
|
42
42
|
return failCause(Cause.interrupt(id));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @tsplus static fncts.ExitOps succeed
|
|
47
47
|
*/
|
|
48
|
-
export function succeed<E = never, A = never>(value: A): Exit<E, A> {
|
|
49
|
-
return new Success(value);
|
|
48
|
+
export function succeed<E = never, A = never>(value: A, __tsplusTrace?: string): Exit<E, A> {
|
|
49
|
+
return new Success(value, __tsplusTrace);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -23,6 +23,9 @@ export const enum ExitTag {
|
|
|
23
23
|
Failure = "Failure",
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const IOTypeId = Symbol.for("fncts.io.IO");
|
|
27
|
+
type IOTypeId = typeof IOTypeId;
|
|
28
|
+
|
|
26
29
|
const _failureHash = Hashable.string("fncts.Exit.Failure");
|
|
27
30
|
const _successHash = Hashable.string("fncts.Exit.Success");
|
|
28
31
|
|
|
@@ -36,8 +39,9 @@ export class Failure<E> {
|
|
|
36
39
|
readonly _E: (_: never) => E;
|
|
37
40
|
readonly _A: (_: never) => never;
|
|
38
41
|
};
|
|
39
|
-
readonly
|
|
40
|
-
|
|
42
|
+
readonly [IOTypeId]: IOTypeId = IOTypeId;
|
|
43
|
+
readonly _tag = ExitTag.Failure;
|
|
44
|
+
constructor(readonly cause: Cause<E>, readonly trace?: string) {}
|
|
41
45
|
|
|
42
46
|
get [Symbol.hash](): number {
|
|
43
47
|
return Hashable.combine(_failureHash, Hashable.unknown(this.cause));
|
|
@@ -57,8 +61,9 @@ export class Success<A> implements P.Hashable, P.Equatable {
|
|
|
57
61
|
readonly _E: (_: never) => never;
|
|
58
62
|
readonly _A: (_: never) => A;
|
|
59
63
|
};
|
|
60
|
-
readonly
|
|
61
|
-
|
|
64
|
+
readonly [IOTypeId]: IOTypeId = IOTypeId;
|
|
65
|
+
readonly _tag = ExitTag.Success;
|
|
66
|
+
constructor(readonly value: A, readonly trace?: string) {}
|
|
62
67
|
|
|
63
68
|
get [Symbol.hash](): number {
|
|
64
69
|
return Hashable.combine(_successHash, Hashable.unknown(this.value));
|
|
@@ -4,18 +4,16 @@ import type { Nullable } from "@fncts/base/types";
|
|
|
4
4
|
* @tsplus static fncts.MaybeOps just
|
|
5
5
|
* @tsplus static fncts.JustOps __call
|
|
6
6
|
*/
|
|
7
|
-
export function just<A>(a: A): Maybe<A> {
|
|
8
|
-
return new Just(a);
|
|
7
|
+
export function just<A>(a: A, __tsplusTrace?: string): Maybe<A> {
|
|
8
|
+
return new Just(a, __tsplusTrace);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const _Nothing = new Nothing();
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* @tsplus static fncts.MaybeOps nothing
|
|
15
13
|
* @tsplus static fncts.NothingOps __call
|
|
16
14
|
*/
|
|
17
|
-
export function nothing<A = never>(): Maybe<A> {
|
|
18
|
-
return
|
|
15
|
+
export function nothing<A = never>(__tsplusTrace?: string): Maybe<A> {
|
|
16
|
+
return new Nothing(__tsplusTrace);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
/**
|
|
@@ -11,6 +11,9 @@ export type MaybeVariance = typeof MaybeVariance;
|
|
|
11
11
|
export const MaybeTypeId = Symbol.for("fncts.Maybe");
|
|
12
12
|
export type MaybeTypeId = typeof MaybeTypeId;
|
|
13
13
|
|
|
14
|
+
const IOTypeId = Symbol.for("fncts.io.IO");
|
|
15
|
+
type IOTypeId = typeof IOTypeId;
|
|
16
|
+
|
|
14
17
|
export interface MaybeF extends HKT {
|
|
15
18
|
type: Maybe<this["A"]>;
|
|
16
19
|
variance: {
|
|
@@ -30,6 +33,8 @@ export abstract class Maybe<A> {
|
|
|
30
33
|
readonly _A: (_: never) => A;
|
|
31
34
|
};
|
|
32
35
|
readonly [MaybeTypeId]: MaybeTypeId = MaybeTypeId;
|
|
36
|
+
readonly [IOTypeId]: IOTypeId = IOTypeId;
|
|
37
|
+
readonly trace?: string | undefined = undefined;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
/**
|
|
@@ -38,7 +43,7 @@ export abstract class Maybe<A> {
|
|
|
38
43
|
*/
|
|
39
44
|
export class Just<A> extends Maybe<A> {
|
|
40
45
|
readonly _tag = MaybeTag.Just;
|
|
41
|
-
constructor(readonly value: A) {
|
|
46
|
+
constructor(readonly value: A, readonly trace?: string) {
|
|
42
47
|
super();
|
|
43
48
|
}
|
|
44
49
|
[Symbol.equals](that: unknown): boolean {
|
|
@@ -55,6 +60,9 @@ export class Just<A> extends Maybe<A> {
|
|
|
55
60
|
*/
|
|
56
61
|
export class Nothing extends Maybe<never> {
|
|
57
62
|
readonly _tag = MaybeTag.Nothing;
|
|
63
|
+
constructor(readonly trace?: string) {
|
|
64
|
+
super();
|
|
65
|
+
}
|
|
58
66
|
[Symbol.equals](that: unknown): boolean {
|
|
59
67
|
return isMaybe(that) && that.isNothing();
|
|
60
68
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const IOErrorTypeId = Symbol.for("fncts.base.exceptions.IOError");
|
|
2
|
+
export type IOErrorTypeId = typeof IOErrorTypeId;
|
|
3
|
+
|
|
4
|
+
export class IOError<E> {
|
|
5
|
+
readonly [IOErrorTypeId]: IOErrorTypeId = IOErrorTypeId;
|
|
6
|
+
constructor(readonly cause: Cause<E>) {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function isIOError(u: unknown): u is IOError<unknown> {
|
|
10
|
+
return isObject(u) && IOErrorTypeId in u;
|
|
11
|
+
}
|
|
@@ -2,7 +2,7 @@ export const NoSuchElementErrorTag = "NoSuchElementError";
|
|
|
2
2
|
|
|
3
3
|
export class NoSuchElementError extends Error {
|
|
4
4
|
readonly _tag = NoSuchElementErrorTag;
|
|
5
|
-
constructor(message
|
|
5
|
+
constructor(message?: string) {
|
|
6
6
|
super(message);
|
|
7
7
|
this.name = NoSuchElementErrorTag;
|
|
8
8
|
}
|
package/_src/data/exceptions.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./exceptions/IllegalStateError.js";
|
|
|
5
5
|
export * from "./exceptions/IndexOutOfBoundsError.js";
|
|
6
6
|
export * from "./exceptions/InterruptedException.js";
|
|
7
7
|
export * from "./exceptions/InvalidCapacityError.js";
|
|
8
|
+
export * from "./exceptions/IOError.js";
|
|
8
9
|
export * from "./exceptions/NoSuchElementError.js";
|
|
9
10
|
export * from "./exceptions/RuntimeError.js";
|
|
10
11
|
// codegen:end
|
package/_src/types.ts
CHANGED
|
@@ -268,6 +268,11 @@ export declare function reverse<A>(self: Conc<A>): Iterable<A>;
|
|
|
268
268
|
* @tsplus location "@fncts/base/collection/immutable/Conc/api"
|
|
269
269
|
*/
|
|
270
270
|
export declare function separate<E, A>(self: Conc<Either<E, A>>): readonly [Conc<E>, Conc<A>];
|
|
271
|
+
/**
|
|
272
|
+
* @tsplus pipeable fncts.Conc slice
|
|
273
|
+
* @tsplus location "@fncts/base/collection/immutable/Conc/api"
|
|
274
|
+
*/
|
|
275
|
+
export declare function slice(from: number, to: number): <A>(self: import("@fncts/base/collection/immutable/Conc/definition").Conc<A>) => import("@fncts/base/collection/immutable/Conc/definition").Conc<A>;
|
|
271
276
|
/**
|
|
272
277
|
* @tsplus pipeable fncts.Conc splitAt
|
|
273
278
|
* @tsplus location "@fncts/base/collection/immutable/Conc/api"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tsplus type fncts.CompletablePromise
|
|
3
|
+
* @tsplus companion fncts.CompletablePromiseOps
|
|
4
|
+
*/
|
|
5
|
+
export interface CompletablePromise<A> extends Promise<A> {
|
|
6
|
+
resolve: (a: A) => void;
|
|
7
|
+
reject: (reason: unknown) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus static fncts.CompletablePromiseOps __call
|
|
11
|
+
* @tsplus location "@fncts/base/control/CompletablePromise"
|
|
12
|
+
*/
|
|
13
|
+
export declare function make<A>(): CompletablePromise<A>;
|
package/control.d.ts
CHANGED
|
@@ -9,13 +9,13 @@ import { Either } from "./definition.js";
|
|
|
9
9
|
* @tsplus static fncts.Either.LeftOps __call
|
|
10
10
|
* @tsplus location "@fncts/base/data/Either/constructors"
|
|
11
11
|
*/
|
|
12
|
-
export declare function left<E = never, A = never>(e: E): Either<E, A>;
|
|
12
|
+
export declare function left<E = never, A = never>(e: E, __tsplusTrace?: string): Either<E, A>;
|
|
13
13
|
/**
|
|
14
14
|
* @tsplus static fncts.EitherOps right
|
|
15
15
|
* @tsplus static fncts.Either.RightOps __call
|
|
16
16
|
* @tsplus location "@fncts/base/data/Either/constructors"
|
|
17
17
|
*/
|
|
18
|
-
export declare function right<E = never, A = never>(a: A): Either<E, A>;
|
|
18
|
+
export declare function right<E = never, A = never>(a: A, __tsplusTrace?: string): Either<E, A>;
|
|
19
19
|
/**
|
|
20
20
|
* @tsplus static fncts.EitherOps fromMaybe
|
|
21
21
|
* @tsplus pipeable fncts.Maybe toEither
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HKT } from "@fncts/typelevel/HKT";
|
|
2
2
|
import { Hashable } from "@fncts/base/data/Hashable";
|
|
3
|
-
import {
|
|
3
|
+
import type { EqualsContext } from "@fncts/base/data/Equatable";
|
|
4
4
|
export declare const enum EitherTag {
|
|
5
5
|
Left = "Left",
|
|
6
6
|
Right = "Right"
|
|
@@ -16,12 +16,16 @@ export interface EitherF extends HKT {
|
|
|
16
16
|
A: "+";
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
declare const IOTypeId: unique symbol;
|
|
20
|
+
type IOTypeId = typeof IOTypeId;
|
|
19
21
|
/**
|
|
20
22
|
* @tsplus type fncts.Either
|
|
21
23
|
* @tsplus companion fncts.EitherOps
|
|
22
24
|
*/
|
|
23
25
|
export declare class Either<E, A> {
|
|
24
26
|
readonly [EitherTypeId]: EitherTypeId;
|
|
27
|
+
readonly [IOTypeId]: IOTypeId;
|
|
28
|
+
readonly trace?: string | undefined;
|
|
25
29
|
[EitherVariance]: {
|
|
26
30
|
readonly _E: (_: never) => E;
|
|
27
31
|
readonly _A: (_: never) => A;
|
|
@@ -33,10 +37,11 @@ export declare class Either<E, A> {
|
|
|
33
37
|
*/
|
|
34
38
|
export declare class Left<E> extends Either<E, never> {
|
|
35
39
|
readonly left: E;
|
|
40
|
+
readonly trace?: string | undefined;
|
|
36
41
|
readonly _tag = EitherTag.Left;
|
|
37
|
-
constructor(left: E);
|
|
42
|
+
constructor(left: E, trace?: string | undefined);
|
|
38
43
|
get [Symbol.hash](): number;
|
|
39
|
-
[Symbol.equals](that: unknown): boolean;
|
|
44
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
47
|
* @tsplus type fncts.Either.Right
|
|
@@ -44,10 +49,11 @@ export declare class Left<E> extends Either<E, never> {
|
|
|
44
49
|
*/
|
|
45
50
|
export declare class Right<A> extends Either<never, A> {
|
|
46
51
|
readonly right: A;
|
|
52
|
+
readonly trace?: string | undefined;
|
|
47
53
|
readonly _tag = EitherTag.Right;
|
|
48
|
-
constructor(right: A);
|
|
54
|
+
constructor(right: A, trace?: string | undefined);
|
|
49
55
|
get [Symbol.hash](): number;
|
|
50
|
-
[Symbol.equals](that: unknown): boolean;
|
|
56
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* @tsplus unify fncts.Either
|
|
@@ -60,3 +66,4 @@ export declare function unifyEither<X extends Either<any, any>>(self: X): Either
|
|
|
60
66
|
* @tsplus location "@fncts/base/data/Either/definition"
|
|
61
67
|
*/
|
|
62
68
|
export declare function concrete<E, A>(self: Either<E, A>): asserts self is Left<E> | Right<A>;
|
|
69
|
+
export {};
|
package/data/Eq/api.d.ts
ADDED
package/data/Eq.d.ts
CHANGED
package/data/Equatable/api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @tsplus static fncts.EquatableOps deepEquals
|
|
3
3
|
* @tsplus location "@fncts/base/data/Equatable/api"
|
|
4
4
|
*/
|
|
5
|
-
export declare
|
|
5
|
+
export declare function deepEquals<A>(a: A, b: unknown): boolean;
|
|
6
6
|
/**
|
|
7
7
|
* @tsplus static fncts.EquatableOps strictEquals
|
|
8
8
|
* @tsplus operator fncts.Equatable ==
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
* @tsplus location "@fncts/base/data/Equatable/definition"
|
|
4
4
|
*/
|
|
5
5
|
export declare const equalsSymbol: unique symbol;
|
|
6
|
+
export interface EqualsContext {
|
|
7
|
+
comparator: (a: unknown, b: unknown) => boolean;
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* @tsplus type fncts.Equatable
|
|
8
11
|
*/
|
|
9
12
|
export interface Equatable {
|
|
10
|
-
[equalsSymbol](that: unknown): boolean;
|
|
13
|
+
[equalsSymbol](that: unknown, context: EqualsContext): boolean;
|
|
11
14
|
}
|
|
12
15
|
export declare function isEquatable(u: unknown): u is Equatable;
|
|
13
16
|
/**
|
package/data/Exit/api.d.ts
CHANGED
|
@@ -97,3 +97,15 @@ export declare function zipConcurrent<EB, B>(that: Exit<EB, B>): <EA, A>(self: i
|
|
|
97
97
|
* @tsplus location "@fncts/base/data/Exit/api"
|
|
98
98
|
*/
|
|
99
99
|
export declare function zipWithCause<E, A, G, B, C>(fb: Exit<G, B>, f: (a: A, b: B) => C, g: (ea: Cause<E>, eb: Cause<G>) => Cause<E | G>): (fa: Exit<E, A>) => Exit<E | G, C>;
|
|
100
|
+
/**
|
|
101
|
+
* Returns the Exit's Success value if it exists
|
|
102
|
+
* @tsplus getter fncts.Exit value
|
|
103
|
+
* @tsplus location "@fncts/base/data/Exit/api"
|
|
104
|
+
*/
|
|
105
|
+
export declare function value<E, A>(self: Exit<E, A>): A | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the Exit's Success value if it exists, or throws the pretty-printed Cause if it doesn't
|
|
108
|
+
* @tsplus getter fncts.Exit valueOrThrow
|
|
109
|
+
* @tsplus location "@fncts/base/data/Exit/api"
|
|
110
|
+
*/
|
|
111
|
+
export declare function valueOrThrow<E, A>(self: Exit<E, A>): A;
|
|
@@ -7,12 +7,12 @@ import { FiberId } from "@fncts/base/data/FiberId/definition";
|
|
|
7
7
|
* @tsplus static fncts.ExitOps halt
|
|
8
8
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
9
9
|
*/
|
|
10
|
-
export declare function halt(defect: unknown): Exit<never, never>;
|
|
10
|
+
export declare function halt(defect: unknown, __tsplusTrace?: string): Exit<never, never>;
|
|
11
11
|
/**
|
|
12
12
|
* @tsplus static fncts.ExitOps fail
|
|
13
13
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
14
14
|
*/
|
|
15
|
-
export declare function fail<E = never, A = never>(e: E): Exit<E, A>;
|
|
15
|
+
export declare function fail<E = never, A = never>(e: E, __tsplusTrace?: string): Exit<E, A>;
|
|
16
16
|
/**
|
|
17
17
|
* @tsplus static fncts.ExitOps fromEither
|
|
18
18
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
@@ -27,17 +27,17 @@ export declare function fromMaybe<E, A>(fa: Maybe<A>, onNothing: () => E): Exit<
|
|
|
27
27
|
* @tsplus static fncts.ExitOps failCause
|
|
28
28
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
29
29
|
*/
|
|
30
|
-
export declare function failCause<E = never, A = never>(cause: Cause<E
|
|
30
|
+
export declare function failCause<E = never, A = never>(cause: Cause<E>, __tsplusTrace?: string): Exit<E, A>;
|
|
31
31
|
/**
|
|
32
32
|
* @tsplus static fncts.ExitOps interrupt
|
|
33
33
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
34
34
|
*/
|
|
35
|
-
export declare function interrupt(id: FiberId): Exit<never, never>;
|
|
35
|
+
export declare function interrupt(id: FiberId, __tsplusTrace?: string): Exit<never, never>;
|
|
36
36
|
/**
|
|
37
37
|
* @tsplus static fncts.ExitOps succeed
|
|
38
38
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
39
39
|
*/
|
|
40
|
-
export declare function succeed<E = never, A = never>(value: A): Exit<E, A>;
|
|
40
|
+
export declare function succeed<E = never, A = never>(value: A, __tsplusTrace?: string): Exit<E, A>;
|
|
41
41
|
/**
|
|
42
42
|
* @tsplus static fncts.ExitOps unit
|
|
43
43
|
* @tsplus location "@fncts/base/data/Exit/constructors"
|
|
@@ -19,19 +19,23 @@ export declare const enum ExitTag {
|
|
|
19
19
|
Success = "Success",
|
|
20
20
|
Failure = "Failure"
|
|
21
21
|
}
|
|
22
|
+
declare const IOTypeId: unique symbol;
|
|
23
|
+
type IOTypeId = typeof IOTypeId;
|
|
22
24
|
/**
|
|
23
25
|
* @tsplus type fncts.Exit.Failure
|
|
24
26
|
* @tsplus companion fncts.Exit.FailureOps
|
|
25
27
|
*/
|
|
26
28
|
export declare class Failure<E> {
|
|
27
29
|
readonly cause: Cause<E>;
|
|
30
|
+
readonly trace?: string | undefined;
|
|
28
31
|
readonly [ExitTypeId]: ExitTypeId;
|
|
29
32
|
[ExitVariance]: {
|
|
30
33
|
readonly _E: (_: never) => E;
|
|
31
34
|
readonly _A: (_: never) => never;
|
|
32
35
|
};
|
|
36
|
+
readonly [IOTypeId]: IOTypeId;
|
|
33
37
|
readonly _tag = ExitTag.Failure;
|
|
34
|
-
constructor(cause: Cause<E
|
|
38
|
+
constructor(cause: Cause<E>, trace?: string | undefined);
|
|
35
39
|
get [Symbol.hash](): number;
|
|
36
40
|
[Symbol.equals](that: unknown): boolean;
|
|
37
41
|
}
|
|
@@ -41,13 +45,15 @@ export declare class Failure<E> {
|
|
|
41
45
|
*/
|
|
42
46
|
export declare class Success<A> implements P.Hashable, P.Equatable {
|
|
43
47
|
readonly value: A;
|
|
48
|
+
readonly trace?: string | undefined;
|
|
44
49
|
readonly [ExitTypeId]: ExitTypeId;
|
|
45
50
|
[ExitVariance]: {
|
|
46
51
|
readonly _E: (_: never) => never;
|
|
47
52
|
readonly _A: (_: never) => A;
|
|
48
53
|
};
|
|
54
|
+
readonly [IOTypeId]: IOTypeId;
|
|
49
55
|
readonly _tag = ExitTag.Success;
|
|
50
|
-
constructor(value: A);
|
|
56
|
+
constructor(value: A, trace?: string | undefined);
|
|
51
57
|
get [Symbol.hash](): number;
|
|
52
58
|
[Symbol.equals](that: unknown): boolean;
|
|
53
59
|
}
|
|
@@ -75,3 +81,4 @@ export declare function isSuccess<E, A>(exit: Exit<E, A>): exit is Success<A>;
|
|
|
75
81
|
* @tsplus unify fncts.Exit
|
|
76
82
|
*/
|
|
77
83
|
export declare function unifyExit<X extends Exit<any, any>>(_: X): Exit<[X] extends [Exit<infer E, any>] ? E : never, [X] extends [Exit<any, infer A>] ? A : never>;
|
|
84
|
+
export {};
|
|
@@ -7,13 +7,13 @@ import type { Nullable } from "@fncts/base/types";
|
|
|
7
7
|
* @tsplus static fncts.JustOps __call
|
|
8
8
|
* @tsplus location "@fncts/base/data/Maybe/constructors"
|
|
9
9
|
*/
|
|
10
|
-
export declare function just<A>(a: A): Maybe<A>;
|
|
10
|
+
export declare function just<A>(a: A, __tsplusTrace?: string): Maybe<A>;
|
|
11
11
|
/**
|
|
12
12
|
* @tsplus static fncts.MaybeOps nothing
|
|
13
13
|
* @tsplus static fncts.NothingOps __call
|
|
14
14
|
* @tsplus location "@fncts/base/data/Maybe/constructors"
|
|
15
15
|
*/
|
|
16
|
-
export declare function nothing<A = never>(): Maybe<A>;
|
|
16
|
+
export declare function nothing<A = never>(__tsplusTrace?: string): Maybe<A>;
|
|
17
17
|
/**
|
|
18
18
|
* @tsplus static fncts.MaybeOps fromNullable
|
|
19
19
|
* @tsplus location "@fncts/base/data/Maybe/constructors"
|
|
@@ -9,6 +9,8 @@ export declare const MaybeVariance: unique symbol;
|
|
|
9
9
|
export type MaybeVariance = typeof MaybeVariance;
|
|
10
10
|
export declare const MaybeTypeId: unique symbol;
|
|
11
11
|
export type MaybeTypeId = typeof MaybeTypeId;
|
|
12
|
+
declare const IOTypeId: unique symbol;
|
|
13
|
+
type IOTypeId = typeof IOTypeId;
|
|
12
14
|
export interface MaybeF extends HKT {
|
|
13
15
|
type: Maybe<this["A"]>;
|
|
14
16
|
variance: {
|
|
@@ -24,6 +26,8 @@ export declare abstract class Maybe<A> {
|
|
|
24
26
|
readonly _A: (_: never) => A;
|
|
25
27
|
};
|
|
26
28
|
readonly [MaybeTypeId]: MaybeTypeId;
|
|
29
|
+
readonly [IOTypeId]: IOTypeId;
|
|
30
|
+
readonly trace?: string | undefined;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* @tsplus type fncts.Just
|
|
@@ -31,8 +35,9 @@ export declare abstract class Maybe<A> {
|
|
|
31
35
|
*/
|
|
32
36
|
export declare class Just<A> extends Maybe<A> {
|
|
33
37
|
readonly value: A;
|
|
38
|
+
readonly trace?: string | undefined;
|
|
34
39
|
readonly _tag = MaybeTag.Just;
|
|
35
|
-
constructor(value: A);
|
|
40
|
+
constructor(value: A, trace?: string | undefined);
|
|
36
41
|
[Symbol.equals](that: unknown): boolean;
|
|
37
42
|
get [Symbol.hash](): number;
|
|
38
43
|
}
|
|
@@ -41,7 +46,9 @@ export declare class Just<A> extends Maybe<A> {
|
|
|
41
46
|
* @tsplus companion fncts.NothingOps
|
|
42
47
|
*/
|
|
43
48
|
export declare class Nothing extends Maybe<never> {
|
|
49
|
+
readonly trace?: string | undefined;
|
|
44
50
|
readonly _tag = MaybeTag.Nothing;
|
|
51
|
+
constructor(trace?: string | undefined);
|
|
45
52
|
[Symbol.equals](that: unknown): boolean;
|
|
46
53
|
get [Symbol.hash](): number;
|
|
47
54
|
}
|
|
@@ -77,3 +84,4 @@ export declare function isNothing<A>(self: Maybe<A>): self is Nothing;
|
|
|
77
84
|
* @tsplus location "@fncts/base/data/Maybe/definition"
|
|
78
85
|
*/
|
|
79
86
|
export declare function concrete<A>(self: Maybe<A>): asserts self is Just<A> | Nothing;
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
2
|
+
export declare const IOErrorTypeId: unique symbol;
|
|
3
|
+
export type IOErrorTypeId = typeof IOErrorTypeId;
|
|
4
|
+
export declare class IOError<E> {
|
|
5
|
+
readonly cause: Cause<E>;
|
|
6
|
+
readonly [IOErrorTypeId]: IOErrorTypeId;
|
|
7
|
+
constructor(cause: Cause<E>);
|
|
8
|
+
}
|
|
9
|
+
export declare function isIOError(u: unknown): u is IOError<unknown>;
|
package/data/exceptions.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * from "./exceptions/IllegalStateError.js";
|
|
|
4
4
|
export * from "./exceptions/IndexOutOfBoundsError.js";
|
|
5
5
|
export * from "./exceptions/InterruptedException.js";
|
|
6
6
|
export * from "./exceptions/InvalidCapacityError.js";
|
|
7
|
+
export * from "./exceptions/IOError.js";
|
|
7
8
|
export * from "./exceptions/NoSuchElementError.js";
|
|
8
9
|
export * from "./exceptions/RuntimeError.js";
|