@fncts/base 0.0.31 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. package/_cjs/collection/compat/Array/api.cjs +53 -0
  2. package/_cjs/collection/compat/Array/api.cjs.map +1 -1
  3. package/_cjs/collection/immutable/Conc/api.cjs +4 -1
  4. package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
  5. package/_cjs/collection/immutable/Dictionary/api.cjs +54 -8
  6. package/_cjs/collection/immutable/Dictionary/api.cjs.map +1 -1
  7. package/_cjs/collection/immutable/HashMap/api.cjs +7 -4
  8. package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
  9. package/_cjs/collection/immutable/HashSet/api.cjs +7 -4
  10. package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
  11. package/_cjs/collection/immutable/ImmutableArray/api.cjs +9 -6
  12. package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
  13. package/_cjs/collection/internal.cjs +6 -0
  14. package/_cjs/collection/internal.cjs.map +1 -0
  15. package/_cjs/collection/mutable/ArrayDeque.cjs +214 -0
  16. package/_cjs/collection/mutable/ArrayDeque.cjs.map +1 -0
  17. package/_cjs/collection/mutable/Queue.cjs +21 -0
  18. package/_cjs/collection/mutable/Queue.cjs.map +1 -0
  19. package/_cjs/control/InterruptiblePromise.cjs +23 -0
  20. package/_cjs/control/InterruptiblePromise.cjs.map +1 -0
  21. package/_cjs/control/Pure/api.cjs +20 -8
  22. package/_cjs/control/Pure/api.cjs.map +1 -1
  23. package/_cjs/data/Cause/api.cjs +8 -2
  24. package/_cjs/data/Cause/api.cjs.map +1 -1
  25. package/_cjs/data/Datum/api.cjs +8 -2
  26. package/_cjs/data/Datum/api.cjs.map +1 -1
  27. package/_cjs/data/DatumEither/api.cjs +8 -2
  28. package/_cjs/data/DatumEither/api.cjs.map +1 -1
  29. package/_cjs/data/Either/api.cjs +24 -6
  30. package/_cjs/data/Either/api.cjs.map +1 -1
  31. package/_cjs/data/Either/destructors.cjs +3 -3
  32. package/_cjs/data/Either/destructors.cjs.map +1 -1
  33. package/_cjs/data/Either/instances.cjs +10 -1
  34. package/_cjs/data/Either/instances.cjs.map +1 -1
  35. package/_cjs/data/EitherT/api.cjs +8 -2
  36. package/_cjs/data/EitherT/api.cjs.map +1 -1
  37. package/_cjs/data/Exit/constructors.cjs +4 -1
  38. package/_cjs/data/Exit/constructors.cjs.map +1 -1
  39. package/_cjs/data/Global.cjs +22 -0
  40. package/_cjs/data/Global.cjs.map +1 -0
  41. package/_cjs/data/Maybe/api.cjs +4 -1
  42. package/_cjs/data/Maybe/api.cjs.map +1 -1
  43. package/_cjs/optics/Fold/api/focus.cjs +17 -0
  44. package/_cjs/optics/Fold/api/focus.cjs.map +1 -0
  45. package/_cjs/optics/Fold/definition.cjs.map +1 -1
  46. package/_cjs/optics/Getter/definition.cjs.map +1 -1
  47. package/_cjs/optics/Index/api.cjs +16 -0
  48. package/_cjs/optics/Index/api.cjs.map +1 -1
  49. package/_cjs/optics/Iso/api.cjs +14 -0
  50. package/_cjs/optics/Iso/api.cjs.map +1 -1
  51. package/_cjs/optics/Iso/definition.cjs.map +1 -1
  52. package/_cjs/optics/Lens/api.cjs +50 -24
  53. package/_cjs/optics/Lens/api.cjs.map +1 -1
  54. package/_cjs/optics/Lens/definition.cjs +1 -1
  55. package/_cjs/optics/Lens/definition.cjs.map +1 -1
  56. package/_cjs/optics/Optional/api/focus.cjs +23 -0
  57. package/_cjs/optics/Optional/api/focus.cjs.map +1 -0
  58. package/_cjs/optics/Optional/api.cjs +16 -0
  59. package/_cjs/optics/Optional/api.cjs.map +1 -0
  60. package/_cjs/optics/Optional/definition.cjs +4 -1
  61. package/_cjs/optics/Optional/definition.cjs.map +1 -1
  62. package/_cjs/optics/Optional.cjs +22 -0
  63. package/_cjs/optics/Optional.cjs.map +1 -1
  64. package/_cjs/optics/Prism/api/focus.cjs +21 -0
  65. package/_cjs/optics/Prism/api/focus.cjs.map +1 -0
  66. package/_cjs/optics/Prism/definition.cjs +4 -1
  67. package/_cjs/optics/Prism/definition.cjs.map +1 -1
  68. package/_cjs/optics/Prism.cjs +11 -0
  69. package/_cjs/optics/Prism.cjs.map +1 -1
  70. package/_cjs/optics/Setter/api/focus.cjs +18 -0
  71. package/_cjs/optics/Setter/api/focus.cjs.map +1 -0
  72. package/_cjs/optics/Setter/definition.cjs.map +1 -1
  73. package/_cjs/optics/Traversal/api/focus.cjs +23 -0
  74. package/_cjs/optics/Traversal/api/focus.cjs.map +1 -0
  75. package/_cjs/optics/Traversal/definition.cjs.map +1 -1
  76. package/_cjs/optics/Traversal.cjs +11 -0
  77. package/_cjs/optics/Traversal.cjs.map +1 -1
  78. package/_cjs/typeclass/MonadExcept.cjs +4 -1
  79. package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
  80. package/_mjs/collection/compat/Array/api.mjs +48 -0
  81. package/_mjs/collection/compat/Array/api.mjs.map +1 -1
  82. package/_mjs/collection/immutable/Conc/api.mjs +4 -1
  83. package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
  84. package/_mjs/collection/immutable/Dictionary/api.mjs +47 -5
  85. package/_mjs/collection/immutable/Dictionary/api.mjs.map +1 -1
  86. package/_mjs/collection/immutable/HashMap/api.mjs +7 -4
  87. package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
  88. package/_mjs/collection/immutable/HashSet/api.mjs +7 -4
  89. package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
  90. package/_mjs/collection/immutable/ImmutableArray/api.mjs +9 -6
  91. package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
  92. package/_mjs/collection/internal.mjs +2 -0
  93. package/_mjs/collection/internal.mjs.map +1 -0
  94. package/_mjs/collection/mutable/ArrayDeque.mjs +205 -0
  95. package/_mjs/collection/mutable/ArrayDeque.mjs.map +1 -0
  96. package/_mjs/collection/mutable/Queue.mjs +14 -0
  97. package/_mjs/collection/mutable/Queue.mjs.map +1 -0
  98. package/_mjs/control/InterruptiblePromise.mjs +15 -0
  99. package/_mjs/control/InterruptiblePromise.mjs.map +1 -0
  100. package/_mjs/control/Pure/api.mjs +20 -8
  101. package/_mjs/control/Pure/api.mjs.map +1 -1
  102. package/_mjs/data/Cause/api.mjs +8 -2
  103. package/_mjs/data/Cause/api.mjs.map +1 -1
  104. package/_mjs/data/Datum/api.mjs +8 -2
  105. package/_mjs/data/Datum/api.mjs.map +1 -1
  106. package/_mjs/data/DatumEither/api.mjs +8 -2
  107. package/_mjs/data/DatumEither/api.mjs.map +1 -1
  108. package/_mjs/data/Either/api.mjs +24 -6
  109. package/_mjs/data/Either/api.mjs.map +1 -1
  110. package/_mjs/data/Either/destructors.mjs +3 -3
  111. package/_mjs/data/Either/destructors.mjs.map +1 -1
  112. package/_mjs/data/Either/instances.mjs +10 -1
  113. package/_mjs/data/Either/instances.mjs.map +1 -1
  114. package/_mjs/data/EitherT/api.mjs +8 -2
  115. package/_mjs/data/EitherT/api.mjs.map +1 -1
  116. package/_mjs/data/Exit/constructors.mjs +4 -1
  117. package/_mjs/data/Exit/constructors.mjs.map +1 -1
  118. package/_mjs/data/Global.mjs +15 -0
  119. package/_mjs/data/Global.mjs.map +1 -0
  120. package/_mjs/data/Maybe/api.mjs +4 -1
  121. package/_mjs/data/Maybe/api.mjs.map +1 -1
  122. package/_mjs/optics/Fold/api/focus.mjs +11 -0
  123. package/_mjs/optics/Fold/api/focus.mjs.map +1 -0
  124. package/_mjs/optics/Fold/definition.mjs.map +1 -1
  125. package/_mjs/optics/Getter/definition.mjs.map +1 -1
  126. package/_mjs/optics/Index/api.mjs +16 -0
  127. package/_mjs/optics/Index/api.mjs.map +1 -1
  128. package/_mjs/optics/Iso/api.mjs +13 -0
  129. package/_mjs/optics/Iso/api.mjs.map +1 -1
  130. package/_mjs/optics/Iso/definition.mjs.map +1 -1
  131. package/_mjs/optics/Lens/api.mjs +46 -22
  132. package/_mjs/optics/Lens/api.mjs.map +1 -1
  133. package/_mjs/optics/Lens/definition.mjs +1 -1
  134. package/_mjs/optics/Lens/definition.mjs.map +1 -1
  135. package/_mjs/optics/Optional/api/focus.mjs +15 -0
  136. package/_mjs/optics/Optional/api/focus.mjs.map +1 -0
  137. package/_mjs/optics/Optional/api.mjs +8 -0
  138. package/_mjs/optics/Optional/api.mjs.map +1 -0
  139. package/_mjs/optics/Optional/definition.mjs +4 -1
  140. package/_mjs/optics/Optional/definition.mjs.map +1 -1
  141. package/_mjs/optics/Optional.mjs +2 -0
  142. package/_mjs/optics/Optional.mjs.map +1 -1
  143. package/_mjs/optics/Prism/api/focus.mjs +13 -0
  144. package/_mjs/optics/Prism/api/focus.mjs.map +1 -0
  145. package/_mjs/optics/Prism/definition.mjs +4 -1
  146. package/_mjs/optics/Prism/definition.mjs.map +1 -1
  147. package/_mjs/optics/Prism.mjs +1 -0
  148. package/_mjs/optics/Prism.mjs.map +1 -1
  149. package/_mjs/optics/Setter/api/focus.mjs +12 -0
  150. package/_mjs/optics/Setter/api/focus.mjs.map +1 -0
  151. package/_mjs/optics/Setter/definition.mjs.map +1 -1
  152. package/_mjs/optics/Traversal/api/focus.mjs +15 -0
  153. package/_mjs/optics/Traversal/api/focus.mjs.map +1 -0
  154. package/_mjs/optics/Traversal/definition.mjs.map +1 -1
  155. package/_mjs/optics/Traversal.mjs +1 -0
  156. package/_mjs/optics/Traversal.mjs.map +1 -1
  157. package/_mjs/typeclass/MonadExcept.mjs +4 -1
  158. package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
  159. package/_src/collection/compat/Array/api.ts +51 -0
  160. package/_src/collection/immutable/Conc/api.ts +4 -4
  161. package/_src/collection/immutable/Dictionary/api.ts +40 -0
  162. package/_src/collection/immutable/HashMap/api.ts +4 -4
  163. package/_src/collection/immutable/HashSet/api.ts +4 -4
  164. package/_src/collection/immutable/ImmutableArray/api.ts +4 -4
  165. package/_src/collection/internal.ts +0 -0
  166. package/_src/collection/mutable/ArrayDeque.ts +231 -0
  167. package/_src/collection/mutable/Queue.ts +14 -0
  168. package/_src/collection/mutable.ts +2 -0
  169. package/_src/control/InterruptiblePromise.ts +23 -0
  170. package/_src/control/Pure/api.ts +7 -4
  171. package/_src/data/Cause/api.ts +8 -8
  172. package/_src/data/Datum/api.ts +8 -8
  173. package/_src/data/DatumEither/api.ts +8 -8
  174. package/_src/data/Either/api.ts +18 -18
  175. package/_src/data/Either/destructors.ts +3 -3
  176. package/_src/data/Either/instances.ts +12 -12
  177. package/_src/data/EitherT/api.ts +8 -8
  178. package/_src/data/Exit/constructors.ts +1 -1
  179. package/_src/data/Global.ts +17 -0
  180. package/_src/data/Maybe/api.ts +4 -4
  181. package/_src/data.ts +1 -0
  182. package/_src/optics/Fold/api/focus.ts +12 -0
  183. package/_src/optics/Fold/definition.ts +9 -0
  184. package/_src/optics/Getter/definition.ts +9 -1
  185. package/_src/optics/Index/api.ts +15 -1
  186. package/_src/optics/Iso/api.ts +16 -0
  187. package/_src/optics/Iso/definition.ts +6 -1
  188. package/_src/optics/Lens/api.ts +36 -8
  189. package/_src/optics/Lens/definition.ts +4 -1
  190. package/_src/optics/Optional/api/focus.ts +16 -0
  191. package/_src/optics/Optional/api.ts +10 -0
  192. package/_src/optics/Optional/definition.ts +23 -4
  193. package/_src/optics/Optional.ts +2 -0
  194. package/_src/optics/Prism/api/focus.ts +14 -0
  195. package/_src/optics/Prism/definition.ts +6 -2
  196. package/_src/optics/Prism.ts +1 -0
  197. package/_src/optics/Setter/api/focus.ts +13 -0
  198. package/_src/optics/Setter/definition.ts +13 -0
  199. package/_src/optics/Traversal/api/focus.ts +16 -0
  200. package/_src/optics/Traversal/definition.ts +10 -0
  201. package/_src/optics/Traversal.ts +1 -0
  202. package/_src/typeclass/MonadExcept.ts +1 -1
  203. package/collection/compat/Array/api.d.ts +19 -0
  204. package/collection/immutable/Dictionary/api.d.ts +21 -0
  205. package/collection/internal.d.ts +1 -0
  206. package/collection/mutable/ArrayDeque.d.ts +41 -0
  207. package/collection/mutable/Queue.d.ts +9 -0
  208. package/collection/mutable.d.ts +2 -0
  209. package/control/InterruptiblePromise.d.ts +12 -0
  210. package/data/Either/destructors.d.ts +4 -1
  211. package/data/Global.d.ts +4 -0
  212. package/data.d.ts +1 -0
  213. package/optics/Fold/api/focus.d.ts +6 -0
  214. package/optics/Fold/definition.d.ts +6 -0
  215. package/optics/Getter/definition.d.ts +7 -1
  216. package/optics/Index/api.d.ts +5 -0
  217. package/optics/Iso/api.d.ts +6 -0
  218. package/optics/Iso/definition.d.ts +4 -1
  219. package/optics/Lens/api.d.ts +11 -0
  220. package/optics/Lens/definition.d.ts +4 -1
  221. package/optics/Optional/api/focus.d.ts +6 -0
  222. package/optics/Optional/api.d.ts +6 -0
  223. package/optics/Optional/definition.d.ts +15 -0
  224. package/optics/Optional.d.ts +2 -0
  225. package/optics/Prism/api/focus.d.ts +6 -0
  226. package/optics/Prism/definition.d.ts +4 -1
  227. package/optics/Prism.d.ts +1 -0
  228. package/optics/Setter/api/focus.d.ts +6 -0
  229. package/optics/Setter/definition.d.ts +10 -0
  230. package/optics/Traversal/api/focus.d.ts +6 -0
  231. package/optics/Traversal/definition.d.ts +5 -0
  232. package/optics/Traversal.d.ts +1 -0
  233. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import { IndexOutOfBoundsError, NoSuchElementError } from "@fncts/base/data/exceptions";
