@fncts/base 0.0.26 → 0.0.27
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/immutable/HashMap/api.cjs +11 -0
- package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/internal.cjs +2 -1
- package/_cjs/collection/immutable/HashMap/internal.cjs.map +1 -1
- package/_cjs/collection/immutable/List/definition.cjs +19 -4
- package/_cjs/collection/immutable/List/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/RoseTree/api.cjs +1 -1
- package/_cjs/collection/immutable/RoseTree/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/api.cjs +62 -19
- package/_cjs/collection/immutable/Vector/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/definition.cjs.map +1 -1
- package/_cjs/data/Branded/definition.cjs +4 -3
- package/_cjs/data/Branded/definition.cjs.map +1 -1
- package/_cjs/data/Cause/api.cjs +52 -57
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +9 -1
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Either/definition.cjs +25 -1
- package/_cjs/data/Either/definition.cjs.map +1 -1
- package/_cjs/data/Equatable/api.cjs +12 -3
- package/_cjs/data/Equatable/api.cjs.map +1 -1
- package/_cjs/data/FiberId/api.cjs +16 -15
- package/_cjs/data/FiberId/api.cjs.map +1 -1
- package/_cjs/data/Maybe/instances.cjs +28 -7
- package/_cjs/data/Maybe/instances.cjs.map +1 -1
- package/_cjs/data/Showable/show.cjs +2 -2
- package/_cjs/data/Showable/show.cjs.map +1 -1
- package/_cjs/typeclass.cjs +2 -2
- package/_cjs/util/predicates.cjs +4 -0
- package/_cjs/util/predicates.cjs.map +1 -1
- package/_cjs/util/rand/Random.cjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/api.mjs +10 -0
- package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/internal.mjs +1 -1
- package/_mjs/collection/immutable/HashMap/internal.mjs.map +1 -1
- package/_mjs/collection/immutable/List/definition.mjs +13 -2
- package/_mjs/collection/immutable/List/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/RoseTree/api.mjs +1 -1
- package/_mjs/collection/immutable/RoseTree/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/api.mjs +54 -16
- package/_mjs/collection/immutable/Vector/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/definition.mjs.map +1 -1
- package/_mjs/data/Branded/definition.mjs +4 -3
- package/_mjs/data/Branded/definition.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +51 -56
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +6 -0
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/definition.mjs +22 -0
- package/_mjs/data/Either/definition.mjs.map +1 -1
- package/_mjs/data/Equatable/api.mjs +9 -1
- package/_mjs/data/Equatable/api.mjs.map +1 -1
- package/_mjs/data/FiberId/api.mjs +16 -15
- package/_mjs/data/FiberId/api.mjs.map +1 -1
- package/_mjs/data/Maybe/instances.mjs +28 -7
- package/_mjs/data/Maybe/instances.mjs.map +1 -1
- package/_mjs/data/Showable/show.mjs +2 -2
- package/_mjs/data/Showable/show.mjs.map +1 -1
- package/_mjs/typeclass.mjs +1 -1
- package/_mjs/typeclass.mjs.map +1 -1
- package/_mjs/util/predicates.mjs +3 -0
- package/_mjs/util/predicates.mjs.map +1 -1
- package/_mjs/util/rand/Random.mjs +2 -1
- package/_mjs/util/rand/Random.mjs.map +1 -1
- package/_src/collection/immutable/HashMap/api.ts +11 -0
- package/_src/collection/immutable/HashMap/internal.ts +1 -1
- package/_src/collection/immutable/HashSet/api.ts +4 -4
- package/_src/collection/immutable/List/definition.ts +14 -2
- package/_src/collection/immutable/RoseTree/api.ts +1 -1
- package/_src/collection/immutable/Vector/api.ts +64 -2
- package/_src/collection/immutable/Vector/definition.ts +1 -0
- package/_src/data/Branded/definition.ts +3 -3
- package/_src/data/Cause/api.ts +33 -40
- package/_src/data/Either/api.ts +10 -0
- package/_src/data/Either/definition.ts +20 -0
- package/_src/data/Equatable/api.ts +8 -0
- package/_src/data/FiberId/api.ts +5 -5
- package/_src/data/Maybe/instances.ts +18 -0
- package/_src/data/Showable/show.ts +2 -2
- package/_src/data.ts +1 -0
- package/_src/typeclass.ts +1 -1
- package/_src/util/predicates.ts +4 -0
- package/collection/immutable/HashMap/api.d.ts +5 -0
- package/collection/immutable/HashMap/internal.d.ts +1 -2
- package/collection/immutable/List/definition.d.ts +9 -0
- package/collection/immutable/Vector/api.d.ts +30 -3
- package/collection/immutable/Vector/definition.d.ts +1 -0
- package/data/Branded/definition.d.ts +3 -2
- package/data/Cause/api.d.ts +1 -1
- package/data/Either/api.d.ts +5 -0
- package/data/Either/definition.d.ts +6 -0
- package/data/Equatable/api.d.ts +6 -0
- package/data/Maybe/instances.d.ts +24 -0
- package/data.d.ts +1 -0
- package/package.json +1 -1
- package/typeclass.d.ts +1 -1
- package/util/predicates.d.ts +1 -0
package/_src/data/Either/api.ts
CHANGED
|
@@ -284,6 +284,16 @@ export function partition<E, A>(p: Predicate<A>, /** @tsplus auto */ M: P.Monoid
|
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/**
|
|
288
|
+
* @tsplus getter fncts.Either toMaybe
|
|
289
|
+
*/
|
|
290
|
+
export function toMaybe<E, A>(self: Either<E, A>): Maybe<A> {
|
|
291
|
+
return self.match(
|
|
292
|
+
() => Nothing(),
|
|
293
|
+
(a) => Just(a),
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
287
297
|
// codegen:start { preset: barrel, include: api/*.ts }
|
|
288
298
|
export * from "./api/align.js";
|
|
289
299
|
export * from "./api/alignWith.js";
|
|
@@ -29,6 +29,8 @@ export class Either<E, A> {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
const leftHash = Hashable.string(EitherTag.Left);
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* @tsplus type fncts.Either.Left
|
|
34
36
|
* @tsplus companion fncts.Either.LeftOps
|
|
@@ -38,8 +40,18 @@ export class Left<E> extends Either<E, never> {
|
|
|
38
40
|
constructor(readonly left: E) {
|
|
39
41
|
super();
|
|
40
42
|
}
|
|
43
|
+
|
|
44
|
+
get [Symbol.hash](): number {
|
|
45
|
+
return Hashable.combine(leftHash, Hashable.unknown(this.left));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[Symbol.equals](that: unknown): boolean {
|
|
49
|
+
return Either.isEither(that) && that.isLeft() && Equatable.strictEquals(this.left, that.left);
|
|
50
|
+
}
|
|
41
51
|
}
|
|
42
52
|
|
|
53
|
+
const rightHash = Hashable.string(EitherTag.Right);
|
|
54
|
+
|
|
43
55
|
/**
|
|
44
56
|
* @tsplus type fncts.Either.Right
|
|
45
57
|
* @tsplus companion fncts.Either.RightOps
|
|
@@ -49,6 +61,14 @@ export class Right<A> extends Either<never, A> {
|
|
|
49
61
|
constructor(readonly right: A) {
|
|
50
62
|
super();
|
|
51
63
|
}
|
|
64
|
+
|
|
65
|
+
get [Symbol.hash](): number {
|
|
66
|
+
return Hashable.combine(rightHash, Hashable.unknown(this.left));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
[Symbol.equals](that: unknown): boolean {
|
|
70
|
+
return Either.isEither(that) && that.isRight() && Equatable.strictEquals(this.right, that.right);
|
|
71
|
+
}
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
/**
|
|
@@ -32,3 +32,11 @@ export function strictEquals<A>(a: A, b: unknown): boolean {
|
|
|
32
32
|
}
|
|
33
33
|
return sameValueZeroEqual(a, b);
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @tsplus static fncts.EquatableOps strictNotEquals
|
|
38
|
+
* @tsplus operator fncts.Equatable !=
|
|
39
|
+
*/
|
|
40
|
+
export function strictNotEquals<A>(a: A, b: unknown): boolean {
|
|
41
|
+
return !strictEquals(a, b)
|
|
42
|
+
}
|
package/_src/data/FiberId/api.ts
CHANGED
|
@@ -5,20 +5,20 @@ import { Composite, isComposite, isNone } from "./definition.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export function combine(id1: FiberId) {
|
|
7
7
|
return (id0: FiberId): FiberId => {
|
|
8
|
-
if (isNone(
|
|
8
|
+
if (id0.isNone()) {
|
|
9
9
|
return id1;
|
|
10
10
|
}
|
|
11
|
-
if (isNone(
|
|
11
|
+
if (id1.isNone()) {
|
|
12
12
|
return id0;
|
|
13
13
|
}
|
|
14
|
-
if (isComposite(
|
|
15
|
-
if (isComposite(
|
|
14
|
+
if (id0.isComposite()) {
|
|
15
|
+
if (id1.isComposite()) {
|
|
16
16
|
return new Composite(id0.fiberIds.union(id1.fiberIds));
|
|
17
17
|
} else {
|
|
18
18
|
return new Composite(id0.fiberIds.add(id1));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
if (isComposite(
|
|
21
|
+
if (id1.isComposite()) {
|
|
22
22
|
return new Composite(id1.fiberIds.add(id0));
|
|
23
23
|
}
|
|
24
24
|
return new Composite(HashSet.make(id0, id1));
|
|
@@ -6,25 +6,43 @@ import { MaybeJson } from "@fncts/base/json/MaybeJson";
|
|
|
6
6
|
import { filter, filterMap, flatMap, foldLeft, foldRight, map, partition, partitionMap, zip, zipWith } from "./api.js";
|
|
7
7
|
import { just } from "./constructors.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus static fncts.MaybeOps Functor
|
|
11
|
+
*/
|
|
9
12
|
export const Functor = HKT.instance<P.Functor<MaybeF>>({ map });
|
|
10
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @tsplus static fncts.MaybeOps Apply
|
|
16
|
+
*/
|
|
11
17
|
export const Apply = HKT.instance<P.Apply<MaybeF>>({ ...Functor, zip, zipWith });
|
|
12
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @tsplus static fncts.MaybeOps Applicative
|
|
21
|
+
*/
|
|
13
22
|
export const Applicative = HKT.instance<P.Applicative<MaybeF>>({
|
|
14
23
|
...Apply,
|
|
15
24
|
pure: just,
|
|
16
25
|
});
|
|
17
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus static fncts.MaybeOps Monad
|
|
29
|
+
*/
|
|
18
30
|
export const Monad = HKT.instance<P.Monad<MaybeF>>({
|
|
19
31
|
...Applicative,
|
|
20
32
|
flatMap,
|
|
21
33
|
});
|
|
22
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @tsplus static fncts.MaybeOps Foldable
|
|
37
|
+
*/
|
|
23
38
|
export const Foldable = HKT.instance<P.Foldable<MaybeF>>({
|
|
24
39
|
foldLeft,
|
|
25
40
|
foldRight,
|
|
26
41
|
});
|
|
27
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @tsplus static fncts.MaybeOps Filterable
|
|
45
|
+
*/
|
|
28
46
|
export const Filterable = HKT.instance<P.Filterable<MaybeF>>({
|
|
29
47
|
...Functor,
|
|
30
48
|
filter,
|
|
@@ -490,12 +490,12 @@ function reduceToSingleString(
|
|
|
490
490
|
value?: any,
|
|
491
491
|
): string {
|
|
492
492
|
let output = input;
|
|
493
|
-
if (context.compact >= 1) {
|
|
493
|
+
if (Number(context.compact) >= 1) {
|
|
494
494
|
const entries = output.length;
|
|
495
495
|
if (extrasType === ARRAY_EXTRAS_TYPE && entries > 6) {
|
|
496
496
|
output = groupElements(context, output, value);
|
|
497
497
|
}
|
|
498
|
-
if (context.currentDepth - context.recurseTimes < context.compact && entries === output.length) {
|
|
498
|
+
if (context.currentDepth - context.recurseTimes < Number(context.compact) && entries === output.length) {
|
|
499
499
|
const start = output.length + context.indentationLevel + braces[0].length + base.length + 10;
|
|
500
500
|
if (isBelowBreakLength(context, output, start, base)) {
|
|
501
501
|
return `${base ? `${base} ` : ""}${braces[0]} ${output.join(", ")} ${braces[1]}`;
|
package/_src/data.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type {} from "./data/Predicate.js";
|
|
|
38
38
|
export type {} from "./data/Refinement.js";
|
|
39
39
|
export type {} from "./data/Showable.js";
|
|
40
40
|
export type {} from "./data/string.js";
|
|
41
|
+
export type {} from "./data/Struct.js";
|
|
41
42
|
export type {} from "./data/Tag.js";
|
|
42
43
|
export type {} from "./data/These.js";
|
|
43
44
|
export type {} from "./data/Trace.js";
|
package/_src/typeclass.ts
CHANGED
|
@@ -32,7 +32,7 @@ export * from "./typeclass/WitherableWithIndex.js";
|
|
|
32
32
|
|
|
33
33
|
export { Eq } from "./data/Eq.js";
|
|
34
34
|
export { Equatable } from "./data/Equatable.js";
|
|
35
|
-
export { Guard } from "./data/Guard.js";
|
|
35
|
+
export { Guard } from "./data/Guard/definition.js";
|
|
36
36
|
export { Hash } from "./data/Hash.js";
|
|
37
37
|
export { Hashable } from "./data/Hashable.js";
|
|
38
38
|
export { HashEq } from "./data/HashEq.js";
|
package/_src/util/predicates.ts
CHANGED
|
@@ -41,6 +41,10 @@ export function isObject<A>(value: A | Primitive): boolean {
|
|
|
41
41
|
return typeof value === "object" && value !== null;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
export function isRecord(value: unknown): value is object & Record<PropertyKey, unknown> {
|
|
45
|
+
return isObject(value) && !Array.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
export function hasTypeId<X extends symbol>(
|
|
45
49
|
value: unknown,
|
|
46
50
|
typeId: X,
|
|
@@ -26,6 +26,11 @@ export declare function makeWith<K, V>(config: P.HashEq<K>): HashMap<K, V>;
|
|
|
26
26
|
* @tsplus location "@fncts/base/collection/immutable/HashMap/api"
|
|
27
27
|
*/
|
|
28
28
|
export declare function make<K, V>(...items: ReadonlyArray<readonly [K, V]>): HashMap<K, V>;
|
|
29
|
+
/**
|
|
30
|
+
* @tsplus static fncts.HashMapOps from
|
|
31
|
+
* @tsplus location "@fncts/base/collection/immutable/HashMap/api"
|
|
32
|
+
*/
|
|
33
|
+
export declare function from<K, V>(items: Iterable<readonly [K, V]>): HashMap<K, V>;
|
|
29
34
|
/**
|
|
30
35
|
* Make a new map that has randomly cached hash and structural equality
|
|
31
36
|
* @tsplus static fncts.HashMapOps empty
|
|
@@ -48,7 +48,7 @@ export declare class CollisionNode<K, V> {
|
|
|
48
48
|
constructor(edit: number, hash: number, children: Array<Node<K, V>>);
|
|
49
49
|
modify(edit: number, keyEq: KeyEq<K>, shift: number, f: UpdateFn<V>, hash: number, key: K, size: SizeRef): Node<K, V>;
|
|
50
50
|
}
|
|
51
|
-
declare class IndexedNode<K, V> {
|
|
51
|
+
export declare class IndexedNode<K, V> {
|
|
52
52
|
edit: number;
|
|
53
53
|
mask: number;
|
|
54
54
|
children: Array<Node<K, V>>;
|
|
@@ -64,4 +64,3 @@ export declare class ArrayNode<K, V> {
|
|
|
64
64
|
constructor(edit: number, size: number, children: Array<Node<K, V>>);
|
|
65
65
|
modify(edit: number, keyEq: KeyEq<K>, shift: number, f: UpdateFn<V>, hash: number, key: K, size: SizeRef): Node<K, V>;
|
|
66
66
|
}
|
|
67
|
-
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const ListTypeId: unique symbol;
|
|
2
|
+
export type ListTypeId = typeof ListTypeId;
|
|
1
3
|
/**
|
|
2
4
|
* @tsplus type fncts.List.Cons
|
|
3
5
|
* @tsplus companion fncts.ConsOps
|
|
@@ -6,6 +8,7 @@ export declare class Cons<A> implements Iterable<A> {
|
|
|
6
8
|
readonly head: A;
|
|
7
9
|
tail: List<A>;
|
|
8
10
|
readonly _tag = "Cons";
|
|
11
|
+
readonly [ListTypeId]: ListTypeId;
|
|
9
12
|
constructor(head: A, tail?: List<A>);
|
|
10
13
|
[Symbol.iterator](): Iterator<A>;
|
|
11
14
|
}
|
|
@@ -15,8 +18,14 @@ export declare class Cons<A> implements Iterable<A> {
|
|
|
15
18
|
*/
|
|
16
19
|
export declare class Nil<A> implements Iterable<A> {
|
|
17
20
|
readonly _tag = "Nil";
|
|
21
|
+
readonly [ListTypeId]: ListTypeId;
|
|
18
22
|
[Symbol.iterator](): Iterator<A>;
|
|
19
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @tsplus static fncts.ListOps is
|
|
26
|
+
* @tsplus location "@fncts/base/collection/immutable/List/definition"
|
|
27
|
+
*/
|
|
28
|
+
export declare function isList(u: unknown): u is List<unknown>;
|
|
20
29
|
export declare const _Nil: Nil<never>;
|
|
21
30
|
/**
|
|
22
31
|
* @tsplus type fncts.List
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vector } from "@fncts/base/collection/immutable/Vector";
|
|
2
|
-
import { Predicate } from "@fncts/base/data/Predicate/definition";
|
|
3
|
-
import { Refinement } from "@fncts/base/data/Refinement/definition";
|
|
4
2
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
3
|
+
import { RefinementWithIndex, Refinement } from "@fncts/base/data/Refinement/definition";
|
|
4
|
+
import { PredicateWithIndex, Predicate } from "@fncts/base/data/Predicate/definition";
|
|
5
5
|
import { List } from "@fncts/base/collection/immutable/List/definition";
|
|
6
6
|
import { HKT } from "@fncts/typelevel/HKT";
|
|
7
7
|
import type { MutableVector, VectorF } from "@fncts/base/collection/immutable/Vector/definition";
|
|
@@ -15,6 +15,28 @@ import type * as P from "@fncts/base/typeclass";
|
|
|
15
15
|
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
16
16
|
*/
|
|
17
17
|
export declare function append<A>(a: A): (self: Vector<A>) => Vector<A>;
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus pipeable fncts.Vector filterMapWithIndex
|
|
20
|
+
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
21
|
+
*/
|
|
22
|
+
export declare function filterMapWithIndex<A, B>(f: (i: number, a: A) => Maybe<B>): (self: Vector<A>) => Vector<B>;
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus pipeable fncts.Vector filterMap
|
|
25
|
+
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
26
|
+
*/
|
|
27
|
+
export declare function filterMap<A, B>(f: (a: A) => Maybe<B>): (self: Vector<A>) => Vector<B>;
|
|
28
|
+
/**
|
|
29
|
+
* @tsplus pipeable fncts.Vector filterWithIndex
|
|
30
|
+
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
31
|
+
*/
|
|
32
|
+
export declare function filterWithIndex<A, B extends A>(refinement: RefinementWithIndex<number, A, B>): (self: Vector<A>) => Vector<B>;
|
|
33
|
+
export declare function filterWithIndex<A>(predicate: PredicateWithIndex<number, A>): (self: Vector<A>) => Vector<A>;
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus pipeable fncts.Vector filter
|
|
36
|
+
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
37
|
+
*/
|
|
38
|
+
export declare function filter<A, B extends A>(refinement: Refinement<A, B>): (self: Vector<A>) => Vector<B>;
|
|
39
|
+
export declare function filter<A>(predicate: Predicate<A>): (self: Vector<A>) => Vector<A>;
|
|
18
40
|
/**
|
|
19
41
|
* Maps a function over a Vector and concatenates all the resulting
|
|
20
42
|
* Vectors together.
|
|
@@ -261,6 +283,11 @@ export declare function groupWith<A>(f: (a: A, b: A) => boolean): (self: Vector<
|
|
|
261
283
|
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
262
284
|
*/
|
|
263
285
|
export declare function head<A>(self: Vector<A>): Maybe<NonNullable<A>>;
|
|
286
|
+
/**
|
|
287
|
+
* @tsplus pipeable fncts.Vector includes
|
|
288
|
+
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
289
|
+
*/
|
|
290
|
+
export declare function includes<A>(element: A): (self: Vector<A>) => boolean;
|
|
264
291
|
/**
|
|
265
292
|
* Returns the index of the _first_ element in the Vector that is equal
|
|
266
293
|
* to the given element. If no such element is found `-1` is returned.
|
|
@@ -620,4 +647,4 @@ export declare function updateAt<A>(i: number, a: A): (self: Vector<A>) => Vecto
|
|
|
620
647
|
* @tsplus static fncts.VectorOps __call
|
|
621
648
|
* @tsplus location "@fncts/base/collection/immutable/Vector/api"
|
|
622
649
|
*/
|
|
623
|
-
export declare function vector<A
|
|
650
|
+
export declare function vector<A extends ReadonlyArray<any>>(...elements: A): Vector<[A] extends [ReadonlyArray<infer X>] ? X : never>;
|
|
@@ -29,11 +29,12 @@ export declare namespace Brand {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare class Validation<in out A, in out K extends string> {
|
|
31
31
|
readonly validate: Refinement<A, A & Brand.Valid<A, K>>;
|
|
32
|
-
|
|
32
|
+
readonly name: K;
|
|
33
|
+
constructor(validate: Refinement<A, A & Brand.Valid<A, K>>, name: K);
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* @tsplus static fncts.ValidationOps __call
|
|
36
37
|
* @tsplus location "@fncts/base/data/Branded/definition"
|
|
37
38
|
*/
|
|
38
|
-
export declare function makeValidation<A, K extends string>(p: Predicate<A
|
|
39
|
+
export declare function makeValidation<A, K extends string>(p: Predicate<A>, name: K): Validation<A, K>;
|
|
39
40
|
export {};
|
package/data/Cause/api.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { Both, Cause, Fail, Halt, Interrupt, Then } from "./definition.js";
|
|
|
12
12
|
* @tsplus pipeable fncts.Cause as
|
|
13
13
|
* @tsplus location "@fncts/base/data/Cause/api"
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function as<B>(b: Lazy<B>): <A>(self: Cause<A>) => Cause<B>;
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a `Cause` from two `Cause`s, representing parallel failures.
|
|
18
18
|
* @note If one of the `Cause`s is `Empty`, the non-empty `Cause` is returned
|
package/data/Either/api.d.ts
CHANGED
|
@@ -146,5 +146,10 @@ export declare function partitionMap<E, A, B, C>(f: (a: A) => Either<B, C>, /**
|
|
|
146
146
|
* @tsplus location "@fncts/base/data/Either/api"
|
|
147
147
|
*/
|
|
148
148
|
export declare function partition<E, A>(p: Predicate<A>, /** @tsplus auto */ M: P.Monoid<E>): (self: Either<E, A>) => readonly [Either<E, A>, Either<E, A>];
|
|
149
|
+
/**
|
|
150
|
+
* @tsplus getter fncts.Either toMaybe
|
|
151
|
+
* @tsplus location "@fncts/base/data/Either/api"
|
|
152
|
+
*/
|
|
153
|
+
export declare function toMaybe<E, A>(self: Either<E, A>): Maybe<A>;
|
|
149
154
|
export * from "./api/align.js";
|
|
150
155
|
export * from "./api/alignWith.js";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { HKT } from "@fncts/typelevel/HKT";
|
|
2
|
+
import { Hashable } from "@fncts/base/data/Hashable";
|
|
3
|
+
import { Equatable } from "@fncts/base/data/Equatable";
|
|
2
4
|
export declare const enum EitherTag {
|
|
3
5
|
Left = "Left",
|
|
4
6
|
Right = "Right"
|
|
@@ -33,6 +35,8 @@ export declare class Left<E> extends Either<E, never> {
|
|
|
33
35
|
readonly left: E;
|
|
34
36
|
readonly _tag = EitherTag.Left;
|
|
35
37
|
constructor(left: E);
|
|
38
|
+
get [Symbol.hash](): number;
|
|
39
|
+
[Symbol.equals](that: unknown): boolean;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* @tsplus type fncts.Either.Right
|
|
@@ -42,6 +46,8 @@ export declare class Right<A> extends Either<never, A> {
|
|
|
42
46
|
readonly right: A;
|
|
43
47
|
readonly _tag = EitherTag.Right;
|
|
44
48
|
constructor(right: A);
|
|
49
|
+
get [Symbol.hash](): number;
|
|
50
|
+
[Symbol.equals](that: unknown): boolean;
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* @tsplus unify fncts.Either
|
package/data/Equatable/api.d.ts
CHANGED
|
@@ -9,3 +9,9 @@ export declare const deepEquals: (a: any, b: any, meta?: any) => boolean;
|
|
|
9
9
|
* @tsplus location "@fncts/base/data/Equatable/api"
|
|
10
10
|
*/
|
|
11
11
|
export declare function strictEquals<A>(a: A, b: unknown): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus static fncts.EquatableOps strictNotEquals
|
|
14
|
+
* @tsplus operator fncts.Equatable !=
|
|
15
|
+
* @tsplus location "@fncts/base/data/Equatable/api"
|
|
16
|
+
*/
|
|
17
|
+
export declare function strictNotEquals<A>(a: A, b: unknown): boolean;
|
|
@@ -4,11 +4,35 @@ import { Decoder } from "@fncts/base/data/Decoder/definition";
|
|
|
4
4
|
import { Encoder } from "@fncts/base/data/Encoder/definition";
|
|
5
5
|
import type * as P from "../../typeclass.js";
|
|
6
6
|
import type { MaybeF } from "@fncts/base/data/Maybe/definition";
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus static fncts.MaybeOps Functor
|
|
9
|
+
* @tsplus location "@fncts/base/data/Maybe/instances"
|
|
10
|
+
*/
|
|
7
11
|
export declare const Functor: P.Functor<MaybeF, import("@fncts/typelevel/HKT.js").HKT.None>;
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus static fncts.MaybeOps Apply
|
|
14
|
+
* @tsplus location "@fncts/base/data/Maybe/instances"
|
|
15
|
+
*/
|
|
8
16
|
export declare const Apply: P.Apply<MaybeF, import("@fncts/typelevel/HKT.js").HKT.None>;
|
|
17
|
+
/**
|
|
18
|
+
* @tsplus static fncts.MaybeOps Applicative
|
|
19
|
+
* @tsplus location "@fncts/base/data/Maybe/instances"
|
|
20
|
+
*/
|
|
9
21
|
export declare const Applicative: P.Applicative<MaybeF, import("@fncts/typelevel/HKT.js").HKT.None>;
|
|
22
|
+
/**
|
|
23
|
+
* @tsplus static fncts.MaybeOps Monad
|
|
24
|
+
* @tsplus location "@fncts/base/data/Maybe/instances"
|
|
25
|
+
*/
|
|
10
26
|
export declare const Monad: P.Monad<MaybeF, import("@fncts/typelevel/HKT.js").HKT.None>;
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus static fncts.MaybeOps Foldable
|
|
29
|
+
* @tsplus location "@fncts/base/data/Maybe/instances"
|
|
30
|
+
*/
|
|
11
31
|
export declare const Foldable: P.Foldable<MaybeF, import("@fncts/typelevel/HKT.js").HKT.None>;
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus static fncts.MaybeOps Filterable
|
|
34
|
+
* @tsplus location "@fncts/base/data/Maybe/instances"
|
|
35
|
+
*/
|
|
12
36
|
export declare const Filterable: P.Filterable<MaybeF, import("@fncts/typelevel/HKT.js").HKT.None>;
|
|
13
37
|
/**
|
|
14
38
|
* @tsplus derive fncts.Guard[fncts.Maybe]<_> 10
|
package/data.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type {} from "./data/Predicate.js";
|
|
|
37
37
|
export type {} from "./data/Refinement.js";
|
|
38
38
|
export type {} from "./data/Showable.js";
|
|
39
39
|
export type {} from "./data/string.js";
|
|
40
|
+
export type {} from "./data/Struct.js";
|
|
40
41
|
export type {} from "./data/Tag.js";
|
|
41
42
|
export type {} from "./data/These.js";
|
|
42
43
|
export type {} from "./data/Trace.js";
|
package/package.json
CHANGED
package/typeclass.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export * from "./typeclass/Witherable.js";
|
|
|
29
29
|
export * from "./typeclass/WitherableWithIndex.js";
|
|
30
30
|
export { Eq } from "./data/Eq.js";
|
|
31
31
|
export { Equatable } from "./data/Equatable.js";
|
|
32
|
-
export { Guard } from "./data/Guard.js";
|
|
32
|
+
export { Guard } from "./data/Guard/definition.js";
|
|
33
33
|
export { Hash } from "./data/Hash.js";
|
|
34
34
|
export { Hashable } from "./data/Hashable.js";
|
|
35
35
|
export { HashEq } from "./data/HashEq.js";
|
package/util/predicates.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare function isArray<A>(value: unknown): value is Array<A>;
|
|
|
11
11
|
export declare function isObject<A extends Function>(value: A): false;
|
|
12
12
|
export declare function isObject(value: unknown): value is object & Record<PropertyKey, any>;
|
|
13
13
|
export declare function isObject<A>(value: A | Primitive): value is A & Record<PropertyKey, unknown>;
|
|
14
|
+
export declare function isRecord(value: unknown): value is object & Record<PropertyKey, unknown>;
|
|
14
15
|
export declare function hasTypeId<X extends symbol>(value: unknown, typeId: X): value is {
|
|
15
16
|
readonly [K in X]: X;
|
|
16
17
|
} & Record<PropertyKey, unknown>;
|