@fncts/base 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/_cjs/collection/immutable/HashSet/api.cjs +18 -7
  2. package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
  3. package/_cjs/collection/immutable/HashSet/definition.cjs +2 -2
  4. package/_cjs/collection/immutable/HashSet/definition.cjs.map +1 -1
  5. package/_cjs/control/Eval/api.cjs +4 -1
  6. package/_cjs/control/Eval/api.cjs.map +1 -1
  7. package/_cjs/control/Eval/constructors.cjs +9 -2
  8. package/_cjs/control/Eval/constructors.cjs.map +1 -1
  9. package/_cjs/control/Eval/definition.cjs +10 -28
  10. package/_cjs/control/Eval/definition.cjs.map +1 -1
  11. package/_cjs/control/Eval/run.cjs +7 -7
  12. package/_cjs/control/Eval/run.cjs.map +1 -1
  13. package/_cjs/control/{Z → Pure}/api.cjs +146 -115
  14. package/_cjs/control/Pure/api.cjs.map +1 -0
  15. package/_cjs/control/Pure/definition.cjs +78 -0
  16. package/_cjs/control/Pure/definition.cjs.map +1 -0
  17. package/_cjs/control/{Z → Pure}/instances.cjs +1 -1
  18. package/_cjs/control/Pure/instances.cjs.map +1 -0
  19. package/_cjs/control/{Z → Pure}/runtime.cjs +67 -66
  20. package/_cjs/control/Pure/runtime.cjs.map +1 -0
  21. package/_cjs/control/{Z.cjs → Pure.cjs} +5 -5
  22. package/_cjs/control/Pure.cjs.map +1 -0
  23. package/_cjs/data/Showable/show.cjs +31 -31
  24. package/_cjs/data/Showable/show.cjs.map +1 -1
  25. package/_mjs/collection/immutable/HashSet/api.mjs +17 -7
  26. package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
  27. package/_mjs/collection/immutable/HashSet/definition.mjs +2 -2
  28. package/_mjs/collection/immutable/HashSet/definition.mjs.map +1 -1
  29. package/_mjs/control/Eval/api.mjs +5 -2
  30. package/_mjs/control/Eval/api.mjs.map +1 -1
  31. package/_mjs/control/Eval/constructors.mjs +10 -3
  32. package/_mjs/control/Eval/constructors.mjs.map +1 -1
  33. package/_mjs/control/Eval/definition.mjs +7 -25
  34. package/_mjs/control/Eval/definition.mjs.map +1 -1
  35. package/_mjs/control/Eval/run.mjs +7 -7
  36. package/_mjs/control/Eval/run.mjs.map +1 -1
  37. package/_mjs/control/{Z → Pure}/api.mjs +134 -104
  38. package/_mjs/control/Pure/api.mjs.map +1 -0
  39. package/_mjs/control/Pure/definition.mjs +60 -0
  40. package/_mjs/control/Pure/definition.mjs.map +1 -0
  41. package/_mjs/control/{Z → Pure}/instances.mjs +1 -1
  42. package/_mjs/control/Pure/instances.mjs.map +1 -0
  43. package/_mjs/control/{Z → Pure}/runtime.mjs +68 -67
  44. package/_mjs/control/Pure/runtime.mjs.map +1 -0
  45. package/_mjs/control/Pure.mjs +6 -0
  46. package/_mjs/control/Pure.mjs.map +1 -0
  47. package/_mjs/data/Showable/show.mjs +31 -31
  48. package/_mjs/data/Showable/show.mjs.map +1 -1
  49. package/_src/collection/immutable/HashSet/api.ts +12 -1
  50. package/_src/collection/immutable/HashSet/definition.ts +2 -2
  51. package/_src/control/Eval/api.ts +5 -2
  52. package/_src/control/Eval/constructors.ts +10 -3
  53. package/_src/control/Eval/definition.ts +39 -27
  54. package/_src/control/Eval/run.ts +7 -7
  55. package/_src/control/Pure/api.ts +629 -0
  56. package/_src/control/Pure/definition.ts +222 -0
  57. package/_src/control/{Z → Pure}/instances.ts +3 -3
  58. package/_src/control/{Z → Pure}/runtime.ts +73 -76
  59. package/_src/control/Pure.ts +6 -0
  60. package/_src/control.ts +1 -1
  61. package/_src/data/Showable/show.ts +55 -53
  62. package/_src/global.ts +1 -1
  63. package/collection/immutable/HashSet/api.d.ts +5 -0
  64. package/collection/immutable/HashSet/definition.d.ts +1 -1
  65. package/control/Eval/constructors.d.ts +4 -0
  66. package/control/Eval/definition.d.ts +25 -28
  67. package/control/Pure/api.d.ts +345 -0
  68. package/control/Pure/definition.d.ts +156 -0
  69. package/control/Pure/instances.d.ts +8 -0
  70. package/control/Pure/runtime.d.ts +56 -0
  71. package/control/Pure.d.ts +4 -0
  72. package/control.d.ts +1 -1
  73. package/data/Showable/show.d.ts +2 -2
  74. package/global.d.ts +1 -1
  75. package/package.json +1 -1
  76. package/_cjs/control/Z/api.cjs.map +0 -1
  77. package/_cjs/control/Z/definition.cjs +0 -163
  78. package/_cjs/control/Z/definition.cjs.map +0 -1
  79. package/_cjs/control/Z/instances.cjs.map +0 -1
  80. package/_cjs/control/Z/runtime.cjs.map +0 -1
  81. package/_cjs/control/Z.cjs.map +0 -1
  82. package/_mjs/control/Z/api.mjs.map +0 -1
  83. package/_mjs/control/Z/definition.mjs +0 -145
  84. package/_mjs/control/Z/definition.mjs.map +0 -1
  85. package/_mjs/control/Z/instances.mjs.map +0 -1
  86. package/_mjs/control/Z/runtime.mjs.map +0 -1
  87. package/_mjs/control/Z.mjs +0 -6
  88. package/_mjs/control/Z.mjs.map +0 -1
  89. package/_src/control/Z/api.ts +0 -590
  90. package/_src/control/Z/definition.ts +0 -199
  91. package/_src/control/Z.ts +0 -6
  92. package/control/Z/api.d.ts +0 -345
  93. package/control/Z/definition.d.ts +0 -151
  94. package/control/Z/instances.d.ts +0 -8
  95. package/control/Z/runtime.d.ts +0 -56
  96. package/control/Z.d.ts +0 -4