2
+ import { Maybe, Nothing, Just } from "@fncts/base/data/Maybe/definition";
3
+ /**
4
+ * @tsplus type fncts.MutableArrayDeque
5
+ * @tsplus companion fncts.MutableArrayDeque
6
+ */
7
+ export declare class ArrayDeque<A> {
8
+ protected array: Array<A>;
9
+ private start;
10
+ private end;
11
+ constructor(array: Array<A>, start: number, end: number);
12
+ static empty<A>(initialSize?: number): ArrayDeque<A>;
13
+ protected requireBounds(idx: number, until?: number): void;
14
+ get(idx: number): A;
15
+ update(idx: number, elem: A): void;
16
+ addOne(elem: A): this;
17
+ prepend(elem: A): this;
18
+ insert(idx: number, elem: A): void;
19
+ remove(idx: number, count: number): void;
20
+ removeHead(resizeInternalRepr?: boolean): A;
21
+ removeHeadOption(resizeInternalRepr?: boolean): Maybe<A>;
22
+ removeLastOption(resizeInternalRepr?: boolean): Maybe<A>;
23
+ get isEmpty(): boolean;
24
+ private removeHeadAssumingNonEmpty;
25
+ private removeLastAssumingNonEmpty;
26
+ protected prependAssumingCapacity(elem: A): this;
27
+ protected appendAssumingCapacity(elem: A): this;
28
+ private ensureSize;
29
+ private resize;
30
+ private reset;
31
+ private mustGrow;
32
+ protected start_plus(idx: number): number;
33
+ private start_minus;
34
+ private end_plus;
35
+ private end_minus;
36
+ private _get;
37
+ private _set;
38
+ get length(): number;
39
+ copySliceToArray(srcStart: number, dest: Array<A>, destStart: number, maxItems: number): Array<A>;
40
+ private shouldShrink;
41
+ }
@@ -0,0 +1,9 @@
1
+ import { ArrayDeque } from "@fncts/base/collection/mutable/ArrayDeque";
2
+ /**
3
+ * @tsplus type fncts.MutableQueue
4
+ * @tsplus companion fncts.MutableQueue
5
+ */
6
+ export declare class Queue<A> extends ArrayDeque<A> {
7
+ enqueue(elem: A): this;
8
+ dequeue(): A;
9
+ }
@@ -1,4 +1,6 @@
1
+ export type {} from "./mutable/ArrayDeque.js";
1
2
  export type {} from "./mutable/HashMap.js";
