effect-lens 0.1.3 → 0.1.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/Lens.d.ts +8 -8
- package/dist/Subscribable.d.ts +15 -1
- package/dist/Subscribable.js +12 -1
- package/dist/Subscribable.js.map +1 -1
- package/package.json +1 -1
package/dist/Lens.d.ts
CHANGED
|
@@ -106,8 +106,8 @@ export declare const mapStream: {
|
|
|
106
106
|
* Narrows the focus to a field of an object. Replaces the object in an immutable fashion when written to.
|
|
107
107
|
*/
|
|
108
108
|
export declare const focusObjectField: {
|
|
109
|
-
<A extends object,
|
|
110
|
-
<A extends object,
|
|
109
|
+
<A extends object, ER, EW, RR, RW, K extends keyof A>(self: Lens<A, ER, EW, RR, RW>, key: K): Lens<A[K], ER, EW, RR, RW>;
|
|
110
|
+
<A extends object, ER, EW, RR, RW, K extends keyof A>(key: K): (self: Lens<A, ER, EW, RR, RW>) => Lens<A[K], ER, EW, RR, RW>;
|
|
111
111
|
};
|
|
112
112
|
export declare namespace focusObjectMutableField {
|
|
113
113
|
type WritableKeys<T> = {
|
|
@@ -123,8 +123,8 @@ export declare namespace focusObjectMutableField {
|
|
|
123
123
|
* Narrows the focus to a mutable field of an object. Mutates the object in place when written to.
|
|
124
124
|
*/
|
|
125
125
|
export declare const focusObjectMutableField: {
|
|
126
|
-
<A extends object,
|
|
127
|
-
<A extends object,
|
|
126
|
+
<A extends object, ER, EW, RR, RW, K extends focusObjectMutableField.WritableKeys<A>>(self: Lens<A, ER, EW, RR, RW>, key: K): Lens<A[K], ER, EW, RR, RW>;
|
|
127
|
+
<A extends object, ER, EW, RR, RW, K extends focusObjectMutableField.WritableKeys<A>>(key: K): (self: Lens<A, ER, EW, RR, RW>) => Lens<A[K], ER, EW, RR, RW>;
|
|
128
128
|
};
|
|
129
129
|
/**
|
|
130
130
|
* Narrows the focus to an indexed element of an array. Replaces the array in an immutable fashion when written to.
|
|
@@ -144,15 +144,15 @@ export declare const focusMutableArrayAt: {
|
|
|
144
144
|
* Narrows the focus to an indexed element of a readonly tuple. Replaces the tuple in an immutable fashion when written to.
|
|
145
145
|
*/
|
|
146
146
|
export declare const focusTupleAt: {
|
|
147
|
-
<T extends readonly [any, ...any[]],
|
|
148
|
-
<T extends readonly [any, ...any[]],
|
|
147
|
+
<T extends readonly [any, ...any[]], ER, EW, RR, RW, I extends number>(self: Lens<T, ER, EW, RR, RW>, index: I): Lens<T[I], ER, EW, RR, RW>;
|
|
148
|
+
<T extends readonly [any, ...any[]], ER, EW, RR, RW, I extends number>(index: I): (self: Lens<T, ER, EW, RR, RW>) => Lens<T[I], ER, EW, RR, RW>;
|
|
149
149
|
};
|
|
150
150
|
/**
|
|
151
151
|
* Narrows the focus to an indexed element of a mutable tuple. Mutates the tuple in place when written to.
|
|
152
152
|
*/
|
|
153
153
|
export declare const focusMutableTupleAt: {
|
|
154
|
-
<T extends [any, ...any[]],
|
|
155
|
-
<T extends [any, ...any[]],
|
|
154
|
+
<T extends [any, ...any[]], ER, EW, RR, RW, I extends number>(self: Lens<T, ER, EW, RR, RW>, index: I): Lens<T[I], ER, EW, RR, RW>;
|
|
155
|
+
<T extends [any, ...any[]], ER, EW, RR, RW, I extends number>(index: I): (self: Lens<T, ER, EW, RR, RW>) => Lens<T[I], ER, EW, RR, RW>;
|
|
156
156
|
};
|
|
157
157
|
/**
|
|
158
158
|
* Narrows the focus to an indexed element of `Chunk`. Replaces the `Chunk` in an immutable fashion when written to.
|
package/dist/Subscribable.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { Chunk, Subscribable } from "effect";
|
|
1
|
+
import { Chunk, Effect, Option, Subscribable } from "effect";
|
|
2
2
|
import type { NoSuchElementException } from "effect/Cause";
|
|
3
3
|
export * from "effect/Subscribable";
|
|
4
|
+
/**
|
|
5
|
+
* Maps over an `Option` value in the `Subscribable`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const mapOption: {
|
|
8
|
+
<A, B, E, R>(self: Subscribable.Subscribable<Option.Option<A>, E, R>, f: (a: A) => B): Subscribable.Subscribable<Option.Option<B>, E, R>;
|
|
9
|
+
<A, B>(f: (a: A) => B): <E, R>(self: Subscribable.Subscribable<Option.Option<A>, E, R>) => Subscribable.Subscribable<Option.Option<B>, E, R>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Maps over an `Option` value in the `Subscribable` with an Effect.
|
|
13
|
+
*/
|
|
14
|
+
export declare const mapOptionEffect: {
|
|
15
|
+
<A, B, E, E2, R>(self: Subscribable.Subscribable<Option.Option<A>, E, R>, f: (a: A) => Effect.Effect<B, E2, R>): Subscribable.Subscribable<Option.Option<B>, E | E2, R>;
|
|
16
|
+
<A, B, E2>(f: (a: A) => Effect.Effect<B, E2>): <E, R>(self: Subscribable.Subscribable<Option.Option<A>, E, R>) => Subscribable.Subscribable<Option.Option<B>, E | E2, R>;
|
|
17
|
+
};
|
|
4
18
|
/**
|
|
5
19
|
* Narrows the focus to a field of an object.
|
|
6
20
|
*/
|
package/dist/Subscribable.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { Array, Chunk, Function, Subscribable } from "effect";
|
|
1
|
+
import { Array, Chunk, Effect, Function, Option, Subscribable } from "effect";
|
|
2
2
|
export * from "effect/Subscribable";
|
|
3
|
+
/**
|
|
4
|
+
* Maps over an `Option` value in the `Subscribable`.
|
|
5
|
+
*/
|
|
6
|
+
export const mapOption = Function.dual(2, (self, f) => Subscribable.map(self, Option.map(f)));
|
|
7
|
+
/**
|
|
8
|
+
* Maps over an `Option` value in the `Subscribable` with an Effect.
|
|
9
|
+
*/
|
|
10
|
+
export const mapOptionEffect = Function.dual(2, (self, f) => Subscribable.mapEffect(self, Option.match({
|
|
11
|
+
onSome: a => Effect.map(f(a), Option.some),
|
|
12
|
+
onNone: () => Effect.succeed(Option.none()),
|
|
13
|
+
})));
|
|
3
14
|
/**
|
|
4
15
|
* Narrows the focus to a field of an object.
|
|
5
16
|
*/
|
package/dist/Subscribable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscribable.js","sourceRoot":"","sources":["../src/Subscribable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"Subscribable.js","sourceRoot":"","sources":["../src/Subscribable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAI7E,cAAc,qBAAqB,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAQlB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CACjB,IAAuD,EACvD,CAAc,EACmC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE9F;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAQxB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CACjB,IAAuD,EACvD,CAAoC,EACkB,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;IACnG,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;IAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;CAC9C,CAAC,CAAC,CAAC,CAAA;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAQzB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CACjB,IAAwC,EACxC,GAAM,EAC+B,EAAE,CAAC,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