@@ -0,0 +1,345 @@
1
+ import { Pure } from "@fncts/base/control/Pure/definition";
2
+ import { Either } from "@fncts/base/data/Either/definition";
3
+ import { Maybe } from "@fncts/base/data/Maybe/definition";
4
+ import { Environment } from "@fncts/base/data/Environment/definition";
5
+ import { Lazy } from "@fncts/base/data/function/definition";
6
+ import { Cause } from "@fncts/base/data/Cause/definition";
7
+ import { Conc } from "@fncts/base/collection/immutable/Conc";
8
+ import { Predicate } from "@fncts/base/data/Predicate/definition";
9
+ import { Zipped } from "@fncts/base/data/Zipped";
10
+ /**
11
+ * @tsplus getter fncts.control.Pure absolve
12
+ * @tsplus location "@fncts/base/control/Pure/api"
13
+ */
14
+ export declare function absolve<W, S1, S2, R, E, E1, A>(fa: Pure<W, S1, S2, R, E, Either<E1, A>>): Pure<W, S1, S2, R, E | E1, A>;
15
+ /**
16
+ * @tsplus pipeable fncts.control.Pure ap
17
+ * @tsplus location "@fncts/base/control/Pure/api"
18
+ */
19
+ export declare function ap<W, S, A, R1, E1>(fb: Pure<W, S, S, R1, E1, A>): <R, E, B>(self: import("@fncts/base/control/Pure/definition").Pure<W, S, S, R, E, (a: A) => B>) => import("@fncts/base/control/Pure/definition").Pure<W, S, S, R & R1, E1 | E, B>;
20
+ /**
21
+ * @tsplus pipeable fncts.control.Pure zipLeft
22
+ * @tsplus location "@fncts/base/control/Pure/api"
23
+ */
24
+ export declare function zipLeft<W, S, R1, E1, B>(fb: Pure<W, S, S, R1, E1, B>): <R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S, S, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S, S, R & R1, E1 | E, A>;
25
+ /**
26
+ * @tsplus pipeable fncts.control.Pure zipRight
27
+ * @tsplus location "@fncts/base/control/Pure/api"
28
+ */
29
+ export declare function zipRight<W, S, R1, E1, B>(fb: Pure<W, S, S, R1, E1, B>): <R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S, S, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S, S, R & R1, E1 | E, B>;
30
+ /**
31
+ * @tsplus pipeable fncts.control.Pure bimap
32
+ * @tsplus location "@fncts/base/control/Pure/api"
33
+ */
34
+ export declare function bimap<E, A, G, B>(f: (e: E) => G, g: (a: A) => B): <W, S1, S2, R>(pab: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, G, B>;
35
+ /**
36
+ * Recovers from all errors.
37
+ * @tsplus pipeable fncts.control.Pure catchAll
38
+ * @tsplus location "@fncts/base/control/Pure/api"
39
+ */
40
+ export declare function catchAll<W, S1, E, S3, R1, E1, B>(onFailure: (e: E) => Pure<W, S1, S3, R1, E1, B>): <S2, R, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S3, R1 | R, E1, B | A>;
41
+ /**
42
+ * @tsplus pipeable fncts.control.Pure catchJust
43
+ * @tsplus location "@fncts/base/control/Pure/api"
44
+ */
45
+ export declare function catchJust<W, S1, E, S3, R1, E1, B>(f: (e: E) => Maybe<Pure<W, S1, S3, R1, E1, B>>): <S2, R, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S3 | S2, R1 | R, E | E1, B | A>;
46
+ /**
47
+ * @tsplus pipeable fncts.control.Pure flatMap
48
+ * @tsplus location "@fncts/base/control/Pure/api"
49
+ */
50
+ export declare function flatMap<S2, A, W1, S3, R1, E1, B>(f: (a: A) => Pure<W1, S2, S3, R1, E1, B>): <W, S1, R, E>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3, R1 & R, E1 | E, B>;
51
+ /**
52
+ * @tsplus pipeable fncts.control.Pure contramapEnvironment
53
+ * @tsplus location "@fncts/base/control/Pure/api"
54
+ */
55
+ export declare function contramapEnvironment<R0, R>(f: (r0: Environment<R0>) => Environment<R>): <W, S1, S2, E, A>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R0, E, A>;
56
+ /**
57
+ * Transforms the initial state of this computation` with the specified
58
+ * function.
59
+ * @tsplus pipeable fncts.control.Pure contramapState
60
+ * @tsplus location "@fncts/base/control/Pure/api"
61
+ */
62
+ export declare function contramapState<S0, S1>(f: (s: S0) => S1): <W, S2, R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S0, S2, R, E, A>;
63
+ /**
64
+ * @tsplus pipeable fncts.control.Pure cross
65
+ * @tsplus location "@fncts/base/control/Pure/api"
66
+ */
67
+ export declare function cross<W, S, R1, E1, B>(fb: Pure<W, S, S, R1, E1, B>): <R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S, S, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S, S, R & R1, E1 | E, readonly [A, B]>;
68
+ /**
69
+ * @tsplus pipeable fncts.control.Pure crossWith
70
+ * @tsplus location "@fncts/base/control/Pure/api"
71
+ */
72
+ export declare function crossWith<W, S, A, R1, E1, B, C>(fb: Pure<W, S, S, R1, E1, B>, f: (a: A, b: B) => C): <R, E>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S, S, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S, S, R & R1, E1 | E, C>;
73
+ /**
74
+ * @tsplus static fncts.control.PureOps defer
75
+ * @tsplus location "@fncts/base/control/Pure/api"
76
+ */
77
+ export declare function defer<W, S1, S2, R, E, A>(ma: Lazy<Pure<W, S1, S2, R, E, A>>, __tsplusTrace?: string): Pure<W, S1, S2, R, E, A>;
78
+ /**
79
+ * Returns a computation whose failure and success have been lifted into an
80
+ * `Either`. The resulting computation cannot fail, because the failure case
81
+ * has been exposed as part of the `Either` success case.
82
+ * @tsplus getter fncts.control.Pure either
83
+ * @tsplus location "@fncts/base/control/Pure/api"
84
+ */
85
+ export declare function either<W, S1, S2, R, E, A>(fa: Pure<W, S1, S2, R, E, A>): Pure<W, S1, S1 | S2, R, never, Either<E, A>>;
86
+ /**
87
+ * @tsplus static fncts.control.PureOps environment
88
+ * @tsplus location "@fncts/base/control/Pure/api"
89
+ */
90
+ export declare function environment<R>(): Pure<never, unknown, never, R, never, Environment<R>>;
91
+ /**
92
+ * @tsplus static fncts.control.PureOps environmentWith
93
+ * @tsplus location "@fncts/base/control/Pure/api"
94
+ */
95
+ export declare function environmentWith<R0, A>(f: (r: Environment<R0>) => A): Pure<never, unknown, never, R0, never, A>;
96
+ /**
97
+ * @tsplus static fncts.control.PureOps environmentWithPure
98
+ * @tsplus location "@fncts/base/control/Pure/api"
99
+ */
100
+ export declare function environmentWithPure<R0, W, S1, S2, R, E, A>(f: (r: Environment<R0>) => Pure<W, S1, S2, R, E, A>): Pure<W, S1, S2, R | R0, E, A>;
101
+ /**
102
+ * Erases the current log
103
+ * @tsplus getter fncts.control.Pure erase
104
+ * @tsplus location "@fncts/base/control/Pure/api"
105
+ */
106
+ export declare function erase<W, S1, S2, R, E, A>(wa: Pure<W, S1, S2, R, E, A>): Pure<never, S1, S2, R, E, A>;
107
+ /**
108
+ * @tsplus static fncts.control.PureOps fail
109
+ * @tsplus location "@fncts/base/control/Pure/api"
110
+ */
111
+ export declare function fail<E>(e: Lazy<E>, __tsplusTrace?: string): Pure<never, unknown, never, never, E, never>;
112
+ /**
113
+ * @tsplus static fncts.control.PureOps failNow
114
+ * @tsplus location "@fncts/base/control/Pure/api"
115
+ */
116
+ export declare function failNow<E>(e: E, __tsplusTrace?: string): Pure<never, unknown, never, never, E, never>;
117
+ /**
118
+ * @tsplus static fncts.control.PureOps failCause
119
+ * @tsplus location "@fncts/base/control/Pure/api"
120
+ */
121
+ export declare function failCause<E>(cause: Lazy<Cause<E>>, __tsplusTrace?: string): Pure<never, unknown, never, never, E, never>;
122
+ /**
123
+ * @tsplus static fncts.control.PureOps failCauseNow
124
+ * @tsplus location "@fncts/base/control/Pure/api"
125
+ */
126
+ export declare function failCauseNow<E>(cause: Cause<E>, __tsplusTrace?: string): Pure<never, unknown, never, never, E, never>;
127
+ /**
128
+ * @tsplus getter fncts.control.Pure flatten
129
+ * @tsplus location "@fncts/base/control/Pure/api"
130
+ */
131
+ export declare function flatten<W, S1, S2, R, E, A, W1, S3, R1, E1>(mma: Pure<W, S1, S2, R, E, Pure<W1, S2, S3, R1, E1, A>>): Pure<W | W1, S1, S3, R1 & R, E1 | E, A>;
132
+ /**
133
+ * Constructs a computation that returns the initial state unchanged.
134
+ * @tsplus static fncts.control.PureOps get
135
+ * @tsplus location "@fncts/base/control/Pure/api"
136
+ */
137
+ export declare function get<S>(): Pure<never, S, S, never, never, S>;
138
+ /**
139
+ * @tsplus static fncts.control.PureOps gets
140
+ * @tsplus location "@fncts/base/control/Pure/api"
141
+ */
142
+ export declare function gets<S, A>(f: (s: S) => A): Pure<never, S, S, never, never, A>;
143
+ /**
144
+ * @tsplus static fncts.control.PureOps getsPure
145
+ * @tsplus location "@fncts/base/control/Pure/api"
146
+ */
147
+ export declare function getsPure<S, W, R, E, A>(f: (s: S) => Pure<W, S, S, R, E, A>): Pure<W, S, S, R, E, A>;
148
+ /**
149
+ * @tsplus static fncts.control.PureOps halt
150
+ * @tsplus location "@fncts/base/control/Pure/api"
151
+ */
152
+ export declare function halt(defect: Lazy<unknown>, __tsplusTrace?: string): Pure<never, unknown, never, never, never, never>;
153
+ /**
154
+ * @tsplus static fncts.control.PureOps haltNow
155
+ * @tsplus location "@fncts/base/control/Pure/api"
156
+ */
157
+ export declare function haltNow(defect: unknown, __tsplusTrace?: string): Pure<never, unknown, never, never, never, never>;
158
+ /**
159
+ * @tsplus getter fncts.control.Pure listen
160
+ * @tsplus location "@fncts/base/control/Pure/api"
161
+ */
162
+ export declare function listen<W, S1, S2, R, E, A>(wa: Pure<W, S1, S2, R, E, A>): Pure<W, S1, S2, R, E, readonly [A, Conc<W>]>;
163
+ /**
164
+ * @tsplus pipeable fncts.control.Pure listens
165
+ * @tsplus location "@fncts/base/control/Pure/api"
166
+ */
167
+ export declare function listens<W, B>(f: (log: Conc<W>) => B): <S1, S2, R, E, A>(wa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, readonly [A, B]>;
168
+ /**
169
+ * @tsplus pipeable fncts.control.Pure map
170
+ * @tsplus location "@fncts/base/control/Pure/api"
171
+ */
172
+ export declare function map<A, B>(f: (a: A) => B): <W, S1, S2, R, E>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, B>;
173
+ /**
174
+ * @tsplus pipeable fncts.control.Pure mapError
175
+ * @tsplus location "@fncts/base/control/Pure/api"
176
+ */
177
+ export declare function mapError<E, G>(f: (e: E) => G): <W, S1, S2, R, A>(pab: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, G, A>;
178
+ /**
179
+ * Modifies the current log with the specified function
180
+ * @tsplus pipeable fncts.control.Pure mapLog
181
+ * @tsplus location "@fncts/base/control/Pure/api"
182
+ */
183
+ export declare function mapLog<W, W1>(f: (ws: Conc<W>) => Conc<W1>): <S1, S2, R, E, A>(wa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1, S1, S2, R, E, A>;
184
+ /**
185
+ * Modifies the current state with the specified function
186
+ * @tsplus pipeable fncts.control.Pure mapState
187
+ * @tsplus location "@fncts/base/control/Pure/api"
188
+ */
189
+ export declare function mapState<S2, S3>(f: (s: S2) => S3): <W, S1, R, E, A>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S3, R, E, A>;
190
+ /**
191
+ * Folds over the failed or successful results of this computation to yield
192
+ * a computation that does not fail, but succeeds with the value of the left
193
+ * or right function passed to `match`.
194
+ * @tsplus pipeable fncts.control.Pure match
195
+ * @tsplus location "@fncts/base/control/Pure/api"
196
+ */
197
+ export declare function match<E, A, B, C>(onFailure: (e: E) => B, onSuccess: (a: A) => C): <W, S1, S2, R>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, never, B | C>;
198
+ /**
199
+ * Recovers from errors by accepting one computation to execute for the case
200
+ * of an error, and one computation to execute for the case of success.
201
+ * @tsplus pipeable fncts.control.Pure matchPure
202
+ * @tsplus location "@fncts/base/control/Pure/api"
203
+ */
204
+ export declare function matchPure<S5, S2, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (e: E) => Pure<W1, S5, S3, R1, E1, B>, onSuccess: (a: A) => Pure<W2, S2, S4, R2, E2, C>): <W, S1, R>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W2 | W, S1 & S5, S3 | S4, R1 | R2 | R, E1 | E2, B | C>;
205
+ /**
206
+ * @tsplus pipeable fncts.control.Pure matchCausePure
207
+ * @tsplus location "@fncts/base/control/Pure/api"
208
+ */
209
+ export declare function matchCausePure<S2, E, A, W1, S0, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (e: Cause<E>) => Pure<W1, S0, S3, R1, E1, B>, onSuccess: (a: A) => Pure<W2, S2, S4, R2, E2, C>): <W, S1, R>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W2 | W, S0 & S1, S3 | S4, R1 | R2 | R, E1 | E2, B | C>;
210
+ /**
211
+ * @tsplus pipeable fncts.control.Pure matchLogPure
212
+ * @tsplus location "@fncts/base/control/Pure/api"
213
+ */
214
+ export declare function matchLogPure<W, S5, S2, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (ws: Conc<W>, e: E) => Pure<W1, S5, S3, R1, E1, B>, onSuccess: (ws: Conc<W>, a: A) => Pure<W2, S2, S4, R2, E2, C>): <S1, R>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W | W1 | W2, S1 & S5, S3 | S4, R1 | R2 | R, E1 | E2, B | C>;
215
+ /**
216
+ * Recovers from errors by accepting one computation to execute for the case
217
+ * of an error, and one computation to execute for the case of success. More powerful
218
+ * than `matchCauseM` by providing the current state of the log as an argument in
219
+ * each case
220
+ * @note the log is cleared after being provided
221
+ * @tsplus pipeable fncts.control.Pure matchLogCausePure
222
+ * @tsplus location "@fncts/base/control/Pure/api"
223
+ */
224
+ export declare function matchLogCausePure<W, S2, E, A, W1, S0, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (ws: Conc<W>, e: Cause<E>) => Pure<W1, S0, S3, R1, E1, B>, onSuccess: (ws: Conc<W>, a: A) => Pure<W2, S2, S4, R2, E2, C>): <S1, R>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W2, S0 & S1, S3 | S4, R & R1 & R2, E1 | E2, B | C>;
225
+ /**
226
+ * Constructs a computation from the specified modify function
227
+ * @tsplus static fncts.control.PureOps modify
228
+ * @tsplus location "@fncts/base/control/Pure/api"
229
+ */
230
+ export declare function modify<S1, S2, A>(f: (s: S1) => readonly [A, S2]): Pure<never, S1, S2, never, never, A>;
231
+ /**
232
+ * Constructs a computation that may fail from the specified modify function.
233
+ * @tsplus static fncts.control.PureOps modifyEither
234
+ * @tsplus location "@fncts/base/control/Pure/api"
235
+ */
236
+ export declare function modifyEither<S1, S2, E, A>(f: (s: S1) => Either<E, readonly [A, S2]>): Pure<never, S1, S2, never, E, A>;
237
+ /**
238
+ * @tsplus pipeable fncts.control.Pure orElse
239
+ * @tsplus location "@fncts/base/control/Pure/api"
240
+ */
241
+ export declare function orElse<S1, W1, S3, R1, E1, A1>(fb: Lazy<Pure<W1, S1, S3, R1, E1, A1>>): <W, S2, R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3 | S2, R1 | R, E1 | E, A1 | A>;
242
+ /**
243
+ * Executes this computation and returns its value, if it succeeds, but
244
+ * otherwise executes the specified computation.
245
+ * @tsplus pipeable fncts.control.Pure orElseEither
246
+ * @tsplus location "@fncts/base/control/Pure/api"
247
+ */
248
+ export declare function orElseEither<W, S3, S4, R1, E1, A1>(that: Lazy<Pure<W, S3, S4, R1, E1, A1>>): <S1, S2, R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1 & S3, S4 | S2, R1 | R, E1, import("../../data/Either.js").Either<A, A1>>;
249
+ /**
250
+ * @tsplus pipeable fncts.control.Pure provideEnvironment
251
+ * @tsplus location "@fncts/base/control/Pure/api"
252
+ */
253
+ export declare function provideEnvironment<R>(r: Environment<R>): <W, S1, S2, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, never, E, A>;
254
+ /**
255
+ * Constructs a computation that sets the state to the specified value.
256
+ * @tsplus static fncts.control.PureOps put
257
+ * @tsplus location "@fncts/base/control/Pure/api"
258
+ */
259
+ export declare function put<S>(s: S): Pure<never, unknown, S, never, never, void>;
260
+ /**
261
+ * Repeats this computation the specified number of times (or until the first failure)
262
+ * passing the updated state to each successive repetition.
263
+ * @tsplus pipeable fncts.control.Pure repeatN
264
+ * @tsplus location "@fncts/base/control/Pure/api"
265
+ */
266
+ export declare function repeatN(n: number): <W, S1, S2 extends S1, R, E, A>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>;
267
+ /**
268
+ * Repeats this computation until its value satisfies the specified predicate
269
+ * (or until the first failure) passing the updated state to each successive repetition.
270
+ * @tsplus pipeable fncts.control.Pure repeatUntil
271
+ * @tsplus location "@fncts/base/control/Pure/api"
272
+ */
273
+ export declare function repeatUntil<A>(p: Predicate<A>): <W, S1, S2 extends S1, R, E>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>;
274
+ /**
275
+ * @tsplus static fncts.control.PureOps succeed
276
+ * @tsplus location "@fncts/base/control/Pure/api"
277
+ */
278
+ export declare function succeed<A, W = never, S1 = unknown, S2 = never>(effect: Lazy<A>, __tsplusTrace?: string): Pure<W, S1, S2, never, never, A>;
279
+ /**
280
+ * @tsplus static fncts.control.PureOps succeedNow
281
+ * @tsplus location "@fncts/base/control/Pure/api"
282
+ */
283
+ export declare function succeedNow<A, W = never, S1 = unknown, S2 = never>(a: A, __tsplusTrace?: string): Pure<W, S1, S2, never, never, A>;
284
+ /**
285
+ * @tsplus pipeable fncts.control.Pure tap
286
+ * @tsplus location "@fncts/base/control/Pure/api"
287
+ */
288
+ export declare function tap<S2, A, W1, S3, R1, E1, B>(f: (a: A) => Pure<W1, S2, S3, R1, E1, B>): <W, S1, R, E>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3, R1 & R, E1 | E, A>;
289
+ /**
290
+ * @tsplus static fncts.control.PureOps tell
291
+ * @tsplus location "@fncts/base/control/Pure/api"
292
+ */
293
+ export declare function tell<W>(w: W): Pure<W, unknown, never, never, never, void>;
294
+ /**
295
+ * @tsplus static fncts.control.PureOps tellAll
296
+ * @tsplus location "@fncts/base/control/Pure/api"
297
+ */
298
+ export declare function tellAll<W>(ws: Conc<W>): Pure<W, unknown, never, never, never, void>;
299
+ /**
300
+ * Like `map`, but also allows the state to be modified.
301
+ * @tsplus pipeable fncts.control.Pure transform
302
+ * @tsplus location "@fncts/base/control/Pure/api"
303
+ */
304
+ export declare function transform<S2, A, S3, B>(f: (s: S2, a: A) => readonly [B, S3]): <W, S1, R, E>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W, S1, S3, R, E, B>;
305
+ /**
306
+ * @tsplus static fncts.control.PureOps unit
307
+ * @tsplus location "@fncts/base/control/Pure/api"
308
+ */
309
+ export declare const unit: Pure<never, unknown, never, never, never, void>;
310
+ /**
311
+ * Constructs a computation from the specified update function.
312
+ * @tsplus static fncts.control.PureOps update
313
+ * @tsplus location "@fncts/base/control/Pure/api"
314
+ */
315
+ export declare function update<S1, S2>(f: (s: S1) => S2): Pure<never, S1, S2, never, never, void>;
316
+ /**
317
+ * @tsplus pipeable fncts.control.Pure write
318
+ * @tsplus location "@fncts/base/control/Pure/api"
319
+ */
320
+ export declare function write<W1>(w: W1): <W, S1, S2, R, E, A>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S2, R, E, A>;
321
+ /**
322
+ * @tsplus pipeable fncts.control.Pure writeAll
323
+ * @tsplus location "@fncts/base/control/Pure/api"
324
+ */
325
+ export declare function writeAll<W1>(log: Conc<W1>): <W, S1, S2, R, E, A>(ma: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S2, R, E, A>;
326
+ /**
327
+ * @tsplus pipeable fncts.control.Pure zip
328
+ * @tsplus location "@fncts/base/control/Pure/api"
329
+ */
330
+ export declare function zip<S2, W1, S3, Q, D, B>(fb: Pure<W1, S2, S3, Q, D, B>): <W, S1, R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3, Q & R, D | E, import("../../data/Zipped.js").Zipped.Make<A, B>>;
331
+ /**
332
+ * @tsplus pipeable fncts.control.Pure zipFirst
333
+ * @tsplus location "@fncts/base/control/Pure/api"
334
+ */
335
+ export declare function zipFirst<S2, W1, S3, Q, D, B>(fb: Pure<W1, S2, S3, Q, D, B>): <W, S1, R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3, Q & R, D | E, A>;
336
+ /**
337
+ * @tsplus pipeable fncts.control.Pure zipSecond
338
+ * @tsplus location "@fncts/base/control/Pure/api"
339
+ */
340
+ export declare function zipSecond<S2, W1, S3, Q, D, B>(fb: Pure<W1, S2, S3, Q, D, B>): <W, S1, R, E, A>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3, Q & R, D | E, B>;
341
+ /**
342
+ * @tsplus pipeable fncts.control.Pure zipWith
343
+ * @tsplus location "@fncts/base/control/Pure/api"
344
+ */
345
+ export declare function zipWith<S2, A, W1, S3, R1, E1, B, C>(fb: Pure<W1, S2, S3, R1, E1, B>, f: (a: A, b: B) => C): <W, S1, R, E>(fa: import("@fncts/base/control/Pure/definition").Pure<W, S1, S2, R, E, A>) => import("@fncts/base/control/Pure/definition").Pure<W1 | W, S1, S3, R1 & R, E1 | E, C>;
@@ -0,0 +1,156 @@
1
+ import { HKT } from "@fncts/typelevel/HKT";
2
+ import { Cause } from "@fncts/base/data/Cause/definition";
3
+ import { Conc } from "@fncts/base/collection/immutable/Conc";
4
+ import { Environment } from "@fncts/base/data/Environment/definition";
5
+ export interface PureF extends HKT {
6
+ type: Pure<this["W"], this["S"], this["S"], this["R"], this["E"], this["A"]>;
7
+ variance: {
8
+ W: "+";
9
+ S: "_";
10
+ R: "-";
11
+ E: "+";
12
+ A: "+";
13
+ };
14
+ }
15
+ export declare const PureVariance: unique symbol;
16
+ export type PureVariance = typeof PureVariance;
17
+ export declare const PureTypeId: unique symbol;
18
+ export type PureTypeId = typeof PureTypeId;
19
+ /**
20
+ * `Pure<W, S1, S2, R, E, A>` is a purely functional description of a synchronous computation
21
+ * that requires an environment `R` and an initial state `S1` and may either
22
+ * fail with an `E` or succeed with an updated state `S2` and an `A`. Because
23
+ * of its polymorphism `Z` can be used to model a variety of effects
24
+ * including context, state, failure, and logging.
25
+ *
26
+ * @tsplus type fncts.control.Pure
27
+ * @tsplus companion fncts.control.PureOps
28
+ */
29
+ export declare abstract class Pure<W, S1, S2, R, E, A> {
30
+ readonly [PureTypeId]: PureTypeId;
31
+ [PureVariance]: {
32
+ readonly _W: (_: never) => W;
33
+ readonly _S1: (_: S1) => void;
34
+ readonly _S2: (_: never) => S2;
35
+ readonly _R: (_: never) => R;
36
+ readonly _E: (_: never) => E;
37
+ readonly _A: (_: never) => A;
38
+ };
39
+ }
40
+ /**
41
+ * @tsplus unify fncts.control.Pure
42
+ */
43
+ export declare function unifyPure<X extends Pure<any, any, any, any, any, any>>(_: X): Pure<[
44
+ X
45
+ ] extends [Pure<infer W, any, any, any, any, any>] ? W : never, [
46
+ X
47
+ ] extends [Pure<any, infer S1, any, any, any, any>] ? S1 : never, [
48
+ X
49
+ ] extends [Pure<any, any, infer S2, any, any, any>] ? S2 : never, [
50
+ X
51
+ ] extends [Pure<any, any, any, infer R, any, any>] ? R : never, [
52
+ X
53
+ ] extends [Pure<any, any, any, any, infer E, any>] ? E : never, [
54
+ X
55
+ ] extends [Pure<any, any, any, any, any, infer A>] ? A : never>;
56
+ export declare class PurePrimitive {
57
+ readonly _tag: unknown;
58
+ readonly [PureTypeId]: PureTypeId;
59
+ [PureVariance]: {
60
+ readonly _W: (_: never) => never;
61
+ readonly _S1: (_: unknown) => void;
62
+ readonly _S2: (_: never) => never;
63
+ readonly _R: (_: never) => never;
64
+ readonly _E: (_: never) => never;
65
+ readonly _A: (_: never) => never;
66
+ };
67
+ constructor(_tag: unknown);
68
+ readonly i0: unknown;
69
+ readonly i1: unknown;
70
+ readonly i2: unknown;
71
+ }
72
+ /**
73
+ * @tsplus static fncts.control.PureOps isPure
74
+ * @tsplus location "@fncts/base/control/Pure/definition"
75
+ */
76
+ export declare function isPure(u: unknown): u is Pure<unknown, unknown, unknown, unknown, unknown, unknown>;
77
+ export declare const enum PureTag {
78
+ SucceedNow = 0,
79
+ Succeed = 1,
80
+ Defer = 2,
81
+ Fail = 3,
82
+ Modify = 4,
83
+ Chain = 5,
84
+ Match = 6,
85
+ Access = 7,
86
+ Provide = 8,
87
+ Tell = 9,
88
+ Listen = 10,
89
+ MapLog = 11
90
+ }
91
+ export type PureOp<Tag extends number, Body = {}> = PurePrimitive & Body & {
92
+ _tag: Tag;
93
+ };
94
+ export interface SucceedNow extends PureOp<PureTag.SucceedNow, {
95
+ readonly i0: any;
96
+ }> {
97
+ }
98
+ export interface Succeed extends PureOp<PureTag.Succeed, {
99
+ readonly i0: () => any;
100
+ }> {
101
+ }
102
+ export interface Defer extends PureOp<PureTag.Defer, {
103
+ readonly i0: () => Primitive;
104
+ }> {
105
+ }
106
+ export interface Fail extends PureOp<PureTag.Fail, {
107
+ readonly i0: Cause<unknown>;
108
+ }> {
109
+ }
110
+ export interface Modify extends PureOp<PureTag.Modify, {
111
+ readonly i0: (s1: any) => readonly [any, any];
112
+ }> {
113
+ }
114
+ export interface FlatMap extends PureOp<PureTag.Chain, {
115
+ readonly i0: Primitive;
116
+ readonly i1: (a: any) => Primitive;
117
+ }> {
118
+ }
119
+ export interface Match extends PureOp<PureTag.Match, {
120
+ readonly i0: Primitive;
121
+ readonly i1: (ws: Conc<any>, e: Cause<unknown>) => Primitive;
122
+ readonly i2: (ws: Conc<any>, a: any) => Primitive;
123
+ }> {
124
+ }
125
+ export interface Access extends PureOp<PureTag.Access, {
126
+ readonly i0: (r: Environment<any>) => Primitive;
127
+ }> {
128
+ }
129
+ export interface Provide extends PureOp<PureTag.Provide, {
130
+ readonly i0: Primitive;
131
+ readonly i1: Environment<any>;
132
+ }> {
133
+ }
134
+ export interface Tell extends PureOp<PureTag.Tell, {
135
+ readonly i0: Conc<any>;
136
+ }> {
137
+ }
138
+ export interface MapLog extends PureOp<PureTag.MapLog, {
139
+ readonly i0: Primitive;
140
+ readonly i1: (ws: Conc<any>) => Conc<any>;
141
+ }> {
142
+ }
143
+ export type Primitive = SucceedNow | Fail | Modify | FlatMap | Match | Access | Provide | Defer | Succeed | Tell | MapLog;
144
+ /**
145
+ * @tsplus static fncts.control.PureOps concrete
146
+ * @tsplus location "@fncts/base/control/Pure/definition"
147
+ */
148
+ export declare function concrete(_: Pure<any, any, any, any, any, any>): asserts _ is Primitive;
149
+ export declare const PureErrorTypeId: unique symbol;
150
+ export type PureErrorTypeId = typeof PureErrorTypeId;
151
+ export declare class PureError<E> {
152
+ readonly cause: Cause<E>;
153
+ readonly [PureErrorTypeId]: PureErrorTypeId;
154
+ constructor(cause: Cause<E>);
155
+ }
156
+ export declare function isPureError(u: unknown): u is PureError<unknown>;
@@ -0,0 +1,8 @@
1
+ import type * as P from "../../typeclass.js";
2
+ import type { PureF } from "./definition.js";
3
+ /**
4
+ * @tsplus static fncts.control.PureOps Applicative
5
+ * @tsplus implicit
6
+ * @tsplus location "@fncts/base/control/Pure/instances"
7
+ */
8
+ export declare const Applicative: P.Applicative<PureF, import("@fncts/typelevel/HKT.js").HKT.None>;
@@ -0,0 +1,56 @@
1
+ import { Pure } from "@fncts/base/control/Pure/definition";
2
+ import { Conc } from "@fncts/base/collection/immutable/Conc";
3
+ import { Exit } from "@fncts/base/data/Exit/definition";
4
+ import { Environment } from "@fncts/base/data/Environment/definition";
5
+ import { Cause } from "@fncts/base/data/Cause/definition";
6
+ /**
7
+ * Runs this computation with the specified initial state, returning either a
8
+ * failure or the updated state and the result
9
+ * @tsplus pipeable fncts.control.Pure unsafeRunAll
10
+ * @tsplus location "@fncts/base/control/Pure/runtime"
11
+ */
12
+ export declare function unsafeRunAll<S1>(s: S1): <W, S2, E, A>(ma: import("./definition.js").Pure<W, S1, S2, never, E, A>) => readonly [import("../../collection/immutable/Conc.js").Conc<W>, import("../../data/Exit.js").Exit<E, readonly [S2, A]>];
13
+ /**
14
+ * Runs this computation with the specified initial state, returning both
15
+ * the updated state and the result.
16
+ * @tsplus pipeable fncts.control.Pure unsafeRun
17
+ * @tsplus location "@fncts/base/control/Pure/runtime"
18
+ */
19
+ export declare function unsafeRun<S1>(s: S1): <W, S2, A>(ma: import("./definition.js").Pure<W, S1, S2, never, never, A>) => readonly [S2, A];
20
+ /**
21
+ * Runs this computation, returning the result.
22
+ * @tsplus getter fncts.control.Pure unsafeRunResult
23
+ * @tsplus location "@fncts/base/control/Pure/runtime"
24
+ */
25
+ export declare function unsafeRunResult<W, A>(ma: Pure<W, unknown, unknown, never, never, A>): A;
26
+ /**
27
+ * Runs this computation with the given environment, returning the result.
28
+ * @tsplus pipeable fncts.control.Pure unsafeRunReader
29
+ * @tsplus location "@fncts/base/control/Pure/runtime"
30
+ */
31
+ export declare function unsafeRunReader<R>(r: Environment<R>): <W, A>(ma: import("./definition.js").Pure<W, unknown, never, R, never, A>) => A;
32
+ /**
33
+ * Runs this computation with the specified initial state, returning the
34
+ * updated state and discarding the result.
35
+ * @tsplus pipeable fncts.control.Pure unsafeRunState
36
+ * @tsplus location "@fncts/base/control/Pure/runtime"
37
+ */
38
+ export declare function unsafeRunState<S1>(s: S1): <W, S2, A>(ma: import("./definition.js").Pure<W, S1, S2, never, never, A>) => S2;
39
+ /**
40
+ * Runs this computation with the specified initial state, returning the
41
+ * result and discarding the updated state.
42
+ * @tsplus pipeable fncts.control.Pure unsafeRunStateResult
43
+ * @tsplus location "@fncts/base/control/Pure/runtime"
44
+ */
45
+ export declare function unsafeRunStateResult<S1>(s: S1): <W, S2, A>(ma: import("./definition.js").Pure<W, S1, S2, never, never, A>) => A;
46
+ /**
47
+ * Runs this computation returning either the result or error
48
+ * @tsplus getter fncts.control.Pure unsafeRunExit
49
+ * @tsplus location "@fncts/base/control/Pure/runtime"
50
+ */
51
+ export declare function unsafeRunExit<E, A>(ma: Pure<never, unknown, unknown, never, E, A>): Exit<E, A>;
52
+ /**
53
+ * @tsplus getter fncts.control.Pure unsafeRunWriter
54
+ * @tsplus location "@fncts/base/control/Pure/runtime"
55
+ */
56
+ export declare function unsafeRunWriter<W, A>(ma: Pure<W, unknown, unknown, never, never, A>): readonly [Conc<W>, A];
@@ -0,0 +1,4 @@
1
+ export * from "./Pure/api.js";
2
+ export * from "./Pure/definition.js";
3
+ export * from "./Pure/instances.js";
4
+ export * from "./Pure/runtime.js";
package/control.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export type {} from "./control/CompletablePromise.js";
2
2
  export type {} from "./control/Eval.js";
3
3
  export type {} from "./control/LazyValue.js";
4
- export type {} from "./control/Z.js";
4
+ export type {} from "./control/Pure.js";
@@ -1,6 +1,6 @@
1
1
  import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
2
2
  import { CaseClass } from "@fncts/base/data/CaseClass";
3
- import { Z } from "@fncts/base/control/Z/definition";
3
+ import { Pure } from "@fncts/base/control/Pure/definition";
4
4
  import { Conc } from "@fncts/base/collection/immutable/Conc";
5
5
  import type { StyleFunction } from "@fncts/base/data/Showable/styles";
6
6
  export interface ShowContextArgs {
@@ -31,7 +31,7 @@ export interface ShowOptions {
31
31
  }
32
32
  export declare class ShowContext extends CaseClass<ShowContextArgs> {
33
33
  }
34
- export type ShowComputationZ<A> = Z<never, ShowContext, ShowContext, never, never, A>;
34
+ export type ShowComputationZ<A> = Pure<never, ShowContext, ShowContext, never, never, A>;
35
35
  export type ShowComputation = ShowComputationZ<string>;
36
36
  export type ShowComputationChunk = ShowComputationZ<Conc<string>>;
37
37
  export interface ShowComputationPrimitive {
package/global.d.ts CHANGED
@@ -77,7 +77,7 @@ import { LazyValue } from "@fncts/base/control/LazyValue";
77
77
  /**
78
78
  * @tsplus global
79
79
  */
80
- import { Z } from "@fncts/base/control/Z/definition";
80
+ import { Pure } from "@fncts/base/control/Pure/definition";
81
81
  /**
82
82
  * @tsplus global
83
83
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fncts/base",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "dependencies": {
5
5
  "@fncts/typelevel": "0.0.15",
6
6
  "uuid": "^9.0.0"