2
3
  export type {} from "./mutable/HashSet.js";
3
4
  export type {} from "./mutable/internal.js";
4
5
  export type {} from "./mutable/ListBuffer.js";
6
+ export type {} from "./mutable/Queue.js";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @tsplus type fncts.InterruptiblePromise
3
+ * @tsplus companion fncts.InterruptiblePromiseOps
4
+ */
5
+ export interface InterruptiblePromise<A> extends Promise<A> {
6
+ interrupt: () => void;
7
+ }
8
+ /**
9
+ * @tsplus static fncts.InterruptiblePromiseOps __call
10
+ * @tsplus location "@fncts/base/control/InterruptiblePromise"
11
+ */
12
+ export declare function make<A>(executor: (resolve: (value: A | PromiseLike<A>) => void, reject: (reason?: unknown) => void) => (() => void) | void): InterruptiblePromise<A>;
@@ -3,4 +3,7 @@ import { Either } from "@fncts/base/data/Either/definition";
3
3
  * @tsplus pipeable fncts.Either match
4
4
  * @tsplus location "@fncts/base/data/Either/destructors"
5
5
  */
6
- export declare function match<E, A, B, C>(left: (e: E) => B, right: (a: A) => C): (self: Either<E, A>) => B | C;
6
+ export declare function match<E, A, B, C>(cases: {
7
+ Left: (e: E) => B;
8
+ Right: (a: A) => C;
9
+ }): (self: Either<E, A>) => B | C;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ export declare const globalValue: <A>(id: unknown, compute: () => A) => A;
package/data.d.ts CHANGED
@@ -21,6 +21,7 @@ export type {} from "./data/ExecutionStrategy.js";
21
21
  export type {} from "./data/Exit.js";
