effect 3.11.0 → 3.11.2

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.
@@ -5690,16 +5690,26 @@ export declare const paginateChunkEffect: <S, A, E, R>(s: S, f: (s: S) => Effect
5690
5690
  */
5691
5691
  export declare const paginateEffect: <S, A, E, R>(s: S, f: (s: S) => Effect.Effect<readonly [A, Option.Option<S>], E, R>) => Stream<A, E, R>;
5692
5692
  /**
5693
- * Partition a stream using a predicate. The first stream will contain all
5694
- * element evaluated to false and the second one will contain all element
5695
- * evaluated to true. The faster stream may advance by up to buffer elements
5696
- * further than the slower one.
5693
+ * Splits a stream into two substreams based on a predicate.
5694
+ *
5695
+ * **Details**
5696
+ *
5697
+ * The `Stream.partition` function splits a stream into two parts: one for
5698
+ * elements that satisfy the predicate (evaluated to `true`) and another for
5699
+ * those that do not (evaluated to `false`).
5700
+ *
5701
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5702
+ * one.
5703
+ *
5704
+ * @see {@link partitionEither} for partitioning a stream based on effectful
5705
+ * conditions.
5697
5706
  *
5698
5707
  * @example
5699
5708
  * ```ts
5709
+ * // Title: Partitioning a Stream into Even and Odd Numbers
5700
5710
  * import { Effect, Stream } from "effect"
5701
5711
  *
5702
- * const partition = Stream.range(1, 10).pipe(
5712
+ * const partition = Stream.range(1, 9).pipe(
5703
5713
  * Stream.partition((n) => n % 2 === 0, { bufferSize: 5 })
5704
5714
  * )
5705
5715
  *
@@ -5713,7 +5723,7 @@ export declare const paginateEffect: <S, A, E, R>(s: S, f: (s: S) => Effect.Effe
5713
5723
  *
5714
5724
  * // Effect.runPromise(program)
5715
5725
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5716
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
5726
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5717
5727
  * ```
5718
5728
  *
5719
5729
  * @since 2.0.0
@@ -5721,16 +5731,26 @@ export declare const paginateEffect: <S, A, E, R>(s: S, f: (s: S) => Effect.Effe
5721
5731
  */
5722
5732
  export declare const partition: {
5723
5733
  /**
5724
- * Partition a stream using a predicate. The first stream will contain all
5725
- * element evaluated to false and the second one will contain all element
5726
- * evaluated to true. The faster stream may advance by up to buffer elements
5727
- * further than the slower one.
5734
+ * Splits a stream into two substreams based on a predicate.
5735
+ *
5736
+ * **Details**
5737
+ *
5738
+ * The `Stream.partition` function splits a stream into two parts: one for
5739
+ * elements that satisfy the predicate (evaluated to `true`) and another for
5740
+ * those that do not (evaluated to `false`).
5741
+ *
5742
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5743
+ * one.
5744
+ *
5745
+ * @see {@link partitionEither} for partitioning a stream based on effectful
5746
+ * conditions.
5728
5747
  *
5729
5748
  * @example
5730
5749
  * ```ts
5750
+ * // Title: Partitioning a Stream into Even and Odd Numbers
5731
5751
  * import { Effect, Stream } from "effect"
5732
5752
  *
5733
- * const partition = Stream.range(1, 10).pipe(
5753
+ * const partition = Stream.range(1, 9).pipe(
5734
5754
  * Stream.partition((n) => n % 2 === 0, { bufferSize: 5 })
5735
5755
  * )
5736
5756
  *
@@ -5744,7 +5764,7 @@ export declare const partition: {
5744
5764
  *
5745
5765
  * // Effect.runPromise(program)
5746
5766
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5747
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
5767
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5748
5768
  * ```
5749
5769
  *
5750
5770
  * @since 2.0.0
@@ -5754,16 +5774,26 @@ export declare const partition: {
5754
5774
  bufferSize?: number | undefined;
5755
5775
  } | undefined): <E, R>(self: Stream<C, E, R>) => Effect.Effect<[excluded: Stream<Exclude<C, B>, E, never>, satisfying: Stream<B, E, never>], E, R | Scope.Scope>;
5756
5776
  /**
5757
- * Partition a stream using a predicate. The first stream will contain all
5758
- * element evaluated to false and the second one will contain all element
5759
- * evaluated to true. The faster stream may advance by up to buffer elements
5760
- * further than the slower one.
5777
+ * Splits a stream into two substreams based on a predicate.
5778
+ *
5779
+ * **Details**
5780
+ *
5781
+ * The `Stream.partition` function splits a stream into two parts: one for
5782
+ * elements that satisfy the predicate (evaluated to `true`) and another for
5783
+ * those that do not (evaluated to `false`).
5784
+ *
5785
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5786
+ * one.
5787
+ *
5788
+ * @see {@link partitionEither} for partitioning a stream based on effectful
5789
+ * conditions.
5761
5790
  *
5762
5791
  * @example
5763
5792
  * ```ts
5793
+ * // Title: Partitioning a Stream into Even and Odd Numbers
5764
5794
  * import { Effect, Stream } from "effect"
5765
5795
  *
5766
- * const partition = Stream.range(1, 10).pipe(
5796
+ * const partition = Stream.range(1, 9).pipe(
5767
5797
  * Stream.partition((n) => n % 2 === 0, { bufferSize: 5 })
5768
5798
  * )
5769
5799
  *
@@ -5777,7 +5807,7 @@ export declare const partition: {
5777
5807
  *
5778
5808
  * // Effect.runPromise(program)
5779
5809
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5780
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
5810
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5781
5811
  * ```
5782
5812
  *
5783
5813
  * @since 2.0.0
@@ -5787,16 +5817,26 @@ export declare const partition: {
5787
5817
  bufferSize?: number | undefined;
5788
5818
  } | undefined): <E, R>(self: Stream<A, E, R>) => Effect.Effect<[excluded: Stream<A, E, never>, satisfying: Stream<A, E, never>], E, Scope.Scope | R>;
5789
5819
  /**
5790
- * Partition a stream using a predicate. The first stream will contain all
5791
- * element evaluated to false and the second one will contain all element
5792
- * evaluated to true. The faster stream may advance by up to buffer elements
5793
- * further than the slower one.
5820
+ * Splits a stream into two substreams based on a predicate.
5821
+ *
5822
+ * **Details**
5823
+ *
5824
+ * The `Stream.partition` function splits a stream into two parts: one for
5825
+ * elements that satisfy the predicate (evaluated to `true`) and another for
5826
+ * those that do not (evaluated to `false`).
5827
+ *
5828
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5829
+ * one.
5830
+ *
5831
+ * @see {@link partitionEither} for partitioning a stream based on effectful
5832
+ * conditions.
5794
5833
  *
5795
5834
  * @example
5796
5835
  * ```ts
5836
+ * // Title: Partitioning a Stream into Even and Odd Numbers
5797
5837
  * import { Effect, Stream } from "effect"
5798
5838
  *
5799
- * const partition = Stream.range(1, 10).pipe(
5839
+ * const partition = Stream.range(1, 9).pipe(
5800
5840
  * Stream.partition((n) => n % 2 === 0, { bufferSize: 5 })
5801
5841
  * )
5802
5842
  *
@@ -5810,7 +5850,7 @@ export declare const partition: {
5810
5850
  *
5811
5851
  * // Effect.runPromise(program)
5812
5852
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5813
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
5853
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5814
5854
  * ```
5815
5855
  *
5816
5856
  * @since 2.0.0
@@ -5820,16 +5860,26 @@ export declare const partition: {
5820
5860
  bufferSize?: number | undefined;
5821
5861
  } | undefined): Effect.Effect<[excluded: Stream<Exclude<C, B>, E, never>, satisfying: Stream<B, E, never>], E, R | Scope.Scope>;
5822
5862
  /**
5823
- * Partition a stream using a predicate. The first stream will contain all
5824
- * element evaluated to false and the second one will contain all element
5825
- * evaluated to true. The faster stream may advance by up to buffer elements
5826
- * further than the slower one.
5863
+ * Splits a stream into two substreams based on a predicate.
5864
+ *
5865
+ * **Details**
5866
+ *
5867
+ * The `Stream.partition` function splits a stream into two parts: one for
5868
+ * elements that satisfy the predicate (evaluated to `true`) and another for
5869
+ * those that do not (evaluated to `false`).
5870
+ *
5871
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5872
+ * one.
5873
+ *
5874
+ * @see {@link partitionEither} for partitioning a stream based on effectful
5875
+ * conditions.
5827
5876
  *
5828
5877
  * @example
5829
5878
  * ```ts
5879
+ * // Title: Partitioning a Stream into Even and Odd Numbers
5830
5880
  * import { Effect, Stream } from "effect"
5831
5881
  *
5832
- * const partition = Stream.range(1, 10).pipe(
5882
+ * const partition = Stream.range(1, 9).pipe(
5833
5883
  * Stream.partition((n) => n % 2 === 0, { bufferSize: 5 })
5834
5884
  * )
5835
5885
  *
@@ -5843,7 +5893,7 @@ export declare const partition: {
5843
5893
  *
5844
5894
  * // Effect.runPromise(program)
5845
5895
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5846
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
5896
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5847
5897
  * ```
5848
5898
  *
5849
5899
  * @since 2.0.0
@@ -5854,16 +5904,29 @@ export declare const partition: {
5854
5904
  } | undefined): Effect.Effect<[excluded: Stream<A, E, never>, satisfying: Stream<A, E, never>], E, R | Scope.Scope>;
5855
5905
  };
5856
5906
  /**
5857
- * Split a stream by an effectful predicate. The faster stream may advance by
5858
- * up to buffer elements further than the slower one.
5907
+ * Splits a stream into two substreams based on an effectful condition.
5908
+ *
5909
+ * **Details**
5910
+ *
5911
+ * The `Stream.partitionEither` function is used to divide a stream into two
5912
+ * parts: one for elements that satisfy a condition producing `Either.left`
5913
+ * values, and another for those that produce `Either.right` values. This
5914
+ * function applies an effectful predicate to each element in the stream to
5915
+ * determine which substream it belongs to.
5916
+ *
5917
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5918
+ * one.
5919
+ *
5920
+ * @see {@link partition} for partitioning a stream based on simple conditions.
5859
5921
  *
5860
5922
  * @example
5861
5923
  * ```ts
5924
+ * // Title: Partitioning a Stream with an Effectful Predicate
5862
5925
  * import { Effect, Either, Stream } from "effect"
5863
5926
  *
5864
5927
  * const partition = Stream.range(1, 9).pipe(
5865
5928
  * Stream.partitionEither(
5866
- * (n) => Effect.succeed(n % 2 === 0 ? Either.left(n) : Either.right(n)),
5929
+ * (n) => Effect.succeed(n % 2 === 0 ? Either.right(n) : Either.left(n)),
5867
5930
  * { bufferSize: 5 }
5868
5931
  * )
5869
5932
  * )
@@ -5877,8 +5940,8 @@ export declare const partition: {
5877
5940
  * )
5878
5941
  *
5879
5942
  * // Effect.runPromise(program)
5880
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5881
5943
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5944
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5882
5945
  * ```
5883
5946
  *
5884
5947
  * @since 2.0.0
@@ -5886,16 +5949,29 @@ export declare const partition: {
5886
5949
  */
5887
5950
  export declare const partitionEither: {
5888
5951
  /**
5889
- * Split a stream by an effectful predicate. The faster stream may advance by
5890
- * up to buffer elements further than the slower one.
5952
+ * Splits a stream into two substreams based on an effectful condition.
5953
+ *
5954
+ * **Details**
5955
+ *
5956
+ * The `Stream.partitionEither` function is used to divide a stream into two
5957
+ * parts: one for elements that satisfy a condition producing `Either.left`
5958
+ * values, and another for those that produce `Either.right` values. This
5959
+ * function applies an effectful predicate to each element in the stream to
5960
+ * determine which substream it belongs to.
5961
+ *
5962
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
5963
+ * one.
5964
+ *
5965
+ * @see {@link partition} for partitioning a stream based on simple conditions.
5891
5966
  *
5892
5967
  * @example
5893
5968
  * ```ts
5969
+ * // Title: Partitioning a Stream with an Effectful Predicate
5894
5970
  * import { Effect, Either, Stream } from "effect"
5895
5971
  *
5896
5972
  * const partition = Stream.range(1, 9).pipe(
5897
5973
  * Stream.partitionEither(
5898
- * (n) => Effect.succeed(n % 2 === 0 ? Either.left(n) : Either.right(n)),
5974
+ * (n) => Effect.succeed(n % 2 === 0 ? Either.right(n) : Either.left(n)),
5899
5975
  * { bufferSize: 5 }
5900
5976
  * )
5901
5977
  * )
@@ -5909,8 +5985,8 @@ export declare const partitionEither: {
5909
5985
  * )
5910
5986
  *
5911
5987
  * // Effect.runPromise(program)
5912
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5913
5988
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
5989
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5914
5990
  * ```
5915
5991
  *
5916
5992
  * @since 2.0.0
@@ -5920,16 +5996,29 @@ export declare const partitionEither: {
5920
5996
  readonly bufferSize?: number | undefined;
5921
5997
  } | undefined): <E, R>(self: Stream<A, E, R>) => Effect.Effect<[left: Stream<A2, E2 | E, never>, right: Stream<A3, E2 | E, never>], E2 | E, Scope.Scope | R2 | R>;
5922
5998
  /**
5923
- * Split a stream by an effectful predicate. The faster stream may advance by
5924
- * up to buffer elements further than the slower one.
5999
+ * Splits a stream into two substreams based on an effectful condition.
6000
+ *
6001
+ * **Details**
6002
+ *
6003
+ * The `Stream.partitionEither` function is used to divide a stream into two
6004
+ * parts: one for elements that satisfy a condition producing `Either.left`
6005
+ * values, and another for those that produce `Either.right` values. This
6006
+ * function applies an effectful predicate to each element in the stream to
6007
+ * determine which substream it belongs to.
6008
+ *
6009
+ * The faster stream may advance up to `bufferSize` elements ahead of the slower
6010
+ * one.
6011
+ *
6012
+ * @see {@link partition} for partitioning a stream based on simple conditions.
5925
6013
  *
5926
6014
  * @example
5927
6015
  * ```ts
6016
+ * // Title: Partitioning a Stream with an Effectful Predicate
5928
6017
  * import { Effect, Either, Stream } from "effect"
5929
6018
  *
5930
6019
  * const partition = Stream.range(1, 9).pipe(
5931
6020
  * Stream.partitionEither(
5932
- * (n) => Effect.succeed(n % 2 === 0 ? Either.left(n) : Either.right(n)),
6021
+ * (n) => Effect.succeed(n % 2 === 0 ? Either.right(n) : Either.left(n)),
5933
6022
  * { bufferSize: 5 }
5934
6023
  * )
5935
6024
  * )
@@ -5943,8 +6032,8 @@ export declare const partitionEither: {
5943
6032
  * )
5944
6033
  *
5945
6034
  * // Effect.runPromise(program)
5946
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5947
6035
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
6036
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
5948
6037
  * ```
5949
6038
  *
5950
6039
  * @since 2.0.0