@nlozgachev/pipekit 0.3.0 → 0.4.1
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/esm/src/Core/Lens.js +98 -0
- package/esm/src/Core/Optional.js +164 -0
- package/esm/src/Core/These.js +122 -123
- package/esm/src/Core/index.js +2 -0
- package/package.json +1 -1
- package/script/src/Core/Lens.js +101 -0
- package/script/src/Core/Optional.js +167 -0
- package/script/src/Core/These.js +122 -123
- package/script/src/Core/index.js +2 -0
- package/types/src/Core/InternalTypes.d.ts +6 -0
- package/types/src/Core/InternalTypes.d.ts.map +1 -1
- package/types/src/Core/Lens.d.ts +118 -0
- package/types/src/Core/Lens.d.ts.map +1 -0
- package/types/src/Core/Optional.d.ts +158 -0
- package/types/src/Core/Optional.d.ts.map +1 -0
- package/types/src/Core/These.d.ts +108 -100
- package/types/src/Core/These.d.ts.map +1 -1
- package/types/src/Core/index.d.ts +2 -0
- package/types/src/Core/index.d.ts.map +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Optional } from "./Optional.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lens<S, A> focuses on a single value A inside a structure S, providing
|
|
4
|
+
* a composable way to read and immutably update nested data.
|
|
5
|
+
*
|
|
6
|
+
* A Lens always succeeds: the focused value is guaranteed to exist.
|
|
7
|
+
* For optional or indexed focuses, use Optional<S, A>.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* type Address = { city: string; zip: string };
|
|
12
|
+
* type User = { name: string; address: Address };
|
|
13
|
+
*
|
|
14
|
+
* const addressLens = Lens.prop<User>()("address");
|
|
15
|
+
* const cityLens = Lens.prop<Address>()("city");
|
|
16
|
+
* const userCityLens = pipe(addressLens, Lens.andThen(cityLens));
|
|
17
|
+
*
|
|
18
|
+
* pipe(user, Lens.get(userCityLens)); // "Berlin"
|
|
19
|
+
* pipe(user, Lens.set(userCityLens)("Hamburg")); // new User with city updated
|
|
20
|
+
* pipe(user, Lens.modify(userCityLens)(c => c.toUpperCase())); // "BERLIN"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type Lens<S, A> = {
|
|
24
|
+
readonly get: (s: S) => A;
|
|
25
|
+
readonly set: (a: A) => (s: S) => S;
|
|
26
|
+
};
|
|
27
|
+
export declare namespace Lens {
|
|
28
|
+
/**
|
|
29
|
+
* Constructs a Lens from a getter and a setter.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const nameLens = Lens.make(
|
|
34
|
+
* (user: User) => user.name,
|
|
35
|
+
* (name) => (user) => ({ ...user, name }),
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
const make: <S, A>(get: (s: S) => A, set: (a: A) => (s: S) => S) => Lens<S, A>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a Lens that focuses on a property of an object.
|
|
42
|
+
* Call with the structure type first, then the key.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const nameLens = Lens.prop<User>()("name");
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
const prop: <S>() => <K extends keyof S>(key: K) => Lens<S, S[K]>;
|
|
50
|
+
/**
|
|
51
|
+
* Reads the focused value from a structure.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* pipe(user, Lens.get(nameLens)); // "Alice"
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
const get: <S, A>(lens: Lens<S, A>) => (s: S) => A;
|
|
59
|
+
/**
|
|
60
|
+
* Replaces the focused value within a structure, returning a new structure.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* pipe(user, Lens.set(nameLens)("Bob")); // new User with name "Bob"
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
const set: <S, A>(lens: Lens<S, A>) => (a: A) => (s: S) => S;
|
|
68
|
+
/**
|
|
69
|
+
* Applies a function to the focused value, returning a new structure.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* pipe(user, Lens.modify(nameLens)(n => n.toUpperCase())); // "ALICE"
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
const modify: <S, A>(lens: Lens<S, A>) => (f: (a: A) => A) => (s: S) => S;
|
|
77
|
+
/**
|
|
78
|
+
* Composes two Lenses: focuses through the outer, then through the inner.
|
|
79
|
+
* Use in a pipe chain to build up a deep focus step by step.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const userCityLens = pipe(
|
|
84
|
+
* Lens.prop<User>()("address"),
|
|
85
|
+
* Lens.andThen(Lens.prop<Address>()("city")),
|
|
86
|
+
* );
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
const andThen: <A, B>(inner: Lens<A, B>) => <S>(outer: Lens<S, A>) => Lens<S, B>;
|
|
90
|
+
/**
|
|
91
|
+
* Composes a Lens with an Optional, producing an Optional.
|
|
92
|
+
* Use when the next step in the focus is optional (may be absent).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const userBioOpt = pipe(
|
|
97
|
+
* Lens.prop<User>()("profile"),
|
|
98
|
+
* Lens.andThenOptional(Optional.prop<Profile>()("bio")),
|
|
99
|
+
* );
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
const andThenOptional: <A, B>(inner: Optional<A, B>) => <S>(outer: Lens<S, A>) => Optional<S, B>;
|
|
103
|
+
/**
|
|
104
|
+
* Converts a Lens to an Optional. Every Lens is a valid Optional
|
|
105
|
+
* whose get always returns Some.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* pipe(
|
|
110
|
+
* Lens.prop<User>()("address"),
|
|
111
|
+
* Lens.toOptional,
|
|
112
|
+
* Optional.andThen(Optional.prop<Address>()("landmark")),
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
const toOptional: <S, A>(lens: Lens<S, A>) => Optional<S, A>;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=Lens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lens.d.ts","sourceRoot":"","sources":["../../../src/src/Core/Lens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI;IACvB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;CACrC,CAAC;AAEF,yBAAiB,IAAI,CAAC;IACpB;;;;;;;;;;OAUG;IACI,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,EACvB,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAChB,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KACzB,IAAI,CAAC,CAAC,EAAE,CAAC,CAAmB,CAAC;IAEhC;;;;;;;;OAQG;IACI,MAAM,IAAI,GAAI,CAAC,QACrB,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,CAAC,KAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAItC,CAAC;IAEJ;;;;;;;OAOG;IACI,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,KAAG,CAAgB,CAAC;IAExE;;;;;;;OAOG;IACI,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,KAAG,CAAmB,CAAC;IAErF;;;;;;;OAOG;IACI,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,KAAG,CACjD,CAAC;IAE9B;;;;;;;;;;;OAWG;IACI,MAAM,OAAO,GACjB,CAAC,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAI3D,CAAC;IAEN;;;;;;;;;;;OAWG;IACI,MAAM,eAAe,GACzB,CAAC,EAAE,CAAC,EAAE,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAGpE,CAAC;IAEL;;;;;;;;;;;;OAYG;IACI,MAAM,UAAU,GAAI,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAG/D,CAAC;CACJ"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Option } from "./Option.js";
|
|
2
|
+
import type { Lens } from "./Lens.js";
|
|
3
|
+
/** Keys of T for which undefined is assignable (i.e. optional fields). */
|
|
4
|
+
type OptionalKeys<T> = {
|
|
5
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
/**
|
|
8
|
+
* Optional<S, A> focuses on a value A inside a structure S that may or may
|
|
9
|
+
* not be present. Like a Lens, but get returns Option<A>.
|
|
10
|
+
*
|
|
11
|
+
* Compose with other Optionals via `andThen`, or with a Lens via `andThenLens`.
|
|
12
|
+
* Convert a Lens to an Optional with `Lens.toOptional`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* type Profile = { username: string; bio?: string };
|
|
17
|
+
*
|
|
18
|
+
* const bioOpt = Optional.prop<Profile>()("bio");
|
|
19
|
+
*
|
|
20
|
+
* pipe(profile, Optional.get(bioOpt)); // Some("hello") or None
|
|
21
|
+
* pipe(profile, Optional.set(bioOpt)("hello")); // new Profile with bio set
|
|
22
|
+
* pipe(profile, Optional.modify(bioOpt)(s => s + "!")); // appends if present
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export type Optional<S, A> = {
|
|
26
|
+
readonly get: (s: S) => Option<A>;
|
|
27
|
+
readonly set: (a: A) => (s: S) => S;
|
|
28
|
+
};
|
|
29
|
+
export declare namespace Optional {
|
|
30
|
+
/**
|
|
31
|
+
* Constructs an Optional from a getter (returning Option<A>) and a setter.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const firstChar = Optional.make(
|
|
36
|
+
* (s: string) => s.length > 0 ? Option.some(s[0]) : Option.none(),
|
|
37
|
+
* (c) => (s) => s.length > 0 ? c + s.slice(1) : s,
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
const make: <S, A>(get: (s: S) => Option<A>, set: (a: A) => (s: S) => S) => Optional<S, A>;
|
|
42
|
+
/**
|
|
43
|
+
* Creates an Optional that focuses on an optional property of an object.
|
|
44
|
+
* Only keys whose type includes undefined (i.e. `field?: T`) are accepted.
|
|
45
|
+
* Call with the structure type first, then the key.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* type Profile = { username: string; bio?: string };
|
|
50
|
+
* const bioOpt = Optional.prop<Profile>()("bio");
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
const prop: <S>() => <K extends OptionalKeys<S>>(key: K) => Optional<S, NonNullable<S[K]>>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates an Optional that focuses on an element at a given index in an array.
|
|
56
|
+
* Returns None when the index is out of bounds; set is a no-op when out of bounds.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const firstItem = Optional.index<string>(0);
|
|
61
|
+
*
|
|
62
|
+
* pipe(["a", "b"], Optional.get(firstItem)); // Some("a")
|
|
63
|
+
* pipe([], Optional.get(firstItem)); // None
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
const index: <A>(i: number) => Optional<A[], A>;
|
|
67
|
+
/**
|
|
68
|
+
* Reads the focused value from a structure, returning Option<A>.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* pipe(profile, Optional.get(bioOpt)); // Some("...") or None
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
const get: <S, A>(opt: Optional<S, A>) => (s: S) => Option<A>;
|
|
76
|
+
/**
|
|
77
|
+
* Replaces the focused value within a structure.
|
|
78
|
+
* For indexed focuses, this is a no-op when the index is out of bounds.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* pipe(profile, Optional.set(bioOpt)("hello"));
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
const set: <S, A>(opt: Optional<S, A>) => (a: A) => (s: S) => S;
|
|
86
|
+
/**
|
|
87
|
+
* Applies a function to the focused value if it is present; returns the
|
|
88
|
+
* structure unchanged if the focus is absent.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* pipe(profile, Optional.modify(bioOpt)(s => s.toUpperCase()));
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
const modify: <S, A>(opt: Optional<S, A>) => (f: (a: A) => A) => (s: S) => S;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the focused value or a default when the focus is absent.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* pipe(profile, Optional.getOrElse(bioOpt)("no bio"));
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
const getOrElse: <S, A>(opt: Optional<S, A>) => (defaultValue: A) => (s: S) => A;
|
|
105
|
+
/**
|
|
106
|
+
* Extracts a value from an Optional focus using handlers for the present
|
|
107
|
+
* and absent cases.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* pipe(profile, Optional.fold(bioOpt)(() => "no bio", (bio) => bio.toUpperCase()));
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
const fold: <S, A>(opt: Optional<S, A>) => <B>(onNone: () => B, onSome: (a: A) => B) => (s: S) => B;
|
|
115
|
+
/**
|
|
116
|
+
* Pattern matches on an Optional focus using a named-case object.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* pipe(
|
|
121
|
+
* profile,
|
|
122
|
+
* Optional.match(bioOpt)({ none: () => "no bio", some: (bio) => bio }),
|
|
123
|
+
* );
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
const match: <S, A>(opt: Optional<S, A>) => <B>(cases: {
|
|
127
|
+
none: () => B;
|
|
128
|
+
some: (a: A) => B;
|
|
129
|
+
}) => (s: S) => B;
|
|
130
|
+
/**
|
|
131
|
+
* Composes two Optionals: focuses through the outer, then through the inner.
|
|
132
|
+
* Returns None if either focus is absent.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const deepOpt = pipe(
|
|
137
|
+
* Optional.prop<User>()("address"),
|
|
138
|
+
* Optional.andThen(Optional.prop<Address>()("landmark")),
|
|
139
|
+
* );
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
const andThen: <A, B>(inner: Optional<A, B>) => <S>(outer: Optional<S, A>) => Optional<S, B>;
|
|
143
|
+
/**
|
|
144
|
+
* Composes an Optional with a Lens, producing an Optional.
|
|
145
|
+
* The Lens focuses within the value found by the Optional.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const cityOpt = pipe(
|
|
150
|
+
* Optional.prop<User>()("address"),
|
|
151
|
+
* Optional.andThenLens(Lens.prop<Address>()("city")),
|
|
152
|
+
* );
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
const andThenLens: <A, B>(inner: Lens<A, B>) => <S>(outer: Optional<S, A>) => Optional<S, B>;
|
|
156
|
+
}
|
|
157
|
+
export {};
|
|
158
|
+
//# sourceMappingURL=Optional.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Optional.d.ts","sourceRoot":"","sources":["../../../src/src/Core/Optional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,0EAA0E;AAC1E,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CACrD,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI;IAC3B,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,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econd } from "./InternalTypes.js";
|
|
3
2
|
/**
|
|
4
|
-
* These<
|
|
5
|
-
* value (
|
|
6
|
-
*
|
|
3
|
+
* These<A, B> is an inclusive-OR type: it holds a first value (A), a second
|
|
4
|
+
* value (B), or both simultaneously. Neither side carries a success/failure
|
|
5
|
+
* connotation — it is a neutral pair where any combination is valid.
|
|
7
6
|
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* - Both(
|
|
7
|
+
* - First(a) — only a first value
|
|
8
|
+
* - Second(b) — only a second value
|
|
9
|
+
* - Both(a, b) — first and second values simultaneously
|
|
10
|
+
*
|
|
11
|
+
* A common use: lenient parsers or processors that carry a diagnostic note
|
|
12
|
+
* alongside a result, without losing either piece of information.
|
|
11
13
|
*
|
|
12
14
|
* @example
|
|
13
15
|
* ```ts
|
|
14
|
-
* const parse = (s: string): These<
|
|
15
|
-
* const
|
|
16
|
-
*
|
|
17
|
-
* if (
|
|
18
|
-
* return These.
|
|
16
|
+
* const parse = (s: string): These<number, string> => {
|
|
17
|
+
* const trimmed = s.trim();
|
|
18
|
+
* const n = parseFloat(trimmed);
|
|
19
|
+
* if (isNaN(n)) return These.second("Not a number");
|
|
20
|
+
* if (s !== trimmed) return These.both(n, "Leading/trailing whitespace trimmed");
|
|
21
|
+
* return These.first(n);
|
|
19
22
|
* };
|
|
20
23
|
* ```
|
|
21
24
|
*/
|
|
22
|
-
export type These<
|
|
23
|
-
export type
|
|
25
|
+
export type These<A, B> = TheseFirst<A> | TheseSecond<B> | TheseBoth<A, B>;
|
|
26
|
+
export type TheseFirst<T> = WithKind<"First"> & WithFirst<T>;
|
|
27
|
+
export type TheseSecond<T> = WithKind<"Second"> & WithSecond<T>;
|
|
28
|
+
export type TheseBoth<First, Second> = WithKind<"Both"> & WithFirst<First> & WithSecond<Second>;
|
|
24
29
|
export declare namespace These {
|
|
25
30
|
/**
|
|
26
|
-
* Creates a These holding only a
|
|
31
|
+
* Creates a These holding only a first value.
|
|
27
32
|
*
|
|
28
33
|
* @example
|
|
29
34
|
* ```ts
|
|
30
|
-
* These.
|
|
35
|
+
* These.first(42); // { kind: "First", first: 42 }
|
|
31
36
|
* ```
|
|
32
37
|
*/
|
|
33
|
-
const
|
|
38
|
+
const first: <A>(value: A) => TheseFirst<A>;
|
|
34
39
|
/**
|
|
35
|
-
* Creates a These holding only
|
|
40
|
+
* Creates a These holding only a second value.
|
|
36
41
|
*
|
|
37
42
|
* @example
|
|
38
43
|
* ```ts
|
|
39
|
-
* These.
|
|
44
|
+
* These.second("warning"); // { kind: "Second", second: "warning" }
|
|
40
45
|
* ```
|
|
41
46
|
*/
|
|
42
|
-
const
|
|
47
|
+
const second: <B>(value: B) => TheseSecond<B>;
|
|
43
48
|
/**
|
|
44
|
-
* Creates a These holding both
|
|
49
|
+
* Creates a These holding both a first and a second value simultaneously.
|
|
45
50
|
*
|
|
46
51
|
* @example
|
|
47
52
|
* ```ts
|
|
48
|
-
* These.both("Deprecated API used",
|
|
53
|
+
* These.both(42, "Deprecated API used"); // { kind: "Both", first: 42, second: "Deprecated API used" }
|
|
49
54
|
* ```
|
|
50
55
|
*/
|
|
51
|
-
const both: <
|
|
56
|
+
const both: <A, B>(first: A, second: B) => TheseBoth<A, B>;
|
|
52
57
|
/**
|
|
53
|
-
* Type guard — checks if a These holds only
|
|
58
|
+
* Type guard — checks if a These holds only a first value.
|
|
54
59
|
*/
|
|
55
|
-
const
|
|
60
|
+
const isFirst: <A, B>(data: These<A, B>) => data is TheseFirst<A>;
|
|
56
61
|
/**
|
|
57
|
-
* Type guard — checks if a These holds only a
|
|
62
|
+
* Type guard — checks if a These holds only a second value.
|
|
58
63
|
*/
|
|
59
|
-
const
|
|
64
|
+
const isSecond: <A, B>(data: These<A, B>) => data is TheseSecond<B>;
|
|
60
65
|
/**
|
|
61
|
-
* Type guard — checks if a These holds both
|
|
66
|
+
* Type guard — checks if a These holds both values simultaneously.
|
|
62
67
|
*/
|
|
63
|
-
const isBoth: <
|
|
68
|
+
const isBoth: <A, B>(data: These<A, B>) => data is TheseBoth<A, B>;
|
|
64
69
|
/**
|
|
65
|
-
* Returns true if the These contains a
|
|
70
|
+
* Returns true if the These contains a first value (First or Both).
|
|
66
71
|
*/
|
|
67
|
-
const
|
|
72
|
+
const hasFirst: <A, B>(data: These<A, B>) => data is TheseFirst<A> | TheseBoth<A, B>;
|
|
68
73
|
/**
|
|
69
|
-
* Returns true if the These contains
|
|
74
|
+
* Returns true if the These contains a second value (Second or Both).
|
|
70
75
|
*/
|
|
71
|
-
const
|
|
76
|
+
const hasSecond: <A, B>(data: These<A, B>) => data is TheseSecond<B> | TheseBoth<A, B>;
|
|
72
77
|
/**
|
|
73
|
-
* Transforms the
|
|
78
|
+
* Transforms the first value, leaving the second unchanged.
|
|
74
79
|
*
|
|
75
80
|
* @example
|
|
76
81
|
* ```ts
|
|
77
|
-
* pipe(These.
|
|
78
|
-
* pipe(These.both("warn"
|
|
79
|
-
* pipe(These.
|
|
82
|
+
* pipe(These.first(5), These.mapFirst(n => n * 2)); // First(10)
|
|
83
|
+
* pipe(These.both(5, "warn"), These.mapFirst(n => n * 2)); // Both(10, "warn")
|
|
84
|
+
* pipe(These.second("warn"), These.mapFirst(n => n * 2)); // Second("warn")
|
|
80
85
|
* ```
|
|
81
86
|
*/
|
|
82
|
-
const
|
|
87
|
+
const mapFirst: <A, C>(f: (a: A) => C) => <B>(data: These<A, B>) => These<C, B>;
|
|
83
88
|
/**
|
|
84
|
-
* Transforms the
|
|
89
|
+
* Transforms the second value, leaving the first unchanged.
|
|
85
90
|
*
|
|
86
91
|
* @example
|
|
87
92
|
* ```ts
|
|
88
|
-
* pipe(These.
|
|
89
|
-
* pipe(These.both("warn"
|
|
93
|
+
* pipe(These.second("warn"), These.mapSecond(e => e.toUpperCase())); // Second("WARN")
|
|
94
|
+
* pipe(These.both(5, "warn"), These.mapSecond(e => e.toUpperCase())); // Both(5, "WARN")
|
|
90
95
|
* ```
|
|
91
96
|
*/
|
|
92
|
-
const
|
|
97
|
+
const mapSecond: <B, D>(f: (b: B) => D) => <A>(data: These<A, B>) => These<A, D>;
|
|
93
98
|
/**
|
|
94
|
-
* Transforms both the
|
|
99
|
+
* Transforms both the first and second values independently.
|
|
95
100
|
*
|
|
96
101
|
* @example
|
|
97
102
|
* ```ts
|
|
98
103
|
* pipe(
|
|
99
|
-
* These.both("warn"
|
|
100
|
-
* These.
|
|
101
|
-
* ); // Both("WARN"
|
|
104
|
+
* These.both(5, "warn"),
|
|
105
|
+
* These.mapBoth(n => n * 2, e => e.toUpperCase())
|
|
106
|
+
* ); // Both(10, "WARN")
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
const mapBoth: <A, C, B, D>(onFirst: (a: A) => C, onSecond: (b: B) => D) => (data: These<A, B>) => These<C, D>;
|
|
110
|
+
/**
|
|
111
|
+
* Chains These computations by passing the first value to f.
|
|
112
|
+
* Second propagates unchanged; First and Both apply f to the first value.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const double = (n: number): These<number, string> => These.first(n * 2);
|
|
117
|
+
*
|
|
118
|
+
* pipe(These.first(5), These.chainFirst(double)); // First(10)
|
|
119
|
+
* pipe(These.both(5, "warn"), These.chainFirst(double)); // First(10)
|
|
120
|
+
* pipe(These.second("warn"), These.chainFirst(double)); // Second("warn")
|
|
102
121
|
* ```
|
|
103
122
|
*/
|
|
104
|
-
const
|
|
123
|
+
const chainFirst: <A, B, C>(f: (a: A) => These<C, B>) => (data: These<A, B>) => These<C, B>;
|
|
105
124
|
/**
|
|
106
|
-
* Chains These computations by passing the
|
|
107
|
-
*
|
|
108
|
-
* - Ok(a) applies f(a) directly.
|
|
109
|
-
* - Both(e, a): applies f(a); if the result is Ok(b), returns Both(e, b)
|
|
110
|
-
* to preserve the warning. Otherwise returns f(a) as-is.
|
|
125
|
+
* Chains These computations by passing the second value to f.
|
|
126
|
+
* First propagates unchanged; Second and Both apply f to the second value.
|
|
111
127
|
*
|
|
112
128
|
* @example
|
|
113
129
|
* ```ts
|
|
114
|
-
* const
|
|
130
|
+
* const shout = (s: string): These<number, string> => These.second(s.toUpperCase());
|
|
115
131
|
*
|
|
116
|
-
* pipe(These.
|
|
117
|
-
* pipe(These.both("warn"
|
|
118
|
-
* pipe(These.
|
|
132
|
+
* pipe(These.second("warn"), These.chainSecond(shout)); // Second("WARN")
|
|
133
|
+
* pipe(These.both(5, "warn"), These.chainSecond(shout)); // Second("WARN")
|
|
134
|
+
* pipe(These.first(5), These.chainSecond(shout)); // First(5)
|
|
119
135
|
* ```
|
|
120
136
|
*/
|
|
121
|
-
const
|
|
137
|
+
const chainSecond: <A, B, D>(f: (b: B) => These<A, D>) => (data: These<A, B>) => These<A, D>;
|
|
122
138
|
/**
|
|
123
139
|
* Extracts a value from a These by providing handlers for all three cases.
|
|
124
140
|
*
|
|
@@ -127,14 +143,14 @@ export declare namespace These {
|
|
|
127
143
|
* pipe(
|
|
128
144
|
* these,
|
|
129
145
|
* These.fold(
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* (
|
|
146
|
+
* a => `First: ${a}`,
|
|
147
|
+
* b => `Second: ${b}`,
|
|
148
|
+
* (a, b) => `Both: ${a} / ${b}`
|
|
133
149
|
* )
|
|
134
150
|
* );
|
|
135
151
|
* ```
|
|
136
152
|
*/
|
|
137
|
-
const fold: <
|
|
153
|
+
const fold: <A, B, C>(onFirst: (a: A) => C, onSecond: (b: B) => C, onBoth: (a: A, b: B) => C) => (data: These<A, B>) => C;
|
|
138
154
|
/**
|
|
139
155
|
* Pattern matches on a These, returning the result of the matching case.
|
|
140
156
|
*
|
|
@@ -143,71 +159,63 @@ export declare namespace These {
|
|
|
143
159
|
* pipe(
|
|
144
160
|
* these,
|
|
145
161
|
* These.match({
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* both: (
|
|
162
|
+
* first: a => `First: ${a}`,
|
|
163
|
+
* second: b => `Second: ${b}`,
|
|
164
|
+
* both: (a, b) => `Both: ${a} / ${b}`
|
|
149
165
|
* })
|
|
150
166
|
* );
|
|
151
167
|
* ```
|
|
152
168
|
*/
|
|
153
|
-
const match: <
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
both: (
|
|
157
|
-
}) => (data: These<
|
|
169
|
+
const match: <A, B, C>(cases: {
|
|
170
|
+
first: (a: A) => C;
|
|
171
|
+
second: (b: B) => C;
|
|
172
|
+
both: (a: A, b: B) => C;
|
|
173
|
+
}) => (data: These<A, B>) => C;
|
|
158
174
|
/**
|
|
159
|
-
* Returns the
|
|
175
|
+
* Returns the first value, or a default if the These has no first value.
|
|
160
176
|
*
|
|
161
177
|
* @example
|
|
162
178
|
* ```ts
|
|
163
|
-
* pipe(These.
|
|
164
|
-
* pipe(These.both("warn"
|
|
165
|
-
* pipe(These.
|
|
179
|
+
* pipe(These.first(5), These.getFirstOrElse(0)); // 5
|
|
180
|
+
* pipe(These.both(5, "warn"), These.getFirstOrElse(0)); // 5
|
|
181
|
+
* pipe(These.second("warn"), These.getFirstOrElse(0)); // 0
|
|
166
182
|
* ```
|
|
167
183
|
*/
|
|
168
|
-
const
|
|
169
|
-
/**
|
|
170
|
-
* Executes a side effect on the success value without changing the These.
|
|
171
|
-
* Useful for logging or debugging.
|
|
172
|
-
*/
|
|
173
|
-
const tap: <A>(f: (a: A) => void) => <E>(data: These<E, A>) => These<E, A>;
|
|
184
|
+
const getFirstOrElse: <A>(defaultValue: A) => <B>(data: These<A, B>) => A;
|
|
174
185
|
/**
|
|
175
|
-
*
|
|
176
|
-
* - Err(e) → Ok(e)
|
|
177
|
-
* - Ok(a) → Err(a)
|
|
178
|
-
* - Both(e, a) → Both(a, e)
|
|
186
|
+
* Returns the second value, or a default if the These has no second value.
|
|
179
187
|
*
|
|
180
188
|
* @example
|
|
181
189
|
* ```ts
|
|
182
|
-
* These.
|
|
183
|
-
* These.
|
|
184
|
-
* These.
|
|
190
|
+
* pipe(These.second("warn"), These.getSecondOrElse("none")); // "warn"
|
|
191
|
+
* pipe(These.both(5, "warn"), These.getSecondOrElse("none")); // "warn"
|
|
192
|
+
* pipe(These.first(5), These.getSecondOrElse("none")); // "none"
|
|
185
193
|
* ```
|
|
186
194
|
*/
|
|
187
|
-
const
|
|
195
|
+
const getSecondOrElse: <B>(defaultValue: B) => <A>(data: These<A, B>) => B;
|
|
188
196
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
197
|
+
* Executes a side effect on the first value without changing the These.
|
|
198
|
+
* Useful for logging or debugging.
|
|
191
199
|
*
|
|
192
200
|
* @example
|
|
193
201
|
* ```ts
|
|
194
|
-
* These.
|
|
195
|
-
* These.toOption(These.both("warn", 42)); // Some(42)
|
|
196
|
-
* These.toOption(These.err("err")); // None
|
|
202
|
+
* pipe(These.first(5), These.tap(console.log)); // logs 5, returns First(5)
|
|
197
203
|
* ```
|
|
198
204
|
*/
|
|
199
|
-
const
|
|
205
|
+
const tap: <A>(f: (a: A) => void) => <B>(data: These<A, B>) => These<A, B>;
|
|
200
206
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
207
|
+
* Swaps the roles of first and second values.
|
|
208
|
+
* - First(a) → Second(a)
|
|
209
|
+
* - Second(b) → First(b)
|
|
210
|
+
* - Both(a, b) → Both(b, a)
|
|
203
211
|
*
|
|
204
212
|
* @example
|
|
205
213
|
* ```ts
|
|
206
|
-
* These.
|
|
207
|
-
* These.
|
|
208
|
-
* These.
|
|
214
|
+
* These.swap(These.first(5)); // Second(5)
|
|
215
|
+
* These.swap(These.second("warn")); // First("warn")
|
|
216
|
+
* These.swap(These.both(5, "warn")); // Both("warn", 5)
|
|
209
217
|
* ```
|
|
210
218
|
*/
|
|
211
|
-
const
|
|
219
|
+
const swap: <A, B>(data: These<A, B>) => These<B, A>;
|
|
212
220
|
}
|
|
213
221
|
//# sourceMappingURL=These.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"These.d.ts","sourceRoot":"","sources":["../../../src/src/Core/These.ts"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