22
22
  export type {} from "./data/FiberId.js";
23
23
  export type {} from "./data/function.js";
24
+ export type {} from "./data/Global.js";
24
25
  export type {} from "./data/Guard.js";
25
26
  export type {} from "./data/Hash.js";
26
27
  export type {} from "./data/Hashable.js";
@@ -0,0 +1,6 @@
1
+ import type { Fold, FoldPartiallyApplied } from "@fncts/base/optics/Fold";
2
+ /**
3
+ * @tsplus pipeable global focus 4
4
+ * @tsplus location "@fncts/base/optics/Fold/api/focus"
5
+ */
6
+ export declare function focus<S, A>(fold: Fold<S, A>): (self: S) => FoldPartiallyApplied<A>;
@@ -2,12 +2,18 @@ import type { Monoid } from "@fncts/base/typeclass";
2
2
  export interface foldMap<S, A> {
3
3
  <M>(M: Monoid<M>): (f: (a: A) => M) => (s: S) => M;
4
4
  }
5
+ export interface foldMapPartiallyApplied<A> {
6
+ <M>(M: Monoid<M>): (f: (a: A) => M) => M;
7
+ }
5
8
  /**
6
9
  * @tsplus type fncts.optics.Fold
7
10
  */
8
11
  export interface Fold<S, A> {
9
12
  readonly foldMap: foldMap<S, A>;
10
13
  }
