effect 3.14.3 → 3.14.4
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/dist/cjs/HashSet.js +111 -87
- package/dist/cjs/HashSet.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/HashSet.d.ts +149 -106
- package/dist/dts/HashSet.d.ts.map +1 -1
- package/dist/dts/index.d.ts +40 -40
- package/dist/esm/HashSet.js +111 -87
- package/dist/esm/HashSet.js.map +1 -1
- package/dist/esm/index.js +40 -40
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/HashSet.ts +149 -106
- package/src/index.ts +40 -40
- package/src/internal/version.ts +1 -1
package/dist/dts/HashSet.d.ts
CHANGED
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
*
|
|
34
34
|
* ## Performance Characteristics
|
|
35
35
|
*
|
|
36
|
-
* - **Lookup** operations ({@
|
|
36
|
+
* - **Lookup** operations ({@link module:HashSet.has}): **`O(1)`** average time
|
|
37
37
|
* complexity
|
|
38
|
-
* - **Insertion** operations ({@
|
|
38
|
+
* - **Insertion** operations ({@link module:HashSet.add}): **`O(1)`** average time
|
|
39
39
|
* complexity
|
|
40
|
-
* - **Removal** operations ({@
|
|
41
|
-
* complexity
|
|
42
|
-
* - **Set** operations ({@
|
|
43
|
-
* {@
|
|
40
|
+
* - **Removal** operations ({@link module:HashSet.remove}): **`O(1)`** average
|
|
41
|
+
* time complexity
|
|
42
|
+
* - **Set** operations ({@link module:HashSet.union},
|
|
43
|
+
* {@link module:HashSet.intersection}): **`O(n)`** where n is the size of the
|
|
44
44
|
* smaller set
|
|
45
45
|
* - **Iteration**: **`O(n)`** where n is the size of the set
|
|
46
46
|
*
|
|
@@ -53,40 +53,40 @@
|
|
|
53
53
|
*
|
|
54
54
|
* ## Operations Reference
|
|
55
55
|
*
|
|
56
|
-
* | Category | Operation
|
|
57
|
-
* | ------------ |
|
|
58
|
-
* | constructors | {@
|
|
59
|
-
* | constructors | {@
|
|
60
|
-
* | constructors | {@
|
|
61
|
-
* | |
|
|
62
|
-
* | elements | {@
|
|
63
|
-
* | elements | {@
|
|
64
|
-
* | elements | {@
|
|
65
|
-
* | elements | {@
|
|
66
|
-
* | |
|
|
67
|
-
* | getters | {@
|
|
68
|
-
* | getters | {@
|
|
69
|
-
* | getters | {@
|
|
70
|
-
* | |
|
|
71
|
-
* | mutations | {@
|
|
72
|
-
* | mutations | {@
|
|
73
|
-
* | mutations | {@
|
|
74
|
-
* | |
|
|
75
|
-
* | operations | {@
|
|
76
|
-
* | operations | {@
|
|
77
|
-
* | operations | {@
|
|
78
|
-
* | |
|
|
79
|
-
* | mapping | {@
|
|
80
|
-
* | |
|
|
81
|
-
* | sequencing | {@
|
|
82
|
-
* | |
|
|
83
|
-
* | traversing | {@
|
|
84
|
-
* | |
|
|
85
|
-
* | folding | {@
|
|
86
|
-
* | |
|
|
87
|
-
* | filtering | {@
|
|
88
|
-
* | |
|
|
89
|
-
* | partitioning | {@
|
|
56
|
+
* | Category | Operation | Description | Complexity |
|
|
57
|
+
* | ------------ | ----------------------------------- | ------------------------------------------- | ---------- |
|
|
58
|
+
* | constructors | {@link module:HashSet.empty} | Creates an empty HashSet | O(1) |
|
|
59
|
+
* | constructors | {@link module:HashSet.fromIterable} | Creates a HashSet from an iterable | O(n) |
|
|
60
|
+
* | constructors | {@link module:HashSet.make} | Creates a HashSet from multiple values | O(n) |
|
|
61
|
+
* | | | | |
|
|
62
|
+
* | elements | {@link module:HashSet.has} | Checks if a value exists in the set | O(1) avg |
|
|
63
|
+
* | elements | {@link module:HashSet.some} | Checks if any element satisfies a predicate | O(n) |
|
|
64
|
+
* | elements | {@link module:HashSet.every} | Checks if all elements satisfy a predicate | O(n) |
|
|
65
|
+
* | elements | {@link module:HashSet.isSubset} | Checks if a set is a subset of another | O(n) |
|
|
66
|
+
* | | | | |
|
|
67
|
+
* | getters | {@link module:HashSet.values} | Gets an iterator of all values | O(1) |
|
|
68
|
+
* | getters | {@link module:HashSet.toValues} | Gets an array of all values | O(n) |
|
|
69
|
+
* | getters | {@link module:HashSet.size} | Gets the number of elements | O(1) |
|
|
70
|
+
* | | | | |
|
|
71
|
+
* | mutations | {@link module:HashSet.add} | Adds a value to the set | O(1) avg |
|
|
72
|
+
* | mutations | {@link module:HashSet.remove} | Removes a value from the set | O(1) avg |
|
|
73
|
+
* | mutations | {@link module:HashSet.toggle} | Toggles a value's presence | O(1) avg |
|
|
74
|
+
* | | | | |
|
|
75
|
+
* | operations | {@link module:HashSet.difference} | Computes set difference (A - B) | O(n) |
|
|
76
|
+
* | operations | {@link module:HashSet.intersection} | Computes set intersection (A ∩ B) | O(n) |
|
|
77
|
+
* | operations | {@link module:HashSet.union} | Computes set union (A ∪ B) | O(n) |
|
|
78
|
+
* | | | | |
|
|
79
|
+
* | mapping | {@link module:HashSet.map} | Transforms each element | O(n) |
|
|
80
|
+
* | | | | |
|
|
81
|
+
* | sequencing | {@link module:HashSet.flatMap} | Transforms and flattens elements | O(n) |
|
|
82
|
+
* | | | | |
|
|
83
|
+
* | traversing | {@link module:HashSet.forEach} | Applies a function to each element | O(n) |
|
|
84
|
+
* | | | | |
|
|
85
|
+
* | folding | {@link module:HashSet.reduce} | Reduces the set to a single value | O(n) |
|
|
86
|
+
* | | | | |
|
|
87
|
+
* | filtering | {@link module:HashSet.filter} | Keeps elements that satisfy a predicate | O(n) |
|
|
88
|
+
* | | | | |
|
|
89
|
+
* | partitioning | {@link module:HashSet.partition} | Splits into two sets by a predicate | O(n) |
|
|
90
90
|
*
|
|
91
91
|
* ## Notes
|
|
92
92
|
*
|
|
@@ -266,9 +266,10 @@ export type TypeId = typeof TypeId;
|
|
|
266
266
|
* @memberof HashSet
|
|
267
267
|
* @since 2.0.0
|
|
268
268
|
* @category models
|
|
269
|
-
* @example
|
|
269
|
+
* @example
|
|
270
270
|
*
|
|
271
271
|
* ```ts
|
|
272
|
+
* // Syntax
|
|
272
273
|
* import { HashSet } from "effect"
|
|
273
274
|
*
|
|
274
275
|
* let numberSet: HashSet.HashSet<number>
|
|
@@ -361,7 +362,7 @@ export declare const isHashSet: {
|
|
|
361
362
|
* ) // Output: [1, 2]
|
|
362
363
|
* ```
|
|
363
364
|
*
|
|
364
|
-
* @see Other `HashSet` constructors are {@link make} {@link fromIterable}
|
|
365
|
+
* @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
|
|
365
366
|
*/
|
|
366
367
|
export declare const empty: <A = never>() => HashSet<A>;
|
|
367
368
|
/**
|
|
@@ -372,9 +373,10 @@ export declare const empty: <A = never>() => HashSet<A>;
|
|
|
372
373
|
* @memberof HashSet
|
|
373
374
|
* @since 2.0.0
|
|
374
375
|
* @category constructors
|
|
375
|
-
* @example
|
|
376
|
+
* @example
|
|
376
377
|
*
|
|
377
378
|
* ```ts
|
|
379
|
+
* // Creating a HashSet from an Array
|
|
378
380
|
* import { HashSet, pipe } from "effect"
|
|
379
381
|
*
|
|
380
382
|
* console.log(
|
|
@@ -386,9 +388,10 @@ export declare const empty: <A = never>() => HashSet<A>;
|
|
|
386
388
|
* ) // Output: [1, 2, 3, 4, 5]
|
|
387
389
|
* ```
|
|
388
390
|
*
|
|
389
|
-
* @example
|
|
391
|
+
* @example
|
|
390
392
|
*
|
|
391
393
|
* ```ts
|
|
394
|
+
* // Creating a HashSet from a Set
|
|
392
395
|
* import { HashSet, pipe } from "effect"
|
|
393
396
|
*
|
|
394
397
|
* console.log(
|
|
@@ -400,9 +403,10 @@ export declare const empty: <A = never>() => HashSet<A>;
|
|
|
400
403
|
* ) // Output: ["apple", "banana", "orange"]
|
|
401
404
|
* ```
|
|
402
405
|
*
|
|
403
|
-
* @example
|
|
406
|
+
* @example
|
|
404
407
|
*
|
|
405
408
|
* ```ts
|
|
409
|
+
* // Creating a HashSet from a Generator
|
|
406
410
|
* import { HashSet } from "effect"
|
|
407
411
|
*
|
|
408
412
|
* // Generator functions return iterables
|
|
@@ -421,9 +425,10 @@ export declare const empty: <A = never>() => HashSet<A>;
|
|
|
421
425
|
* // Outputs: [0, 1, 2, 3, 5, 8, 13, 21, 34] but in unsorted order
|
|
422
426
|
* ```
|
|
423
427
|
*
|
|
424
|
-
* @example
|
|
428
|
+
* @example
|
|
425
429
|
*
|
|
426
430
|
* ```ts
|
|
431
|
+
* // Creating a HashSet from another HashSet
|
|
427
432
|
* import { HashSet, pipe } from "effect"
|
|
428
433
|
*
|
|
429
434
|
* console.log(
|
|
@@ -436,10 +441,10 @@ export declare const empty: <A = never>() => HashSet<A>;
|
|
|
436
441
|
* ) // Output: [1, 2, 3, 4]
|
|
437
442
|
* ```
|
|
438
443
|
*
|
|
439
|
-
* @example
|
|
440
|
-
* {@link Chunk}
|
|
444
|
+
* @example
|
|
441
445
|
*
|
|
442
446
|
* ```ts
|
|
447
|
+
* // Creating a HashSet from other Effect's data structures like Chunk
|
|
443
448
|
* import { Chunk, HashSet, pipe } from "effect"
|
|
444
449
|
*
|
|
445
450
|
* console.log(
|
|
@@ -451,7 +456,7 @@ export declare const empty: <A = never>() => HashSet<A>;
|
|
|
451
456
|
* ) // Outputs: [1, 2, 3, 4]
|
|
452
457
|
* ```
|
|
453
458
|
*
|
|
454
|
-
* @see Other `HashSet` constructors are {@link empty} {@link make}
|
|
459
|
+
* @see Other `HashSet` constructors are {@link module:HashSet.empty} {@link module:HashSet.make}
|
|
455
460
|
*/
|
|
456
461
|
export declare const fromIterable: <A>(elements: Iterable<A>) => HashSet<A>;
|
|
457
462
|
/**
|
|
@@ -539,7 +544,7 @@ export declare const fromIterable: <A>(elements: Iterable<A>) => HashSet<A>;
|
|
|
539
544
|
* )
|
|
540
545
|
* ```
|
|
541
546
|
*
|
|
542
|
-
* @see Other `HashSet` constructors are {@
|
|
547
|
+
* @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
|
|
543
548
|
*/
|
|
544
549
|
export declare const make: <As extends ReadonlyArray<any>>(...elements: As) => HashSet<As[number]>;
|
|
545
550
|
/**
|
|
@@ -550,9 +555,10 @@ export declare const make: <As extends ReadonlyArray<any>>(...elements: As) => H
|
|
|
550
555
|
* @memberof HashSet
|
|
551
556
|
* @since 2.0.0
|
|
552
557
|
* @category elements
|
|
553
|
-
* @example
|
|
558
|
+
* @example
|
|
554
559
|
*
|
|
555
560
|
* ```ts
|
|
561
|
+
* // Syntax
|
|
556
562
|
* import { HashSet, pipe } from "effect"
|
|
557
563
|
*
|
|
558
564
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -566,13 +572,14 @@ export declare const make: <As extends ReadonlyArray<any>>(...elements: As) => H
|
|
|
566
572
|
* ```
|
|
567
573
|
*
|
|
568
574
|
* @returns A `boolean` signaling the presence of the value in the HashSet
|
|
569
|
-
* @see Other `HashSet` elements are {@link some} {@link every} {@link isSubset}
|
|
575
|
+
* @see Other `HashSet` elements are {@link module:HashSet.some} {@link module:HashSet.every} {@link module:HashSet.isSubset}
|
|
570
576
|
*/
|
|
571
577
|
export declare const has: {
|
|
572
578
|
/**
|
|
573
|
-
* @example
|
|
579
|
+
* @example
|
|
574
580
|
*
|
|
575
581
|
* ```ts
|
|
582
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
576
583
|
* import * as assert from "node:assert/strict"
|
|
577
584
|
* import { HashSet, pipe } from "effect"
|
|
578
585
|
*
|
|
@@ -586,9 +593,10 @@ export declare const has: {
|
|
|
586
593
|
*/
|
|
587
594
|
<A>(value: A): (self: HashSet<A>) => boolean;
|
|
588
595
|
/**
|
|
589
|
-
* @example
|
|
596
|
+
* @example
|
|
590
597
|
*
|
|
591
598
|
* ```ts
|
|
599
|
+
* // `data-first` API
|
|
592
600
|
* import * as assert from "node:assert/strict"
|
|
593
601
|
* import { HashSet, pipe } from "effect"
|
|
594
602
|
*
|
|
@@ -610,9 +618,10 @@ export declare const has: {
|
|
|
610
618
|
* @memberof HashSet
|
|
611
619
|
* @since 2.0.0
|
|
612
620
|
* @category elements
|
|
613
|
-
* @example
|
|
621
|
+
* @example
|
|
614
622
|
*
|
|
615
623
|
* ```ts
|
|
624
|
+
* // Syntax
|
|
616
625
|
* import { HashSet, pipe } from "effect"
|
|
617
626
|
*
|
|
618
627
|
* const set: HashSet.HashSet<number> = HashSet.make(0, 1, 2)
|
|
@@ -630,13 +639,14 @@ export declare const has: {
|
|
|
630
639
|
* HashSet.some(set, (n) => n > 0) // true
|
|
631
640
|
* ```
|
|
632
641
|
*
|
|
633
|
-
* @see Other `HashSet` elements are {@link has} {@link every} {@link isSubset}
|
|
642
|
+
* @see Other `HashSet` elements are {@link module:HashSet.has} {@link module:HashSet.every} {@link module:HashSet.isSubset}
|
|
634
643
|
*/
|
|
635
644
|
export declare const some: {
|
|
636
645
|
/**
|
|
637
|
-
* @example
|
|
646
|
+
* @example
|
|
638
647
|
*
|
|
639
648
|
* ```ts
|
|
649
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
640
650
|
* import * as assert from "node:assert/strict"
|
|
641
651
|
* import { HashSet, pipe } from "effect"
|
|
642
652
|
*
|
|
@@ -661,9 +671,10 @@ export declare const some: {
|
|
|
661
671
|
*/
|
|
662
672
|
<A>(f: Predicate<A>): (self: HashSet<A>) => boolean;
|
|
663
673
|
/**
|
|
664
|
-
* @example
|
|
674
|
+
* @example
|
|
665
675
|
*
|
|
666
676
|
* ```ts
|
|
677
|
+
* // `data-first` API
|
|
667
678
|
* import * as assert from "node:assert/strict"
|
|
668
679
|
* import { HashSet } from "effect"
|
|
669
680
|
*
|
|
@@ -691,9 +702,10 @@ export declare const some: {
|
|
|
691
702
|
* @memberof HashSet
|
|
692
703
|
* @since 2.0.0
|
|
693
704
|
* @category elements
|
|
694
|
-
* @example
|
|
705
|
+
* @example
|
|
695
706
|
*
|
|
696
707
|
* ```ts
|
|
708
|
+
* // Syntax with Refinement
|
|
697
709
|
* import { HashSet, pipe, Predicate } from "effect"
|
|
698
710
|
*
|
|
699
711
|
* const numberOrString = HashSet.make(1, "1", "one", "uno")
|
|
@@ -715,9 +727,10 @@ export declare const some: {
|
|
|
715
727
|
* ) // HashSet.HashSet<string>
|
|
716
728
|
* ```
|
|
717
729
|
*
|
|
718
|
-
* @example
|
|
730
|
+
* @example
|
|
719
731
|
*
|
|
720
732
|
* ```ts
|
|
733
|
+
* // Syntax with Predicate
|
|
721
734
|
* import { HashSet, pipe } from "effect"
|
|
722
735
|
*
|
|
723
736
|
* const set = HashSet.make(1, 2, 3)
|
|
@@ -737,7 +750,7 @@ export declare const some: {
|
|
|
737
750
|
*
|
|
738
751
|
* @returns A boolean once it has evaluated that whole collection fulfill the
|
|
739
752
|
* Predicate function
|
|
740
|
-
* @see Other `HashSet` elements are {@link has} {@link some} {@link isSubset}
|
|
753
|
+
* @see Other `HashSet` elements are {@link module:HashSet.has} {@link module:HashSet.some} {@link module:HashSet.isSubset}
|
|
741
754
|
*/
|
|
742
755
|
export declare const every: {
|
|
743
756
|
/**
|
|
@@ -835,9 +848,10 @@ export declare const every: {
|
|
|
835
848
|
* @memberof HashSet
|
|
836
849
|
* @since 2.0.0
|
|
837
850
|
* @category elements
|
|
838
|
-
* @example
|
|
851
|
+
* @example
|
|
839
852
|
*
|
|
840
853
|
* ```ts
|
|
854
|
+
* // Syntax
|
|
841
855
|
* import { HashSet, pipe } from "effect"
|
|
842
856
|
*
|
|
843
857
|
* const set1 = HashSet.make(0, 1)
|
|
@@ -857,7 +871,7 @@ export declare const every: {
|
|
|
857
871
|
* HashSet.isSubset(set1, set3) // true)
|
|
858
872
|
* ```
|
|
859
873
|
*
|
|
860
|
-
* @see Other `HashSet` elements are {@link has} {@link some} {@link every}
|
|
874
|
+
* @see Other `HashSet` elements are {@link module:HashSet.has} {@link module:HashSet.some} {@link module:HashSet.every}
|
|
861
875
|
*/
|
|
862
876
|
export declare const isSubset: {
|
|
863
877
|
/**
|
|
@@ -922,7 +936,7 @@ export declare const isSubset: {
|
|
|
922
936
|
* }
|
|
923
937
|
* ```
|
|
924
938
|
*
|
|
925
|
-
* @see Other `HashSet` getters are {@link toValues} {@link size}
|
|
939
|
+
* @see Other `HashSet` getters are {@link module:HashSet.toValues} {@link module:HashSet.size}
|
|
926
940
|
*/
|
|
927
941
|
export declare const values: <A>(self: HashSet<A>) => IterableIterator<A>;
|
|
928
942
|
/**
|
|
@@ -948,7 +962,7 @@ export declare const values: <A>(self: HashSet<A>) => IterableIterator<A>;
|
|
|
948
962
|
* )
|
|
949
963
|
* ```
|
|
950
964
|
*
|
|
951
|
-
* @see Other `HashSet` getters are {@link values} {@link size}
|
|
965
|
+
* @see Other `HashSet` getters are {@link module:HashSet.values} {@link module:HashSet.size}
|
|
952
966
|
*/
|
|
953
967
|
export declare const toValues: <A>(self: HashSet<A>) => Array<A>;
|
|
954
968
|
/**
|
|
@@ -973,7 +987,7 @@ export declare const toValues: <A>(self: HashSet<A>) => Array<A>;
|
|
|
973
987
|
* )
|
|
974
988
|
* ```
|
|
975
989
|
*
|
|
976
|
-
* @see Other `HashSet` getters are {@link values} {@link toValues}
|
|
990
|
+
* @see Other `HashSet` getters are {@link module:HashSet.values} {@link module:HashSet.toValues}
|
|
977
991
|
*/
|
|
978
992
|
export declare const size: <A>(self: HashSet<A>) => number;
|
|
979
993
|
/**
|
|
@@ -1020,7 +1034,7 @@ export declare const size: <A>(self: HashSet<A>) => number;
|
|
|
1020
1034
|
* console.log(HashSet.toValues(mutableSet).sort((a, b) => a - b)) // [0, 1, 2, 3, ...rest]
|
|
1021
1035
|
* ```
|
|
1022
1036
|
*
|
|
1023
|
-
* @see Other `HashSet` mutations are {@link add} {@link remove} {@link toggle} {@link endMutation} {@link mutate}
|
|
1037
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
1024
1038
|
*/
|
|
1025
1039
|
export declare const beginMutation: <A>(self: HashSet<A>) => HashSet<A>;
|
|
1026
1040
|
/**
|
|
@@ -1067,21 +1081,22 @@ export declare const beginMutation: <A>(self: HashSet<A>) => HashSet<A>;
|
|
|
1067
1081
|
* assert.deepStrictEqual(HashSet.toValues(newSet).sort(), [1, 2, 3, 4])
|
|
1068
1082
|
* ```
|
|
1069
1083
|
*
|
|
1070
|
-
* @see Other `HashSet` mutations are {@
|
|
1084
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.mutate}
|
|
1071
1085
|
*/
|
|
1072
1086
|
export declare const endMutation: <A>(self: HashSet<A>) => HashSet<A>;
|
|
1073
1087
|
/**
|
|
1074
1088
|
* Mutates the `HashSet` within the context of the provided function.
|
|
1075
1089
|
*
|
|
1076
1090
|
* You can consider it a functional abstraction on top of the lower-level
|
|
1077
|
-
* mutation primitives of {@
|
|
1078
|
-
* context` `->` {@
|
|
1091
|
+
* mutation primitives of {@link module:HashSet.beginMutation} `->` `mutable
|
|
1092
|
+
* context` `->` {@link HashSet.endMutation}.
|
|
1079
1093
|
*
|
|
1080
1094
|
* @memberof HashSet
|
|
1081
1095
|
* @since 2.0.0
|
|
1082
|
-
* @example
|
|
1096
|
+
* @example
|
|
1083
1097
|
*
|
|
1084
1098
|
* ```ts
|
|
1099
|
+
* // Syntax
|
|
1085
1100
|
* import { HashSet, pipe } from "effect"
|
|
1086
1101
|
*
|
|
1087
1102
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -1108,13 +1123,14 @@ export declare const endMutation: <A>(self: HashSet<A>) => HashSet<A>;
|
|
|
1108
1123
|
* })
|
|
1109
1124
|
* ```
|
|
1110
1125
|
*
|
|
1111
|
-
* @see Other `HashSet` mutations are {@
|
|
1126
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation}
|
|
1112
1127
|
*/
|
|
1113
1128
|
export declare const mutate: {
|
|
1114
1129
|
/**
|
|
1115
|
-
* @example
|
|
1130
|
+
* @example
|
|
1116
1131
|
*
|
|
1117
1132
|
* ```ts
|
|
1133
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1118
1134
|
* import { HashSet, pipe } from "effect"
|
|
1119
1135
|
* import assert from "node:assert/strict"
|
|
1120
1136
|
*
|
|
@@ -1147,9 +1163,10 @@ export declare const mutate: {
|
|
|
1147
1163
|
*/
|
|
1148
1164
|
<A>(f: (set: HashSet<A>) => void): (self: HashSet<A>) => HashSet<A>;
|
|
1149
1165
|
/**
|
|
1150
|
-
* @example
|
|
1166
|
+
* @example
|
|
1151
1167
|
*
|
|
1152
1168
|
* ```ts
|
|
1169
|
+
* // `data-first` API
|
|
1153
1170
|
* import { HashSet } from "effect"
|
|
1154
1171
|
* import assert from "node:assert/strict"
|
|
1155
1172
|
*
|
|
@@ -1190,9 +1207,10 @@ export declare const mutate: {
|
|
|
1190
1207
|
* with the added value.
|
|
1191
1208
|
* @memberof HashSet
|
|
1192
1209
|
* @since 2.0.0
|
|
1193
|
-
* @example
|
|
1210
|
+
* @example
|
|
1194
1211
|
*
|
|
1195
1212
|
* ```ts
|
|
1213
|
+
* // Syntax
|
|
1196
1214
|
* import { HashSet, pipe } from "effect"
|
|
1197
1215
|
*
|
|
1198
1216
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -1205,13 +1223,14 @@ export declare const mutate: {
|
|
|
1205
1223
|
* HashSet.add(HashSet.empty(), 0)
|
|
1206
1224
|
* ```
|
|
1207
1225
|
*
|
|
1208
|
-
* @see Other `HashSet` mutations are {@link remove} {@link toggle} {@link beginMutation} {@link endMutation} {@link mutate}
|
|
1226
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
1209
1227
|
*/
|
|
1210
1228
|
export declare const add: {
|
|
1211
1229
|
/**
|
|
1212
|
-
* @example
|
|
1230
|
+
* @example
|
|
1213
1231
|
*
|
|
1214
1232
|
* ```ts
|
|
1233
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1215
1234
|
* import { HashSet, pipe } from "effect"
|
|
1216
1235
|
* import assert from "node:assert/strict"
|
|
1217
1236
|
*
|
|
@@ -1230,9 +1249,10 @@ export declare const add: {
|
|
|
1230
1249
|
*/
|
|
1231
1250
|
<A>(value: A): (self: HashSet<A>) => HashSet<A>;
|
|
1232
1251
|
/**
|
|
1233
|
-
* @example
|
|
1252
|
+
* @example
|
|
1234
1253
|
*
|
|
1235
1254
|
* ```ts
|
|
1255
|
+
* // `data-first` API
|
|
1236
1256
|
* import { HashSet, pipe } from "effect"
|
|
1237
1257
|
* import assert from "node:assert/strict"
|
|
1238
1258
|
*
|
|
@@ -1254,9 +1274,10 @@ export declare const add: {
|
|
|
1254
1274
|
*
|
|
1255
1275
|
* @memberof HashSet
|
|
1256
1276
|
* @since 2.0.0
|
|
1257
|
-
* @example
|
|
1277
|
+
* @example
|
|
1258
1278
|
*
|
|
1259
1279
|
* ```ts
|
|
1280
|
+
* // Syntax
|
|
1260
1281
|
* import { HashSet, pipe } from "effect"
|
|
1261
1282
|
*
|
|
1262
1283
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1269,13 +1290,14 @@ export declare const add: {
|
|
|
1269
1290
|
* HashSet.remove(HashSet.make(0, 1, 2), 0)
|
|
1270
1291
|
* ```
|
|
1271
1292
|
*
|
|
1272
|
-
* @see Other `HashSet` mutations are {@link add} {@link toggle} {@link beginMutation} {@link endMutation} {@link mutate}
|
|
1293
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
1273
1294
|
*/
|
|
1274
1295
|
export declare const remove: {
|
|
1275
1296
|
/**
|
|
1276
|
-
* @example
|
|
1297
|
+
* @example
|
|
1277
1298
|
*
|
|
1278
1299
|
* ```ts
|
|
1300
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1279
1301
|
* import { HashSet, pipe } from "effect"
|
|
1280
1302
|
* import * as assert from "node:assert/strict"
|
|
1281
1303
|
*
|
|
@@ -1290,9 +1312,10 @@ export declare const remove: {
|
|
|
1290
1312
|
*/
|
|
1291
1313
|
<A>(value: A): (self: HashSet<A>) => HashSet<A>;
|
|
1292
1314
|
/**
|
|
1293
|
-
* @example
|
|
1315
|
+
* @example
|
|
1294
1316
|
*
|
|
1295
1317
|
* ```ts
|
|
1318
|
+
* // `data-first` API
|
|
1296
1319
|
* import { HashSet, pipe } from "effect"
|
|
1297
1320
|
* import * as assert from "node:assert/strict"
|
|
1298
1321
|
*
|
|
@@ -1320,9 +1343,10 @@ export declare const remove: {
|
|
|
1320
1343
|
*
|
|
1321
1344
|
* @memberof HashSet
|
|
1322
1345
|
* @since 2.0.0
|
|
1323
|
-
* @example
|
|
1346
|
+
* @example
|
|
1324
1347
|
*
|
|
1325
1348
|
* ```ts
|
|
1349
|
+
* // Syntax
|
|
1326
1350
|
* import { HashSet, pipe } from "effect"
|
|
1327
1351
|
*
|
|
1328
1352
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -1335,13 +1359,14 @@ export declare const remove: {
|
|
|
1335
1359
|
* HashSet.difference(HashSet.make(1, 2, 3), HashSet.make(3, 4, 5))
|
|
1336
1360
|
* ```
|
|
1337
1361
|
*
|
|
1338
|
-
* @see Other `HashSet` operations are {@link intersection} {@link union}
|
|
1362
|
+
* @see Other `HashSet` operations are {@link module:HashSet.intersection} {@link module:HashSet.union}
|
|
1339
1363
|
*/
|
|
1340
1364
|
export declare const difference: {
|
|
1341
1365
|
/**
|
|
1342
|
-
* @example
|
|
1366
|
+
* @example
|
|
1343
1367
|
*
|
|
1344
1368
|
* ```ts
|
|
1369
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1345
1370
|
* import { HashSet, pipe } from "effect"
|
|
1346
1371
|
* import * as assert from "node:assert/strict"
|
|
1347
1372
|
*
|
|
@@ -1369,9 +1394,10 @@ export declare const difference: {
|
|
|
1369
1394
|
*/
|
|
1370
1395
|
<A>(that: Iterable<A>): (self: HashSet<A>) => HashSet<A>;
|
|
1371
1396
|
/**
|
|
1372
|
-
* @example
|
|
1397
|
+
* @example
|
|
1373
1398
|
*
|
|
1374
1399
|
* ```ts
|
|
1400
|
+
* // `data-first` API
|
|
1375
1401
|
* import { HashSet } from "effect"
|
|
1376
1402
|
* import * as assert from "node:assert/strict"
|
|
1377
1403
|
*
|
|
@@ -1411,9 +1437,10 @@ export declare const difference: {
|
|
|
1411
1437
|
*
|
|
1412
1438
|
* @memberof HashSet
|
|
1413
1439
|
* @since 2.0.0
|
|
1414
|
-
* @example
|
|
1440
|
+
* @example
|
|
1415
1441
|
*
|
|
1416
1442
|
* ```ts
|
|
1443
|
+
* // Syntax
|
|
1417
1444
|
* import { HashSet, pipe } from "effect"
|
|
1418
1445
|
*
|
|
1419
1446
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -1426,13 +1453,14 @@ export declare const difference: {
|
|
|
1426
1453
|
* HashSet.intersection(HashSet.make(1, 2, 3), HashSet.make(2, 3, 4))
|
|
1427
1454
|
* ```
|
|
1428
1455
|
*
|
|
1429
|
-
* @see Other `HashSet` operations are {@link difference} {@link union}
|
|
1456
|
+
* @see Other `HashSet` operations are {@link module:HashSet.difference} {@link module:HashSet.union}
|
|
1430
1457
|
*/
|
|
1431
1458
|
export declare const intersection: {
|
|
1432
1459
|
/**
|
|
1433
|
-
* @example
|
|
1460
|
+
* @example
|
|
1434
1461
|
*
|
|
1435
1462
|
* ```ts
|
|
1463
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1436
1464
|
* import { HashSet, pipe } from "effect"
|
|
1437
1465
|
* import * as assert from "node:assert/strict"
|
|
1438
1466
|
*
|
|
@@ -1460,9 +1488,10 @@ export declare const intersection: {
|
|
|
1460
1488
|
*/
|
|
1461
1489
|
<A>(that: Iterable<A>): (self: HashSet<A>) => HashSet<A>;
|
|
1462
1490
|
/**
|
|
1463
|
-
* @example
|
|
1491
|
+
* @example
|
|
1464
1492
|
*
|
|
1465
1493
|
* ```ts
|
|
1494
|
+
* // `data-first` API
|
|
1466
1495
|
* import { HashSet } from "effect"
|
|
1467
1496
|
* import * as assert from "node:assert/strict"
|
|
1468
1497
|
*
|
|
@@ -1501,9 +1530,10 @@ export declare const intersection: {
|
|
|
1501
1530
|
*
|
|
1502
1531
|
* @memberof HashSet
|
|
1503
1532
|
* @since 2.0.0
|
|
1504
|
-
* @example
|
|
1533
|
+
* @example
|
|
1505
1534
|
*
|
|
1506
1535
|
* ```ts
|
|
1536
|
+
* // Syntax
|
|
1507
1537
|
* import { HashSet, pipe } from "effect"
|
|
1508
1538
|
*
|
|
1509
1539
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -1516,13 +1546,14 @@ export declare const intersection: {
|
|
|
1516
1546
|
* HashSet.union(HashSet.make(1, 2, 3), HashSet.make(3, 4, 5))
|
|
1517
1547
|
* ```
|
|
1518
1548
|
*
|
|
1519
|
-
* @see Other `HashSet` operations are {@link difference} {@link intersection}
|
|
1549
|
+
* @see Other `HashSet` operations are {@link module:HashSet.difference} {@link module:HashSet.intersection}
|
|
1520
1550
|
*/
|
|
1521
1551
|
export declare const union: {
|
|
1522
1552
|
/**
|
|
1523
|
-
* @example
|
|
1553
|
+
* @example
|
|
1524
1554
|
*
|
|
1525
1555
|
* ```ts
|
|
1556
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1526
1557
|
* import { HashSet, pipe } from "effect"
|
|
1527
1558
|
* import * as assert from "node:assert/strict"
|
|
1528
1559
|
*
|
|
@@ -1556,9 +1587,10 @@ export declare const union: {
|
|
|
1556
1587
|
*/
|
|
1557
1588
|
<A>(that: Iterable<A>): (self: HashSet<A>) => HashSet<A>;
|
|
1558
1589
|
/**
|
|
1559
|
-
* @example
|
|
1590
|
+
* @example
|
|
1560
1591
|
*
|
|
1561
1592
|
* ```ts
|
|
1593
|
+
* // `data-first` API
|
|
1562
1594
|
* import { HashSet } from "effect"
|
|
1563
1595
|
* import * as assert from "node:assert/strict"
|
|
1564
1596
|
*
|
|
@@ -1601,9 +1633,10 @@ export declare const union: {
|
|
|
1601
1633
|
*
|
|
1602
1634
|
* @memberof HashSet
|
|
1603
1635
|
* @since 2.0.0
|
|
1604
|
-
* @example
|
|
1636
|
+
* @example
|
|
1605
1637
|
*
|
|
1606
1638
|
* ```ts
|
|
1639
|
+
* // Syntax
|
|
1607
1640
|
* import { HashSet, pipe } from "effect"
|
|
1608
1641
|
*
|
|
1609
1642
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1618,13 +1651,14 @@ export declare const union: {
|
|
|
1618
1651
|
*
|
|
1619
1652
|
* @returns A new `HashSet` where the toggled value is being either added or
|
|
1620
1653
|
* removed based on the initial `HashSet` state.
|
|
1621
|
-
* @see Other `HashSet` mutations are {@link add} {@link remove} {@link beginMutation} {@link endMutation} {@link mutate}
|
|
1654
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
1622
1655
|
*/
|
|
1623
1656
|
export declare const toggle: {
|
|
1624
1657
|
/**
|
|
1625
|
-
* @example
|
|
1658
|
+
* @example
|
|
1626
1659
|
*
|
|
1627
1660
|
* ```ts
|
|
1661
|
+
* // `data-last` a.k.a. `pipeable` API
|
|
1628
1662
|
* import { HashSet, pipe } from "effect"
|
|
1629
1663
|
* import assert from "node:assert/strict"
|
|
1630
1664
|
*
|
|
@@ -1649,9 +1683,10 @@ export declare const toggle: {
|
|
|
1649
1683
|
*/
|
|
1650
1684
|
<A>(value: A): (self: HashSet<A>) => HashSet<A>;
|
|
1651
1685
|
/**
|
|
1652
|
-
* @example
|
|
1686
|
+
* @example
|
|
1653
1687
|
*
|
|
1654
1688
|
* ```ts
|
|
1689
|
+
* // `data-first` API
|
|
1655
1690
|
* import { HashSet, pipe } from "effect"
|
|
1656
1691
|
* import assert from "node:assert/strict"
|
|
1657
1692
|
*
|
|
@@ -1684,9 +1719,10 @@ export declare const toggle: {
|
|
|
1684
1719
|
* @memberof HashSet
|
|
1685
1720
|
* @since 2.0.0
|
|
1686
1721
|
* @category mapping
|
|
1687
|
-
* @example
|
|
1722
|
+
* @example
|
|
1688
1723
|
*
|
|
1689
1724
|
* ```ts
|
|
1725
|
+
* // Syntax
|
|
1690
1726
|
* import { HashSet, pipe } from "effect"
|
|
1691
1727
|
*
|
|
1692
1728
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1746,9 +1782,10 @@ export declare const map: {
|
|
|
1746
1782
|
* @memberof HashSet
|
|
1747
1783
|
* @since 2.0.0
|
|
1748
1784
|
* @category sequencing
|
|
1749
|
-
* @example
|
|
1785
|
+
* @example
|
|
1750
1786
|
*
|
|
1751
1787
|
* ```ts
|
|
1788
|
+
* // Syntax
|
|
1752
1789
|
* import { HashSet, pipe } from "effect"
|
|
1753
1790
|
*
|
|
1754
1791
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1810,9 +1847,10 @@ export declare const flatMap: {
|
|
|
1810
1847
|
* @memberof HashSet
|
|
1811
1848
|
* @since 2.0.0
|
|
1812
1849
|
* @category traversing
|
|
1813
|
-
* @example
|
|
1850
|
+
* @example
|
|
1814
1851
|
*
|
|
1815
1852
|
* ```ts
|
|
1853
|
+
* // Syntax
|
|
1816
1854
|
* import { HashSet, pipe } from "effect"
|
|
1817
1855
|
*
|
|
1818
1856
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1872,9 +1910,10 @@ export declare const forEach: {
|
|
|
1872
1910
|
* @memberof HashSet
|
|
1873
1911
|
* @since 2.0.0
|
|
1874
1912
|
* @category folding
|
|
1875
|
-
* @example
|
|
1913
|
+
* @example
|
|
1876
1914
|
*
|
|
1877
1915
|
* ```ts
|
|
1916
|
+
* // Syntax
|
|
1878
1917
|
* import { HashSet, pipe } from "effect"
|
|
1879
1918
|
*
|
|
1880
1919
|
* const sum = (a: number, b: number): number => a + b
|
|
@@ -1934,9 +1973,10 @@ export declare const reduce: {
|
|
|
1934
1973
|
* @memberof HashSet
|
|
1935
1974
|
* @since 2.0.0
|
|
1936
1975
|
* @category filtering
|
|
1937
|
-
* @example
|
|
1976
|
+
* @example
|
|
1938
1977
|
*
|
|
1939
1978
|
* ```ts
|
|
1979
|
+
* // Syntax with Predicate
|
|
1940
1980
|
* import { HashSet, type Predicate, pipe } from "effect"
|
|
1941
1981
|
*
|
|
1942
1982
|
* const filterPositiveNumbers: Predicate.Predicate<number> = (n) => n > 0
|
|
@@ -1954,9 +1994,10 @@ export declare const reduce: {
|
|
|
1954
1994
|
* HashSet.filter(HashSet.make(-2, -1, 0, 1, 2), filterPositiveNumbers)
|
|
1955
1995
|
* ```
|
|
1956
1996
|
*
|
|
1957
|
-
* @example
|
|
1997
|
+
* @example
|
|
1958
1998
|
*
|
|
1959
1999
|
* ```ts
|
|
2000
|
+
* /// Syntax with Refinement
|
|
1960
2001
|
* import { HashSet, pipe } from "effect"
|
|
1961
2002
|
*
|
|
1962
2003
|
* const stringRefinement = (value: unknown): value is string =>
|
|
@@ -2079,9 +2120,10 @@ export declare const filter: {
|
|
|
2079
2120
|
* @memberof HashSet
|
|
2080
2121
|
* @since 2.0.0
|
|
2081
2122
|
* @category partitioning
|
|
2082
|
-
* @example
|
|
2123
|
+
* @example
|
|
2083
2124
|
*
|
|
2084
2125
|
* ```ts
|
|
2126
|
+
* // Syntax with Predicate
|
|
2085
2127
|
* import { HashSet, pipe, Predicate } from "effect"
|
|
2086
2128
|
*
|
|
2087
2129
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -2099,9 +2141,10 @@ export declare const filter: {
|
|
|
2099
2141
|
* HashSet.partition(HashSet.make(0, 1, 2, 3, 4, 5), (n) => n % 2 === 0)
|
|
2100
2142
|
* ```
|
|
2101
2143
|
*
|
|
2102
|
-
* @example
|
|
2144
|
+
* @example
|
|
2103
2145
|
*
|
|
2104
2146
|
* ```ts
|
|
2147
|
+
* // Syntax with Refinement
|
|
2105
2148
|
* import { HashSet, pipe, Predicate } from "effect"
|
|
2106
2149
|
*
|
|
2107
2150
|
* const stringRefinement: Predicate.Refinement<string | number, string> = (
|