@typed/fx 1.22.2 → 1.24.0
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/AsyncData.js.map +1 -1
- package/dist/cjs/Form.js.map +1 -1
- package/dist/cjs/FormEntry.js.map +1 -1
- package/dist/cjs/Fx.js +1 -1
- package/dist/cjs/Fx.js.map +1 -1
- package/dist/cjs/Idle.js.map +1 -1
- package/dist/cjs/Match.js.map +1 -1
- package/dist/cjs/Pull.js +5 -3
- package/dist/cjs/Pull.js.map +1 -1
- package/dist/cjs/RefArray.js.map +1 -1
- package/dist/cjs/RefChunk.js.map +1 -1
- package/dist/cjs/RefHashSet.js.map +1 -1
- package/dist/cjs/RefSubject.js +3 -2
- package/dist/cjs/RefSubject.js.map +1 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Subject.js.map +1 -1
- package/dist/cjs/Versioned.js.map +1 -1
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/helpers.js.map +1 -1
- package/dist/cjs/internal/keyed.js +1 -1
- package/dist/cjs/internal/keyed.js.map +1 -1
- package/dist/cjs/internal/provide.js.map +1 -1
- package/dist/cjs/internal/share.js.map +1 -1
- package/dist/cjs/internal/sync-producer.js.map +1 -1
- package/dist/dts/AsyncData.d.ts +53 -53
- package/dist/dts/AsyncData.d.ts.map +1 -1
- package/dist/dts/Emitter.d.ts +7 -7
- package/dist/dts/Emitter.d.ts.map +1 -1
- package/dist/dts/Form.d.ts +14 -14
- package/dist/dts/Form.d.ts.map +1 -1
- package/dist/dts/FormEntry.d.ts +11 -11
- package/dist/dts/FormEntry.d.ts.map +1 -1
- package/dist/dts/Fx.d.ts +417 -417
- package/dist/dts/Fx.d.ts.map +1 -1
- package/dist/dts/Guard.d.ts +21 -21
- package/dist/dts/Guard.d.ts.map +1 -1
- package/dist/dts/Idle.d.ts +12 -12
- package/dist/dts/Idle.d.ts.map +1 -1
- package/dist/dts/Match.d.ts +16 -16
- package/dist/dts/Match.d.ts.map +1 -1
- package/dist/dts/Pull.d.ts +5 -5
- package/dist/dts/Pull.d.ts.map +1 -1
- package/dist/dts/Push.d.ts +40 -40
- package/dist/dts/Push.d.ts.map +1 -1
- package/dist/dts/RefArray.d.ts +59 -59
- package/dist/dts/RefArray.d.ts.map +1 -1
- package/dist/dts/RefChunk.d.ts +45 -45
- package/dist/dts/RefChunk.d.ts.map +1 -1
- package/dist/dts/RefHashMap.d.ts +35 -35
- package/dist/dts/RefHashMap.d.ts.map +1 -1
- package/dist/dts/RefHashSet.d.ts +17 -17
- package/dist/dts/RefHashSet.d.ts.map +1 -1
- package/dist/dts/RefSubject.d.ts +136 -136
- package/dist/dts/RefSubject.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +63 -63
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +11 -11
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Subject.d.ts +13 -13
- package/dist/dts/Subject.d.ts.map +1 -1
- package/dist/dts/Typeclass.d.ts +1 -1
- package/dist/dts/Typeclass.d.ts.map +1 -1
- package/dist/dts/Versioned.d.ts +33 -33
- package/dist/dts/Versioned.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/internal/DeferredRef.d.ts +8 -8
- package/dist/dts/internal/DeferredRef.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts +191 -191
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/effect-loop-operator.d.ts +6 -6
- package/dist/dts/internal/effect-loop-operator.d.ts.map +1 -1
- package/dist/dts/internal/effect-operator.d.ts +16 -16
- package/dist/dts/internal/effect-operator.d.ts.map +1 -1
- package/dist/dts/internal/effect-producer.d.ts +13 -13
- package/dist/dts/internal/effect-producer.d.ts.map +1 -1
- package/dist/dts/internal/helpers.d.ts +26 -26
- package/dist/dts/internal/helpers.d.ts.map +1 -1
- package/dist/dts/internal/keyed.d.ts +1 -1
- package/dist/dts/internal/keyed.d.ts.map +1 -1
- package/dist/dts/internal/loop-operator.d.ts +2 -2
- package/dist/dts/internal/loop-operator.d.ts.map +1 -1
- package/dist/dts/internal/operator.d.ts +2 -2
- package/dist/dts/internal/operator.d.ts.map +1 -1
- package/dist/dts/internal/protos.d.ts +12 -12
- package/dist/dts/internal/protos.d.ts.map +1 -1
- package/dist/dts/internal/provide.d.ts +15 -15
- package/dist/dts/internal/provide.d.ts.map +1 -1
- package/dist/dts/internal/share.d.ts +11 -11
- package/dist/dts/internal/share.d.ts.map +1 -1
- package/dist/dts/internal/sync-operator.d.ts +2 -2
- package/dist/dts/internal/sync-operator.d.ts.map +1 -1
- package/dist/dts/internal/sync-producer.d.ts +6 -6
- package/dist/dts/internal/sync-producer.d.ts.map +1 -1
- package/dist/dts/internal/withKey.d.ts +1 -1
- package/dist/dts/internal/withKey.d.ts.map +1 -1
- package/dist/esm/AsyncData.js.map +1 -1
- package/dist/esm/Form.js.map +1 -1
- package/dist/esm/FormEntry.js.map +1 -1
- package/dist/esm/Fx.js +1 -1
- package/dist/esm/Fx.js.map +1 -1
- package/dist/esm/Idle.js.map +1 -1
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Pull.js +3 -3
- package/dist/esm/Pull.js.map +1 -1
- package/dist/esm/RefArray.js.map +1 -1
- package/dist/esm/RefChunk.js.map +1 -1
- package/dist/esm/RefHashSet.js.map +1 -1
- package/dist/esm/RefSubject.js +3 -1
- package/dist/esm/RefSubject.js.map +1 -1
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Subject.js.map +1 -1
- package/dist/esm/Versioned.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/helpers.js.map +1 -1
- package/dist/esm/internal/keyed.js +1 -1
- package/dist/esm/internal/keyed.js.map +1 -1
- package/dist/esm/internal/provide.js.map +1 -1
- package/dist/esm/internal/share.js.map +1 -1
- package/dist/esm/internal/sync-producer.js.map +1 -1
- package/package.json +6 -6
- package/src/AsyncData.ts +142 -144
- package/src/Emitter.ts +13 -13
- package/src/Form.ts +55 -55
- package/src/FormEntry.ts +39 -39
- package/src/Fx.ts +788 -789
- package/src/Guard.ts +43 -43
- package/src/Idle.ts +26 -26
- package/src/Match.ts +60 -61
- package/src/Pull.ts +42 -43
- package/src/Push.ts +195 -195
- package/src/RefArray.ts +121 -119
- package/src/RefChunk.ts +98 -97
- package/src/RefHashMap.ts +79 -79
- package/src/RefHashSet.ts +40 -39
- package/src/RefSubject.ts +574 -565
- package/src/Sink.ts +303 -303
- package/src/Stream.ts +27 -27
- package/src/Subject.ts +48 -46
- package/src/Typeclass.ts +2 -2
- package/src/Versioned.ts +97 -97
- package/src/index.ts +1 -1
- package/src/internal/DeferredRef.ts +7 -7
- package/src/internal/core.ts +768 -781
- package/src/internal/effect-loop-operator.ts +7 -7
- package/src/internal/effect-operator.ts +23 -23
- package/src/internal/effect-producer.ts +38 -38
- package/src/internal/helpers.ts +51 -51
- package/src/internal/keyed.ts +21 -21
- package/src/internal/loop-operator.ts +2 -2
- package/src/internal/operator.ts +2 -2
- package/src/internal/protos.ts +15 -15
- package/src/internal/provide.ts +27 -27
- package/src/internal/share.ts +25 -25
- package/src/internal/sync-operator.ts +4 -4
- package/src/internal/sync-producer.ts +15 -15
- package/src/internal/withKey.ts +13 -13
package/src/RefArray.ts
CHANGED
|
@@ -20,26 +20,28 @@ import * as RefSubject from "./RefSubject.js"
|
|
|
20
20
|
* @since 1.18.0
|
|
21
21
|
* @category models
|
|
22
22
|
*/
|
|
23
|
-
export interface RefArray<out
|
|
23
|
+
export interface RefArray<in out A, in out E = never, out R = never>
|
|
24
|
+
extends RefSubject.RefSubject<ReadonlyArray<A>, E, R>
|
|
25
|
+
{}
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Construct a new RefArray with the given initial value.
|
|
27
29
|
* @since 1.18.0
|
|
28
30
|
* @category constructors
|
|
29
31
|
*/
|
|
30
|
-
export function make<
|
|
31
|
-
initial: Effect.Effect<
|
|
32
|
+
export function make<A, E, R>(
|
|
33
|
+
initial: Effect.Effect<ReadonlyArray<A>, E, R>,
|
|
32
34
|
eq?: Equivalence<A>
|
|
33
|
-
): Effect.Effect<R | Scope.Scope
|
|
34
|
-
export function make<
|
|
35
|
-
initial: Fx.Fx<
|
|
35
|
+
): Effect.Effect<RefArray<A, E>, never, R | Scope.Scope>
|
|
36
|
+
export function make<A, E, R>(
|
|
37
|
+
initial: Fx.Fx<ReadonlyArray<A>, E, R>,
|
|
36
38
|
eq?: Equivalence<A>
|
|
37
|
-
): Effect.Effect<R | Scope.Scope
|
|
39
|
+
): Effect.Effect<RefArray<A, E>, never, R | Scope.Scope>
|
|
38
40
|
|
|
39
|
-
export function make<
|
|
40
|
-
initial: Effect.Effect<
|
|
41
|
+
export function make<A, E, R>(
|
|
42
|
+
initial: Effect.Effect<ReadonlyArray<A>, E, R> | Fx.Fx<ReadonlyArray<A>, E, R>,
|
|
41
43
|
eq: Equivalence<A> = equals
|
|
42
|
-
): Effect.Effect<R | Scope.Scope
|
|
44
|
+
): Effect.Effect<RefArray<A, E>, never, R | Scope.Scope> {
|
|
43
45
|
return RefSubject.make(
|
|
44
46
|
initial,
|
|
45
47
|
{
|
|
@@ -57,24 +59,24 @@ export function make<R, E, A>(
|
|
|
57
59
|
export function tagged<A>(): {
|
|
58
60
|
<const I extends C.IdentifierConstructor<any>>(
|
|
59
61
|
identifier: (id: typeof C.id) => I
|
|
60
|
-
): RefSubject.RefSubject.Tagged<
|
|
62
|
+
): RefSubject.RefSubject.Tagged<ReadonlyArray<A>, never, C.IdentifierOf<I>>
|
|
61
63
|
|
|
62
|
-
<const I>(identifier: I): RefSubject.RefSubject.Tagged<
|
|
64
|
+
<const I>(identifier: I): RefSubject.RefSubject.Tagged<ReadonlyArray<A>, never, C.IdentifierOf<I>>
|
|
63
65
|
}
|
|
64
66
|
export function tagged<E, A>(): {
|
|
65
67
|
<const I extends C.IdentifierConstructor<any>>(
|
|
66
68
|
identifier: (id: typeof C.id) => I
|
|
67
|
-
): RefSubject.RefSubject.Tagged<
|
|
69
|
+
): RefSubject.RefSubject.Tagged<ReadonlyArray<A>, E, C.IdentifierOf<I>>
|
|
68
70
|
|
|
69
|
-
<const I>(identifier: I): RefSubject.RefSubject.Tagged<
|
|
71
|
+
<const I>(identifier: I): RefSubject.RefSubject.Tagged<ReadonlyArray<A>, E, C.IdentifierOf<I>>
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export function tagged(): {
|
|
73
75
|
<const I extends C.IdentifierConstructor<any>>(
|
|
74
76
|
identifier: (id: typeof C.id) => I
|
|
75
77
|
):
|
|
76
|
-
| RefSubject.RefSubject.Tagged<
|
|
77
|
-
| RefSubject.RefSubject.Tagged<
|
|
78
|
+
| RefSubject.RefSubject.Tagged<ReadonlyArray<any>, any, ReadonlyArray<any>>
|
|
79
|
+
| RefSubject.RefSubject.Tagged<ReadonlyArray<any>, never, ReadonlyArray<any>>
|
|
78
80
|
|
|
79
81
|
<const I>(
|
|
80
82
|
identifier: I
|
|
@@ -91,9 +93,9 @@ export function tagged(): {
|
|
|
91
93
|
* @category combinators
|
|
92
94
|
*/
|
|
93
95
|
export const prepend: {
|
|
94
|
-
<A>(value: A): <
|
|
95
|
-
<
|
|
96
|
-
} = dual(2, function prepend<
|
|
96
|
+
<A>(value: A): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
97
|
+
<A, E, R>(ref: RefArray<A, E, R>, value: A): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
98
|
+
} = dual(2, function prepend<A, E, R>(ref: RefArray<A, E, R>, value: A) {
|
|
97
99
|
return RefSubject.update(ref, ReadonlyArray.prepend(value))
|
|
98
100
|
})
|
|
99
101
|
|
|
@@ -103,11 +105,11 @@ export const prepend: {
|
|
|
103
105
|
* @category combinators
|
|
104
106
|
*/
|
|
105
107
|
export const prependAll: {
|
|
106
|
-
<A>(value: Iterable<A>): <
|
|
107
|
-
<
|
|
108
|
+
<A>(value: Iterable<A>): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
109
|
+
<A, E, R>(ref: RefArray<A, E, R>, value: Iterable<A>): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
108
110
|
} = dual(
|
|
109
111
|
2,
|
|
110
|
-
function prependAll<
|
|
112
|
+
function prependAll<A, E, R>(ref: RefArray<A, E, R>, value: Iterable<A>) {
|
|
111
113
|
return RefSubject.update(ref, ReadonlyArray.prependAll(value))
|
|
112
114
|
}
|
|
113
115
|
)
|
|
@@ -118,9 +120,9 @@ export const prependAll: {
|
|
|
118
120
|
* @category combinators
|
|
119
121
|
*/
|
|
120
122
|
export const append: {
|
|
121
|
-
<A>(value: A): <
|
|
122
|
-
<
|
|
123
|
-
} = dual(2, function append<
|
|
123
|
+
<A>(value: A): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
124
|
+
<A, E, R>(ref: RefArray<A, E, R>, value: A): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
125
|
+
} = dual(2, function append<A, E, R>(ref: RefArray<A, E, R>, value: A) {
|
|
124
126
|
return RefSubject.update(ref, ReadonlyArray.append(value))
|
|
125
127
|
})
|
|
126
128
|
|
|
@@ -132,9 +134,9 @@ export const append: {
|
|
|
132
134
|
export const appendAll: {
|
|
133
135
|
<A>(
|
|
134
136
|
value: Iterable<A>
|
|
135
|
-
): <
|
|
136
|
-
<
|
|
137
|
-
} = dual(2, function appendAll<
|
|
137
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
138
|
+
<A, E, R>(ref: RefArray<A, E, R>, value: Iterable<A>): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
139
|
+
} = dual(2, function appendAll<A, E, R>(ref: RefArray<A, E, R>, value: Iterable<A>) {
|
|
138
140
|
return RefSubject.update(ref, ReadonlyArray.appendAll(value))
|
|
139
141
|
})
|
|
140
142
|
|
|
@@ -144,9 +146,9 @@ export const appendAll: {
|
|
|
144
146
|
* @category combinators
|
|
145
147
|
*/
|
|
146
148
|
export const drop: {
|
|
147
|
-
(n: number): <
|
|
148
|
-
<
|
|
149
|
-
} = dual(2, function drop<
|
|
149
|
+
(n: number): <A, E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
150
|
+
<A, E, R>(ref: RefArray<A, E, R>, n: number): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
151
|
+
} = dual(2, function drop<A, E, R>(ref: RefArray<A, E, R>, n: number) {
|
|
150
152
|
return RefSubject.update(ref, ReadonlyArray.drop(n))
|
|
151
153
|
})
|
|
152
154
|
|
|
@@ -156,9 +158,9 @@ export const drop: {
|
|
|
156
158
|
* @category combinators
|
|
157
159
|
*/
|
|
158
160
|
export const dropRight: {
|
|
159
|
-
(n: number): <
|
|
160
|
-
<
|
|
161
|
-
} = dual(2, function dropRight<
|
|
161
|
+
(n: number): <A, E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
162
|
+
<A, E, R>(ref: RefArray<A, E, R>, n: number): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
163
|
+
} = dual(2, function dropRight<A, E, R>(ref: RefArray<A, E, R>, n: number) {
|
|
162
164
|
return RefSubject.update(ref, ReadonlyArray.dropRight(n))
|
|
163
165
|
})
|
|
164
166
|
|
|
@@ -170,14 +172,14 @@ export const dropRight: {
|
|
|
170
172
|
export const dropWhile: {
|
|
171
173
|
<A>(
|
|
172
174
|
predicate: (a: A) => boolean
|
|
173
|
-
): <
|
|
174
|
-
<
|
|
175
|
-
ref: RefArray<
|
|
175
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
176
|
+
<A, E, R>(
|
|
177
|
+
ref: RefArray<A, E, R>,
|
|
176
178
|
predicate: (a: unknown) => boolean
|
|
177
|
-
): Effect.Effect<
|
|
179
|
+
): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
178
180
|
} = dual(
|
|
179
181
|
2,
|
|
180
|
-
function dropWhile<
|
|
182
|
+
function dropWhile<A, E, R>(ref: RefArray<A, E, R>, predicate: (a: unknown) => boolean) {
|
|
181
183
|
return RefSubject.update(ref, ReadonlyArray.dropWhile(predicate))
|
|
182
184
|
}
|
|
183
185
|
)
|
|
@@ -190,12 +192,12 @@ export const dropWhile: {
|
|
|
190
192
|
export const filterValues: {
|
|
191
193
|
<A>(
|
|
192
194
|
predicate: (a: A) => boolean
|
|
193
|
-
): <
|
|
194
|
-
<
|
|
195
|
-
ref: RefArray<
|
|
195
|
+
): <E, R>(ref: RefArray<A, E, R>) => RefSubject.Computed<ReadonlyArray<A>, E, R>
|
|
196
|
+
<A, E, R>(
|
|
197
|
+
ref: RefArray<A, E, R>,
|
|
196
198
|
predicate: (a: A) => boolean
|
|
197
|
-
): RefSubject.Computed<
|
|
198
|
-
} = dual(2, function filterValues<
|
|
199
|
+
): RefSubject.Computed<ReadonlyArray<A>, E, R>
|
|
200
|
+
} = dual(2, function filterValues<A, E, R>(ref: RefArray<A, E, R>, predicate: (a: A) => boolean) {
|
|
199
201
|
return RefSubject.map(ref, ReadonlyArray.filter(predicate))
|
|
200
202
|
})
|
|
201
203
|
|
|
@@ -205,9 +207,9 @@ export const filterValues: {
|
|
|
205
207
|
* @category filtered
|
|
206
208
|
*/
|
|
207
209
|
export const getIndex: {
|
|
208
|
-
(index: number): <
|
|
209
|
-
<
|
|
210
|
-
} = dual(2, function getIndex<
|
|
210
|
+
(index: number): <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>
|
|
211
|
+
<A, E, R>(ref: RefArray<A, E, R>, index: number): RefSubject.Filtered<A, E, R>
|
|
212
|
+
} = dual(2, function getIndex<A, E, R>(ref: RefArray<A, E, R>, index: number) {
|
|
211
213
|
return RefSubject.filterMap(ref, ReadonlyArray.get(index))
|
|
212
214
|
})
|
|
213
215
|
|
|
@@ -219,14 +221,14 @@ export const getIndex: {
|
|
|
219
221
|
export const groupBy: {
|
|
220
222
|
<A>(
|
|
221
223
|
f: (a: A) => string
|
|
222
|
-
): <
|
|
223
|
-
ref: RefArray<
|
|
224
|
+
): <E, R>(
|
|
225
|
+
ref: RefArray<A, E, R>
|
|
224
226
|
) => RefSubject.Computed<R, E, Record<string, ReadonlyArray<A>>>
|
|
225
|
-
<
|
|
226
|
-
ref: RefArray<
|
|
227
|
+
<A, E, R>(
|
|
228
|
+
ref: RefArray<A, E, R>,
|
|
227
229
|
f: (a: A) => string
|
|
228
230
|
): RefSubject.Computed<R, E, Record<string, ReadonlyArray<A>>>
|
|
229
|
-
} = dual(2, function groupBy<
|
|
231
|
+
} = dual(2, function groupBy<A, E, R>(ref: RefArray<A, E, R>, f: (a: A) => string) {
|
|
230
232
|
return RefSubject.map(ref, ReadonlyArray.groupBy(f))
|
|
231
233
|
})
|
|
232
234
|
|
|
@@ -239,13 +241,13 @@ export const insertAt: {
|
|
|
239
241
|
<A>(
|
|
240
242
|
index: number,
|
|
241
243
|
a: A
|
|
242
|
-
): <
|
|
243
|
-
<
|
|
244
|
-
ref: RefArray<
|
|
244
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
245
|
+
<A, E, R>(
|
|
246
|
+
ref: RefArray<A, E, R>,
|
|
245
247
|
index: number,
|
|
246
248
|
a: A
|
|
247
|
-
): Effect.Effect<
|
|
248
|
-
} = dual(3, function insertAt<
|
|
249
|
+
): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
250
|
+
} = dual(3, function insertAt<A, E, R>(ref: RefArray<A, E, R>, index: number, a: A) {
|
|
249
251
|
return RefSubject.update(ref, (as) => Option.getOrElse(ReadonlyArray.insertAt(as, index, a), () => [...as, a]))
|
|
250
252
|
})
|
|
251
253
|
|
|
@@ -254,7 +256,7 @@ export const insertAt: {
|
|
|
254
256
|
* @since 1.18.0
|
|
255
257
|
* @category computed
|
|
256
258
|
*/
|
|
257
|
-
export const isEmpty = <
|
|
259
|
+
export const isEmpty = <A, E, R>(ref: RefArray<A, E, R>): RefSubject.Computed<boolean, E, R> =>
|
|
258
260
|
RefSubject.map(ref, ReadonlyArray.isEmptyReadonlyArray)
|
|
259
261
|
|
|
260
262
|
/**
|
|
@@ -262,16 +264,16 @@ export const isEmpty = <R, E, A>(ref: RefArray<R, E, A>): RefSubject.Computed<R,
|
|
|
262
264
|
* @since 1.18.0
|
|
263
265
|
* @category computed
|
|
264
266
|
*/
|
|
265
|
-
export const isNonEmpty = <
|
|
266
|
-
ref: RefArray<
|
|
267
|
-
): RefSubject.Computed<
|
|
267
|
+
export const isNonEmpty = <A, E, R>(
|
|
268
|
+
ref: RefArray<A, E, R>
|
|
269
|
+
): RefSubject.Computed<boolean, E, R> => RefSubject.map(ref, ReadonlyArray.isNonEmptyReadonlyArray)
|
|
268
270
|
|
|
269
271
|
/**
|
|
270
272
|
* Get the current length of a RefArray.
|
|
271
273
|
* @since 1.18.0
|
|
272
274
|
* @category computed
|
|
273
275
|
*/
|
|
274
|
-
export const length = <
|
|
276
|
+
export const length = <A, E, R>(ref: RefArray<A, E, R>): RefSubject.Computed<number, E, R> =>
|
|
275
277
|
RefSubject.map(ref, ReadonlyArray.length)
|
|
276
278
|
|
|
277
279
|
/**
|
|
@@ -282,12 +284,12 @@ export const length = <R, E, A>(ref: RefArray<R, E, A>): RefSubject.Computed<R,
|
|
|
282
284
|
export const map: {
|
|
283
285
|
<A>(
|
|
284
286
|
f: (a: A, index: number) => A
|
|
285
|
-
): <
|
|
286
|
-
<
|
|
287
|
-
ref: RefArray<
|
|
287
|
+
): <E, R>(ref: RefArray<A, E, R>) => RefSubject.Computed<ReadonlyArray<A>, E, R>
|
|
288
|
+
<A, E, R>(
|
|
289
|
+
ref: RefArray<A, E, R>,
|
|
288
290
|
f: (a: A, index: number) => A
|
|
289
|
-
): RefSubject.Computed<
|
|
290
|
-
} = dual(2, function mapValues<
|
|
291
|
+
): RefSubject.Computed<ReadonlyArray<A>, E, R>
|
|
292
|
+
} = dual(2, function mapValues<A, E, R>(ref: RefArray<A, E, R>, f: (a: A, index: number) => A) {
|
|
291
293
|
return RefSubject.update(ref, ReadonlyArray.map(f))
|
|
292
294
|
})
|
|
293
295
|
|
|
@@ -299,14 +301,14 @@ export const map: {
|
|
|
299
301
|
export const mapValues: {
|
|
300
302
|
<A, B>(
|
|
301
303
|
f: (a: A, index: number) => B
|
|
302
|
-
): <
|
|
303
|
-
<
|
|
304
|
-
ref: RefArray<
|
|
304
|
+
): <E, R>(ref: RefArray<A, E, R>) => RefSubject.Computed<ReadonlyArray<B>, E, R>
|
|
305
|
+
<A, E, R, B>(
|
|
306
|
+
ref: RefArray<A, E, R>,
|
|
305
307
|
f: (a: A, index: number) => B
|
|
306
|
-
): RefSubject.Computed<
|
|
308
|
+
): RefSubject.Computed<ReadonlyArray<B>, E, R>
|
|
307
309
|
} = dual(
|
|
308
310
|
2,
|
|
309
|
-
function mapValues<
|
|
311
|
+
function mapValues<A, E, R, B>(ref: RefArray<A, E, R>, f: (a: A, index: number) => B) {
|
|
310
312
|
return RefSubject.map(ref, ReadonlyArray.map(f))
|
|
311
313
|
}
|
|
312
314
|
)
|
|
@@ -320,13 +322,13 @@ export const modifyAt: {
|
|
|
320
322
|
<A>(
|
|
321
323
|
index: number,
|
|
322
324
|
f: (a: A) => A
|
|
323
|
-
): <
|
|
324
|
-
<
|
|
325
|
-
ref: RefArray<
|
|
325
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
326
|
+
<A, E, R>(
|
|
327
|
+
ref: RefArray<A, E, R>,
|
|
326
328
|
index: number,
|
|
327
329
|
f: (a: A) => A
|
|
328
|
-
): Effect.Effect<
|
|
329
|
-
} = dual(3, function modifyAt<
|
|
330
|
+
): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
331
|
+
} = dual(3, function modifyAt<A, E, R>(ref: RefArray<A, E, R>, index: number, f: (a: A) => A) {
|
|
330
332
|
return RefSubject.update(ref, ReadonlyArray.modify(index, f))
|
|
331
333
|
})
|
|
332
334
|
|
|
@@ -338,15 +340,15 @@ export const modifyAt: {
|
|
|
338
340
|
export const partition: {
|
|
339
341
|
<A, B extends A>(
|
|
340
342
|
predicate: (a: A) => a is B
|
|
341
|
-
): <
|
|
342
|
-
ref: RefArray<
|
|
343
|
+
): <E, R>(
|
|
344
|
+
ref: RefArray<A, E, R>
|
|
343
345
|
) => RefSubject.Computed<R, E, readonly [ReadonlyArray<B>, ReadonlyArray<A>]>
|
|
344
|
-
<
|
|
346
|
+
<A, E, R>(ref: RefArray<A, E, R>, predicate: (a: A) => boolean): RefSubject.Computed<
|
|
345
347
|
never,
|
|
346
348
|
E,
|
|
347
349
|
readonly [ReadonlyArray<A>, ReadonlyArray<A>]
|
|
348
350
|
>
|
|
349
|
-
} = dual(2, function partition<
|
|
351
|
+
} = dual(2, function partition<A, E, R>(ref: RefArray<A, E, R>, predicate: (a: A) => boolean) {
|
|
350
352
|
return RefSubject.map(ref, ReadonlyArray.partition(predicate))
|
|
351
353
|
})
|
|
352
354
|
|
|
@@ -359,15 +361,15 @@ export const reduce: {
|
|
|
359
361
|
<A, B>(
|
|
360
362
|
b: B,
|
|
361
363
|
f: (b: B, a: A, index: number) => B
|
|
362
|
-
): <
|
|
363
|
-
<
|
|
364
|
-
ref: RefArray<
|
|
364
|
+
): <E, R>(ref: RefArray<A, E, R>) => RefSubject.Computed<B, E, R>
|
|
365
|
+
<A, E, R, B>(
|
|
366
|
+
ref: RefArray<A, E, R>,
|
|
365
367
|
b: B,
|
|
366
368
|
f: (b: B, a: A, index: number) => B
|
|
367
|
-
): RefSubject.Computed<
|
|
369
|
+
): RefSubject.Computed<B, E, R>
|
|
368
370
|
} = dual(
|
|
369
371
|
3,
|
|
370
|
-
function reduce<
|
|
372
|
+
function reduce<A, E, R, B>(ref: RefArray<A, E, R>, b: B, f: (b: B, a: A, index: number) => B) {
|
|
371
373
|
return RefSubject.map(ref, ReadonlyArray.reduce(b, f))
|
|
372
374
|
}
|
|
373
375
|
)
|
|
@@ -381,16 +383,16 @@ export const reduceRight: {
|
|
|
381
383
|
<A, B>(
|
|
382
384
|
b: B,
|
|
383
385
|
f: (b: B, a: A, index: number) => B
|
|
384
|
-
): <
|
|
385
|
-
<
|
|
386
|
-
ref: RefArray<
|
|
386
|
+
): <E, R>(ref: RefArray<A, E, R>) => RefSubject.Computed<B, E, R>
|
|
387
|
+
<A, E, R, B>(
|
|
388
|
+
ref: RefArray<A, E, R>,
|
|
387
389
|
b: B,
|
|
388
390
|
f: (b: B, a: A, index: number) => B
|
|
389
|
-
): RefSubject.Computed<
|
|
391
|
+
): RefSubject.Computed<B, E, R>
|
|
390
392
|
} = dual(
|
|
391
393
|
3,
|
|
392
|
-
function reduceRight<
|
|
393
|
-
ref: RefArray<
|
|
394
|
+
function reduceRight<A, E, R, B>(
|
|
395
|
+
ref: RefArray<A, E, R>,
|
|
394
396
|
b: B,
|
|
395
397
|
f: (b: B, a: A, index: number) => B
|
|
396
398
|
) {
|
|
@@ -407,13 +409,13 @@ export const replaceAt: {
|
|
|
407
409
|
<A>(
|
|
408
410
|
index: number,
|
|
409
411
|
a: A
|
|
410
|
-
): <
|
|
411
|
-
<
|
|
412
|
-
ref: RefArray<
|
|
412
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
413
|
+
<A, E, R>(
|
|
414
|
+
ref: RefArray<A, E, R>,
|
|
413
415
|
index: number,
|
|
414
416
|
a: A
|
|
415
|
-
): Effect.Effect<
|
|
416
|
-
} = dual(3, function replaceAt<
|
|
417
|
+
): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
418
|
+
} = dual(3, function replaceAt<A, E, R>(ref: RefArray<A, E, R>, index: number, a: A) {
|
|
417
419
|
return RefSubject.update(ref, ReadonlyArray.replace(index, a))
|
|
418
420
|
})
|
|
419
421
|
|
|
@@ -423,9 +425,9 @@ export const replaceAt: {
|
|
|
423
425
|
* @category combinators
|
|
424
426
|
*/
|
|
425
427
|
export const rotate: {
|
|
426
|
-
(n: number): <
|
|
427
|
-
<
|
|
428
|
-
} = dual(2, function rotate<
|
|
428
|
+
(n: number): <A, E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
429
|
+
<A, E, R>(ref: RefArray<A, E, R>, n: number): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
430
|
+
} = dual(2, function rotate<A, E, R>(ref: RefArray<A, E, R>, n: number) {
|
|
429
431
|
return RefSubject.update(ref, ReadonlyArray.rotate(n))
|
|
430
432
|
})
|
|
431
433
|
|
|
@@ -437,12 +439,12 @@ export const rotate: {
|
|
|
437
439
|
export const sortBy: {
|
|
438
440
|
<A>(
|
|
439
441
|
orders: Iterable<Order.Order<A>>
|
|
440
|
-
): <
|
|
441
|
-
<
|
|
442
|
-
ref: RefArray<
|
|
442
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
443
|
+
<A, E, R>(
|
|
444
|
+
ref: RefArray<A, E, R>,
|
|
443
445
|
orders: Iterable<Order.Order<A>>
|
|
444
|
-
): Effect.Effect<
|
|
445
|
-
} = dual(2, function sortBy<
|
|
446
|
+
): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
447
|
+
} = dual(2, function sortBy<A, E, R>(ref: RefArray<A, E, R>, orders: Iterable<Order.Order<A>>) {
|
|
446
448
|
return RefSubject.update(ref, ReadonlyArray.sortBy(...orders))
|
|
447
449
|
})
|
|
448
450
|
|
|
@@ -452,9 +454,9 @@ export const sortBy: {
|
|
|
452
454
|
* @category combinators
|
|
453
455
|
*/
|
|
454
456
|
export const take: {
|
|
455
|
-
(n: number): <
|
|
456
|
-
<
|
|
457
|
-
} = dual(2, function take<
|
|
457
|
+
(n: number): <A, E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
458
|
+
<A, E, R>(ref: RefArray<A, E, R>, n: number): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
459
|
+
} = dual(2, function take<A, E, R>(ref: RefArray<A, E, R>, n: number) {
|
|
458
460
|
return RefSubject.update(ref, ReadonlyArray.take(n))
|
|
459
461
|
})
|
|
460
462
|
|
|
@@ -464,9 +466,9 @@ export const take: {
|
|
|
464
466
|
* @category combinators
|
|
465
467
|
*/
|
|
466
468
|
export const takeRight: {
|
|
467
|
-
(n: number): <
|
|
468
|
-
<
|
|
469
|
-
} = dual(2, function takeRight<
|
|
469
|
+
(n: number): <A, E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
470
|
+
<A, E, R>(ref: RefArray<A, E, R>, n: number): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
471
|
+
} = dual(2, function takeRight<A, E, R>(ref: RefArray<A, E, R>, n: number) {
|
|
470
472
|
return RefSubject.update(ref, ReadonlyArray.takeRight(n))
|
|
471
473
|
})
|
|
472
474
|
|
|
@@ -478,14 +480,14 @@ export const takeRight: {
|
|
|
478
480
|
export const takeWhile: {
|
|
479
481
|
<A>(
|
|
480
482
|
predicate: (a: A) => boolean
|
|
481
|
-
): <
|
|
482
|
-
<
|
|
483
|
-
ref: RefArray<
|
|
483
|
+
): <E, R>(ref: RefArray<A, E, R>) => Effect.Effect<ReadonlyArray<A>, E, R>
|
|
484
|
+
<A, E, R>(
|
|
485
|
+
ref: RefArray<A, E, R>,
|
|
484
486
|
predicate: (a: unknown) => boolean
|
|
485
|
-
): Effect.Effect<
|
|
487
|
+
): Effect.Effect<ReadonlyArray<A>, E, R>
|
|
486
488
|
} = dual(
|
|
487
489
|
2,
|
|
488
|
-
function takeWhile<
|
|
490
|
+
function takeWhile<A, E, R>(ref: RefArray<A, E, R>, predicate: (a: unknown) => boolean) {
|
|
489
491
|
return RefSubject.update(ref, ReadonlyArray.takeWhile(predicate))
|
|
490
492
|
}
|
|
491
493
|
)
|
|
@@ -496,17 +498,17 @@ export const takeWhile: {
|
|
|
496
498
|
* @category combinators
|
|
497
499
|
*/
|
|
498
500
|
export const dedupeWith =
|
|
499
|
-
<A>(valueEq: Equivalence<A>) => <
|
|
501
|
+
<A>(valueEq: Equivalence<A>) => <E, R>(ref: RefArray<A, E, R>): Effect.Effect<ReadonlyArray<A>, E, R> =>
|
|
500
502
|
RefSubject.update(ref, ReadonlyArray.dedupeWith(valueEq))
|
|
501
503
|
|
|
502
504
|
/**
|
|
503
505
|
* @since 1.18.0
|
|
504
506
|
*/
|
|
505
|
-
export const last = <
|
|
507
|
+
export const last = <A, E, R>(ref: RefArray<A, E, R>): RefSubject.Filtered<A, E, R> =>
|
|
506
508
|
RefSubject.filterMap(ref, ReadonlyArray.last)
|
|
507
509
|
|
|
508
510
|
/**
|
|
509
511
|
* @since 1.18.0
|
|
510
512
|
*/
|
|
511
|
-
export const head = <
|
|
513
|
+
export const head = <A, E, R>(ref: RefArray<A, E, R>): RefSubject.Filtered<A, E, R> =>
|
|
512
514
|
RefSubject.filterMap(ref, ReadonlyArray.head)
|