14
+ export interface FoldPartiallyApplied<A> {
15
+ readonly foldMap: foldMapPartiallyApplied<A>;
16
+ }
11
17
  /**
12
18
  * @tsplus type fncts.optics.FoldOps
13
19
  */
@@ -1,13 +1,19 @@
1
- import type { Fold } from "@fncts/base/optics/Fold";
1
+ import type { Fold, FoldPartiallyApplied } from "@fncts/base/optics/Fold";
2
2
  export interface get<S, A> {
3
3
  (s: S): A;
4
4
  }
5
+ export interface getPartiallyApplied<A> {
6
+ (): A;
7
+ }
5
8
  /**
6
9
  * @tsplus type fncts.optics.Getter
7
10
  */
8
11
  export interface Getter<S, A> extends Fold<S, A> {
9
12
  readonly get: get<S, A>;
10
13
  }
14
+ export interface GetterPartiallyApplied<A> extends FoldPartiallyApplied<A> {
15
+ readonly get: getPartiallyApplied<A>;
16
+ }
11
17
  /**
12
18
  * @tsplus type fncts.optics.GetterOps
13
19
  */
@@ -12,3 +12,8 @@ export declare function fromAt<T, J, B>(at: At<T, J, Maybe<B>>): Index<T, J, B>;
12
12
  * @tsplus location "@fncts/base/optics/Index/api"
13
13
  */
14
14
  export declare function fromIso<T, S>(iso: Iso<T, S>): <I, A>(index: Index<S, I, A>) => Index<T, I, A>;
