effect 3.14.5 → 3.14.7

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/src/index.ts CHANGED
@@ -818,6 +818,97 @@ export * as ModuleVersion from "./ModuleVersion.js"
818
818
  export * as MutableHashMap from "./MutableHashMap.js"
819
819
 
820
820
  /**
821
+ * # MutableHashSet
822
+ *
823
+ * A mutable `MutableHashSet` provides a collection of unique values with
824
+ * efficient lookup, insertion and removal. Unlike its immutable sibling
825
+ * {@link module:HashSet}, a `MutableHashSet` can be modified in-place;
826
+ * operations like add, remove, and clear directly modify the original set
827
+ * rather than creating a new one. This mutability offers benefits like improved
828
+ * performance in scenarios where you need to build or modify a set
829
+ * incrementally.
830
+ *
831
+ * ## What Problem Does It Solve?
832
+ *
833
+ * `MutableHashSet` solves the problem of maintaining an unsorted collection
834
+ * where each value appears exactly once, with fast operations for checking
835
+ * membership and adding/removing values, in contexts where mutability is
836
+ * preferred for performance or implementation simplicity.
837
+ *
838
+ * ## When to Use
839
+ *
840
+ * Use `MutableHashSet` when you need:
841
+ *
842
+ * - A collection with no duplicate values
843
+ * - Efficient membership testing (**`O(1)`** average complexity)
844
+ * - In-place modifications for better performance
845
+ * - A set that will be built or modified incrementally
846
+ * - Local mutability in otherwise immutable code
847
+ *
848
+ * ## Advanced Features
849
+ *
850
+ * MutableHashSet provides operations for:
851
+ *
852
+ * - Adding and removing elements with direct mutation
853
+ * - Checking for element existence
854
+ * - Clearing all elements at once
855
+ * - Converting to/from other collection types
856
+ *
857
+ * ## Performance Characteristics
858
+ *
859
+ * - **Lookup** operations ({@link module:MutableHashSet.has}): **`O(1)`** average
860
+ * time complexity
861
+ * - **Insertion** operations ({@link module:MutableHashSet.add}): **`O(1)`**
862
+ * average time complexity
863
+ * - **Removal** operations ({@link module:MutableHashSet.remove}): **`O(1)`**
864
+ * average time complexity
865
+ * - **Iteration**: **`O(n)`** where n is the size of the set
866
+ *
867
+ * The MutableHashSet data structure implements the following traits:
868
+ *
869
+ * - {@link Iterable}: allows iterating over the values in the set
870
+ * - {@link Pipeable}: allows chaining operations with the pipe operator
871
+ * - {@link Inspectable}: allows inspecting the contents of the set
872
+ *
873
+ * ## Operations Reference
874
+ *
875
+ * | Category | Operation | Description | Complexity |
876
+ * | ------------ | ------------------------------------------ | ----------------------------------- | ---------- |
877
+ * | constructors | {@link module:MutableHashSet.empty} | Creates an empty MutableHashSet | O(1) |
878
+ * | constructors | {@link module:MutableHashSet.fromIterable} | Creates a set from an iterable | O(n) |
879
+ * | constructors | {@link module:MutableHashSet.make} | Creates a set from multiple values | O(n) |
880
+ * | | | | |
881
+ * | elements | {@link module:MutableHashSet.has} | Checks if a value exists in the set | O(1) avg |
882
+ * | elements | {@link module:MutableHashSet.add} | Adds a value to the set | O(1) avg |
883
+ * | elements | {@link module:MutableHashSet.remove} | Removes a value from the set | O(1) avg |
884
+ * | elements | {@link module:MutableHashSet.size} | Gets the number of elements | O(1) |
885
+ * | elements | {@link module:MutableHashSet.clear} | Removes all values from the set | O(1) |
886
+ *
887
+ * ## Notes
888
+ *
889
+ * ### Mutability Considerations:
890
+ *
891
+ * Unlike most data structures in the Effect ecosystem, `MutableHashSet` is
892
+ * mutable. This means that operations like `add`, `remove`, and `clear` modify
893
+ * the original set rather than creating a new one. This can lead to more
894
+ * efficient code in some scenarios, but requires careful handling to avoid
895
+ * unexpected side effects.
896
+ *
897
+ * ### When to Choose `MutableHashSet` vs {@link module:HashSet}:
898
+ *
899
+ * - Use `MutableHashSet` when you need to build or modify a set incrementally and
900
+ * performance is a priority
901
+ * - Use `HashSet` when you want immutability guarantees and functional
902
+ * programming patterns
903
+ * - Consider using {@link module:HashSet}'s bounded mutation context (via
904
+ * {@link module:HashSet.beginMutation}, {@link module:HashSet.endMutation}, and
905
+ * {@link module:HashSet.mutate} methods) when you need temporary mutability
906
+ * within an otherwise immutable context - this approach might be sufficient
907
+ * for many use cases without requiring a separate `MutableHashSet`
908
+ * - `MutableHashSet` is often useful for local operations where the mutability is
909
+ * contained and doesn't leak into the broader application
910
+ *
911
+ * @module MutableHashSet
821
912
  * @since 2.0.0
822
913
  */
823
914
  export * as MutableHashSet from "./MutableHashSet.js"
@@ -245,7 +245,7 @@ export const summary = (key: MetricKey.MetricKey.Summary): MetricHook.MetricHook
245
245
  if (item != null) {
246
246
  const [t, v] = item
247
247
  const age = Duration.millis(now - t)
248
- if (Duration.greaterThanOrEqualTo(age, Duration.zero) && age <= maxAge) {
248
+ if (Duration.greaterThanOrEqualTo(age, Duration.zero) && Duration.lessThanOrEqualTo(age, maxAge)) {
249
249
  builder.push(v)
250
250
  }
251
251
  }
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.14.5"
1
+ let moduleVersion = "3.14.7"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4