15
+ /**
16
+ * @tsplus static fncts.optics.IndexOps array
17
+ * @tsplus location "@fncts/base/optics/Index/api"
18
+ */
19
+ export declare function array<A = never>(): Index<ReadonlyArray<A>, number, A>;
@@ -1,6 +1,12 @@
1
+ import type { PIsoPartiallyApplied } from "@fncts/base/optics/Iso/definition";
1
2
  import { PIso } from "@fncts/base/optics/Iso/definition";
2
3
  /**
3
4
  * @tsplus pipeable fncts.optics.PIso compose
4
5
  * @tsplus location "@fncts/base/optics/Iso/api"
5
6
  */
6
7
  export declare function compose<A, B, C, D>(that: PIso<A, B, C, D>): <S, T>(self: PIso<S, T, A, B>) => PIso<S, T, C, D>;
8
+ /**
9
+ * @tsplus pipeable global focus
10
+ * @tsplus location "@fncts/base/optics/Iso/api"
11
+ */
12
+ export declare function focus<S, T, A, B>(iso: PIso<S, T, A, B>): (self: S) => PIsoPartiallyApplied<T, A, B>;
@@ -1,5 +1,6 @@
1
1
  import type { get } from "@fncts/base/optics/Getter";
2
- import type { reverseGet } from "@fncts/base/optics/Prism";
2
+ import type { PLensPartiallyApplied } from "@fncts/base/optics/Lens";
3
+ import type { PPrismPartiallyApplied, reverseGet } from "@fncts/base/optics/Prism";
3
4
  import { PLens } from "@fncts/base/optics/Lens";
4
5
  import { PPrism } from "@fncts/base/optics/Prism";
5
6
  /**
@@ -8,6 +9,8 @@ import { PPrism } from "@fncts/base/optics/Prism";
8
9
  export interface PIso<S, T, A, B> extends PLens<S, T, A, B>, PPrism<S, T, A, B> {
9
10
  readonly reverse: () => PIso<B, A, T, S>;
10
11
  }
12
+ export interface PIsoPartiallyApplied<T, A, B> extends PLensPartiallyApplied<T, A, B>, PPrismPartiallyApplied<T, A, B> {
13
+ }
11
14
  /**
12
15
  * @tsplus type fncts.optics.PIsoOps
13
16
  */
@@ -1,7 +1,13 @@
1
1
  import { ReadonlyNonEmptyArray } from "@fncts/base/collection/immutable/ImmutableNonEmptyArray/definition";
2
+ import type { PLensPartiallyApplied } from "@fncts/base/optics/Lens/definition";
2
3
  import type { Optional } from "@fncts/base/optics/Optional";
3
4
  import type { AutoPath, Path } from "@fncts/typelevel/Object";
4
5
  import { Lens, PLens } from "@fncts/base/optics/Lens/definition";
6
+ /**
7
+ * @tsplus pipeable global focus
8
+ * @tsplus location "@fncts/base/optics/Lens/api"
9
+ */
10
+ export declare function focus<S, T, A, B>(lens: PLens<S, T, A, B>): (self: S) => PLensPartiallyApplied<T, A, B>;
5
11
  /**
6
12
  * @tsplus pipeable fncts.optics.PLens component
7
13
  * @tsplus location "@fncts/base/optics/Lens/api"
@@ -47,3 +53,8 @@ export declare function prop<A extends Record<string, any>, P extends keyof A>(p
47
53
  * @tsplus location "@fncts/base/optics/Lens/api"
48
54
  */
49
55
  export declare function path<A extends Record<string, unknown>, P extends Array<string>>(path: readonly [...AutoPath<A, P>]): <S>(self: Lens<S, A>) => Lens<S, Path<A, P>>;
56
+ /**
57
+ * @tsplus static fncts.optics.LensOps fromPath
58
+ * @tsplus location "@fncts/base/optics/Lens/api"
59
+ */
60
+ export declare function fromPath<S, P extends Array<string>>(path: readonly [...AutoPath<S, P>]): Lens<S, Path<S, P>>;
@@ -1,4 +1,5 @@
1
- import type { get } from "@fncts/base/optics/Getter";
1
+ import type { get, GetterPartiallyApplied } from "@fncts/base/optics/Getter";
2
+ import type { POptionalPartiallyApplied } from "@fncts/base/optics/Optional";
2
3
  import type { set } from "@fncts/base/optics/Setter";
3
4
  import { Getter } from "@fncts/base/optics/Getter";
4
5
  import { POptional } from "@fncts/base/optics/Optional";
@@ -7,6 +8,8 @@ import { POptional } from "@fncts/base/optics/Optional";
7
8
  */
8
9
  export interface PLens<S, T, A, B> extends POptional<S, T, A, B>, Getter<S, A> {
9
10
  }
11
+ export interface PLensPartiallyApplied<T, A, B> extends POptionalPartiallyApplied<T, A, B>, GetterPartiallyApplied<A> {
12
+ }
10
13
  /**
11
14
  * @tsplus type fncts.optics.PLensOps
12
15
  */
@@ -0,0 +1,6 @@
1
+ import type { POptional, POptionalPartiallyApplied } from "@fncts/base/optics/Optional";
2
+ /**
3
+ * @tsplus pipeable global focus 1
4
+ * @tsplus location "@fncts/base/optics/Optional/api/focus"
5
+ */
6
+ export declare function focus<S, T, A, B>(optional: POptional<S, T, A, B>): (self: S) => POptionalPartiallyApplied<T, A, B>;
@@ -0,0 +1,6 @@
1
+ import type { Optional } from "@fncts/base/optics/Optional/definition";
2
+ /**
3
+ * @tsplus static fncts.optics.OptionalOps index
4
+ * @tsplus location "@fncts/base/optics/Optional/api"
5
+ */
6
+ export declare function index<A>(index: number): Optional<ReadonlyArray<A>, A>;
@@ -1,6 +1,7 @@
1
1
  import { Maybe } from "@fncts/base/data/Maybe/definition";
2
2
  import { Either } from "@fncts/base/data/Either/definition";
3
3
  import type { set } from "@fncts/base/optics/Setter";
4
+ import type { PTraversalPartiallyApplied } from "@fncts/base/optics/Traversal";
4
5
  import { PTraversal } from "@fncts/base/optics/Traversal";
5
6
  /**
6
7
  * @tsplus type fncts.optics.POptional
@@ -10,6 +11,11 @@ export interface POptional<S, T, A, B> extends PTraversal<S, T, A, B> {
10
11
  readonly getOrModify: getOrModify<S, T, A>;
11
12
  readonly modifyMaybe: modifyMaybe<S, T, A, B>;
12
13
  }
14
+ export interface POptionalPartiallyApplied<T, A, B> extends PTraversalPartiallyApplied<T, A, B> {
15
+ readonly getMaybe: getMaybePartiallyApplied<A>;
16
+ readonly getOrModify: getOrModifyPartiallyApplied<T, A>;
17
+ readonly modifyMaybe: modifyMaybePartiallyApplied<T, A, B>;
18
+ }
13
19
  export interface POptionalMin<S, T, A, B> {
14
20
  readonly getOrModify: getOrModify<S, T, A>;
15
21
  readonly set: set<S, T, B>;
@@ -56,3 +62,12 @@ export interface replaceMaybe_<S, T, B> {
56
62
  export interface replaceMaybe<S, T, B> {
57
63
  (b: B): (s: S) => Maybe<T>;
58
64
  }
65
+ export interface getMaybePartiallyApplied<A> {
66
+ (): Maybe<A>;
67
+ }
68
+ export interface getOrModifyPartiallyApplied<T, A> {
69
+ (): Either<T, A>;
70
+ }
71
+ export interface modifyMaybePartiallyApplied<T, A, B> {
72
+ (f: (a: A) => B): Maybe<T>;
73
+ }
@@ -1,2 +1,4 @@
1
+ export * from "./Optional/api.js";
1
2
  export * from "./Optional/definition.js";
2
3
  export * from "./Optional/api/compose.js";
4
+ export * from "./Optional/api/focus.js";
@@ -0,0 +1,6 @@
1
+ import type { PPrism, PPrismPartiallyApplied } from "@fncts/base/optics/Prism";
2
+ /**
3
+ * @tsplus pipeable global focus
4
+ * @tsplus location "@fncts/base/optics/Prism/api/focus"
5
+ */
6
+ export declare function focus<S, T, A, B>(prism: PPrism<S, T, A, B>): (self: S) => PPrismPartiallyApplied<T, A, B>;
@@ -1,4 +1,4 @@
1
- import type { getOrModify } from "@fncts/base/optics/Optional";
1
+ import type { getOrModify, POptionalPartiallyApplied } from "@fncts/base/optics/Optional";
2
2
  import { POptional } from "@fncts/base/optics/Optional";
3
3
  /**
4
4
  * @tsplus type fncts.optics.PPrism
@@ -6,6 +6,9 @@ import { POptional } from "@fncts/base/optics/Optional";
6
6
  export interface PPrism<S, T, A, B> extends POptional<S, T, A, B> {
7
7
  readonly reverseGet: reverseGet<T, B>;
8
8
  }
9
+ export interface PPrismPartiallyApplied<T, A, B> extends POptionalPartiallyApplied<T, A, B> {
10
+ readonly reverseGet: reverseGet<T, B>;
11
+ }
9
12
  /**
10
13
  * @tsplus type fncts.optics.PPrismOps
11
14
  */
package/optics/Prism.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./Prism/definition.js";
2
2
  export * from "./Prism/api/compose.js";
3
+ export * from "./Prism/api/focus.js";
3
4
  export * from "./Prism/api/fromNullable.js";
4
5
  export * from "./Prism/api/just.js";
@@ -0,0 +1,6 @@
1
+ import type { PSetter, PSetterPartiallyApplied } from "@fncts/base/optics/Setter";
2
+ /**
3
+ * @tsplus pipeable global focus 3
4
+ * @tsplus location "@fncts/base/optics/Setter/api/focus"
5
+ */
6
+ export declare function focus<S, T, A, B>(setter: PSetter<S, T, A, B>): (self: S) => PSetterPartiallyApplied<T, A, B>;
@@ -5,6 +5,10 @@ export interface PSetter<S, T, A, B> {
5
5
  readonly modify: modify<S, T, A, B>;
6
6
  readonly set: set<S, T, B>;
7
7
  }
8
+ export interface PSetterPartiallyApplied<T, A, B> {
9
+ readonly modify: modifyPartiallyApplied<T, A, B>;
10
+ readonly set: setPartiallyApplied<T, B>;
11
+ }
8
12
  /**
9
13
  * @tsplus type fncts.optics.PSetterOps
10
14
  */
@@ -37,3 +41,9 @@ export interface modify<S, T, A, B> {
37
41
  export interface set<S, T, B> {
38
42
  (b: B): (s: S) => T;
39
43
  }
44
+ export interface modifyPartiallyApplied<T, A, B> {
45
+ (f: (a: A) => B): T;
46
+ }
47
+ export interface setPartiallyApplied<T, B> {
48
+ (b: B): T;
49
+ }
@@ -0,0 +1,6 @@
1
+ import type { PTraversal, PTraversalPartiallyApplied } from "@fncts/base/optics/Traversal";
2
+ /**
3
+ * @tsplus pipeable global focus 2
4
+ * @tsplus location "@fncts/base/optics/Traversal/api/focus"
5
+ */
6
+ export declare function focus<S, T, A, B>(traversal: PTraversal<S, T, A, B>): (self: S) => PTraversalPartiallyApplied<T, A, B>;
@@ -1,4 +1,6 @@
1
1
  import { HKT } from "@fncts/typelevel/HKT";
2
+ import type { FoldPartiallyApplied } from "@fncts/base/optics/Fold";
3
+ import type { PSetterPartiallyApplied } from "@fncts/base/optics/Setter";
2
4
  import type { Applicative } from "@fncts/base/typeclass";
3
5
  import { Fold } from "@fncts/base/optics/Fold";
4
6
  import { PSetter } from "@fncts/base/optics/Setter";
@@ -8,6 +10,9 @@ import { PSetter } from "@fncts/base/optics/Setter";
8
10
  export interface PTraversal<S, T, A, B> extends PSetter<S, T, A, B>, Fold<S, A> {
9
11
  modifyA: <F extends HKT, FC = HKT.None>(F: Applicative<F, FC>) => <K, Q, W, X, I, _S, R, E>(f: (a: A) => HKT.Kind<F, FC, K, Q, W, X, I, _S, R, E, B>) => (s: S) => HKT.Kind<F, FC, K, Q, W, X, I, _S, R, E, T>;
10
12
  }
13
+ export interface PTraversalPartiallyApplied<T, A, B> extends PSetterPartiallyApplied<T, A, B>, FoldPartiallyApplied<A> {
14
+ modifyA: <F extends HKT, FC = HKT.None>(F: Applicative<F, FC>) => <K, Q, W, X, I, _S, R, E>(f: (a: A) => HKT.Kind<F, FC, K, Q, W, X, I, _S, R, E, B>) => HKT.Kind<F, FC, K, Q, W, X, I, _S, R, E, T>;
15
+ }
11
16
  export interface PTraversalMin<S, T, A, B> {
12
17
  modifyA: <F extends HKT, FC = HKT.None>(F: Applicative<F, FC>) => <K, Q, W, X, I, _S, R, E>(f: (a: A) => HKT.Kind<F, FC, K, Q, W, X, I, _S, R, E, B>) => (s: S) => HKT.Kind<F, FC, K, Q, W, X, I, _S, R, E, T>;
13
18
  }
@@ -1,3 +1,4 @@
1
1
  export * from "./Traversal/definition.js";
2
2
  export * from "./Traversal/api/compose.js";
3
+ export * from "./Traversal/api/focus.js";
3
4
  export * from "./Traversal/api/fromTraversable.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fncts/base",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "dependencies": {
5
5
  "@fncts/typelevel": "0.0.15",
6
6
  "uuid": "^9.0.0"