@fncts/base 0.0.29 → 0.0.31

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.
Files changed (110) 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/Date/definition.cjs +6 -0
  24. package/_cjs/data/Date/definition.cjs.map +1 -0
  25. package/_cjs/data/Date.cjs +17 -0
  26. package/_cjs/data/Date.cjs.map +1 -0
  27. package/_cjs/data/Showable/show.cjs +31 -31
  28. package/_cjs/data/Showable/show.cjs.map +1 -1
  29. package/_mjs/collection/immutable/HashSet/api.mjs +17 -7
  30. package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
  31. package/_mjs/collection/immutable/HashSet/definition.mjs +2 -2
  32. package/_mjs/collection/immutable/HashSet/definition.mjs.map +1 -1
  33. package/_mjs/control/Eval/api.mjs +5 -2
  34. package/_mjs/control/Eval/api.mjs.map +1 -1
  35. package/_mjs/control/Eval/constructors.mjs +10 -3
  36. package/_mjs/control/Eval/constructors.mjs.map +1 -1
  37. package/_mjs/control/Eval/definition.mjs +7 -25
  38. package/_mjs/control/Eval/definition.mjs.map +1 -1
  39. package/_mjs/control/Eval/run.mjs +7 -7
  40. package/_mjs/control/Eval/run.mjs.map +1 -1
  41. package/_mjs/control/{Z → Pure}/api.mjs +134 -104
  42. package/_mjs/control/Pure/api.mjs.map +1 -0
  43. package/_mjs/control/Pure/definition.mjs +60 -0
  44. package/_mjs/control/Pure/definition.mjs.map +1 -0
  45. package/_mjs/control/{Z → Pure}/instances.mjs +1 -1
  46. package/_mjs/control/Pure/instances.mjs.map +1 -0
  47. package/_mjs/control/{Z → Pure}/runtime.mjs +68 -67
  48. package/_mjs/control/Pure/runtime.mjs.map +1 -0
  49. package/_mjs/control/Pure.mjs +6 -0
  50. package/_mjs/control/Pure.mjs.map +1 -0
  51. package/_mjs/data/Date/definition.mjs +2 -0
  52. package/_mjs/data/Date/definition.mjs.map +1 -0
  53. package/_mjs/data/Date.mjs +3 -0
  54. package/_mjs/data/Date.mjs.map +1 -0
  55. package/_mjs/data/Showable/show.mjs +31 -31
  56. package/_mjs/data/Showable/show.mjs.map +1 -1
  57. package/_src/collection/immutable/HashSet/api.ts +12 -1
  58. package/_src/collection/immutable/HashSet/definition.ts +2 -2
  59. package/_src/control/Eval/api.ts +5 -2
  60. package/_src/control/Eval/constructors.ts +10 -3
  61. package/_src/control/Eval/definition.ts +39 -27
  62. package/_src/control/Eval/run.ts +7 -7
  63. package/_src/control/Pure/api.ts +629 -0
  64. package/_src/control/Pure/definition.ts +222 -0
  65. package/_src/control/{Z → Pure}/instances.ts +3 -3
  66. package/_src/control/{Z → Pure}/runtime.ts +73 -76
  67. package/_src/control/Pure.ts +6 -0
  68. package/_src/control.ts +1 -1
  69. package/_src/data/Date/definition.ts +6 -0
  70. package/_src/data/Date.ts +3 -0
  71. package/_src/data/Showable/show.ts +55 -53
  72. package/_src/data.ts +1 -0
  73. package/_src/global.ts +1 -1
  74. package/collection/immutable/HashSet/api.d.ts +5 -0
  75. package/collection/immutable/HashSet/definition.d.ts +1 -1
  76. package/control/Eval/constructors.d.ts +4 -0
  77. package/control/Eval/definition.d.ts +25 -28
  78. package/control/Pure/api.d.ts +345 -0
  79. package/control/Pure/definition.d.ts +156 -0
  80. package/control/Pure/instances.d.ts +8 -0
  81. package/control/Pure/runtime.d.ts +56 -0
  82. package/control/Pure.d.ts +4 -0
  83. package/control.d.ts +1 -1
  84. package/data/Date/definition.d.ts +9 -0
  85. package/data/Date.d.ts +1 -0
  86. package/data/Showable/show.d.ts +2 -2
  87. package/data.d.ts +1 -0
  88. package/global.d.ts +1 -1
  89. package/package.json +1 -1
  90. package/_cjs/control/Z/api.cjs.map +0 -1
  91. package/_cjs/control/Z/definition.cjs +0 -163
  92. package/_cjs/control/Z/definition.cjs.map +0 -1
  93. package/_cjs/control/Z/instances.cjs.map +0 -1
  94. package/_cjs/control/Z/runtime.cjs.map +0 -1
  95. package/_cjs/control/Z.cjs.map +0 -1
  96. package/_mjs/control/Z/api.mjs.map +0 -1
  97. package/_mjs/control/Z/definition.mjs +0 -145
  98. package/_mjs/control/Z/definition.mjs.map +0 -1
  99. package/_mjs/control/Z/instances.mjs.map +0 -1
  100. package/_mjs/control/Z/runtime.mjs.map +0 -1
  101. package/_mjs/control/Z.mjs +0 -6
  102. package/_mjs/control/Z.mjs.map +0 -1
  103. package/_src/control/Z/api.ts +0 -590
  104. package/_src/control/Z/definition.ts +0 -199
  105. package/_src/control/Z.ts +0 -6
  106. package/control/Z/api.d.ts +0 -345
  107. package/control/Z/definition.d.ts +0 -151
  108. package/control/Z/instances.d.ts +0 -8
  109. package/control/Z/runtime.d.ts +0 -56
  110. package/control/Z.d.ts +0 -4
@@ -1,151 +0,0 @@
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 ZF extends HKT {
6
- type: Z<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 ZVariance: unique symbol;
16
- export type ZVariance = typeof ZVariance;
17
- export declare const ZTypeId: unique symbol;
18
- export type ZTypeId = typeof ZTypeId;
19
- /**
20
- * `Z<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
- * @note named `Z` in honor of `ZIO` and because it is, surely, the last synchronous effect type
27
- * one will ever need
28
- *
29
- * @tsplus type fncts.control.Z
30
- * @tsplus companion fncts.control.ZOps
31
- */
32
- export declare abstract class Z<W, S1, S2, R, E, A> {
33
- readonly [ZTypeId]: ZTypeId;
34
- [ZVariance]: {
35
- readonly _W: (_: never) => W;
36
- readonly _S1: (_: S1) => void;
37
- readonly _S2: (_: never) => S2;
38
- readonly _R: (_: never) => R;
39
- readonly _E: (_: never) => E;
40
- readonly _A: (_: never) => A;
41
- };
42
- }
43
- /**
44
- * @tsplus unify fncts.control.Z
45
- */
46
- export declare function unifyZ<X extends Z<any, any, any, any, any, any>>(_: X): Z<[
47
- X
48
- ] extends [Z<infer W, any, any, any, any, any>] ? W : never, [
49
- X
50
- ] extends [Z<any, infer S1, any, any, any, any>] ? S1 : never, [
51
- X
52
- ] extends [Z<any, any, infer S2, any, any, any>] ? S2 : never, [
53
- X
54
- ] extends [Z<any, any, any, infer R, any, any>] ? R : never, [
55
- X
56
- ] extends [Z<any, any, any, any, infer E, any>] ? E : never, [
57
- X
58
- ] extends [Z<any, any, any, any, any, infer A>] ? A : never>;
59
- /**
60
- * @tsplus static fncts.control.ZOps isZ
61
- * @tsplus location "@fncts/base/control/Z/definition"
62
- */
63
- export declare function isZ(u: unknown): u is Z<unknown, unknown, unknown, unknown, unknown, unknown>;
64
- export declare const enum ZTag {
65
- SucceedNow = "SucceedNow",
66
- Succeed = "Succeed",
67
- Defer = "Defer",
68
- Fail = "Fail",
69
- Modify = "Modify",
70
- Chain = "Chain",
71
- Match = "Match",
72
- Access = "Access",
73
- Provide = "Provide",
74
- Tell = "Tell",
75
- Listen = "Listen",
76
- MapLog = "MapLog"
77
- }
78
- export declare class SucceedNow<A> extends Z<never, unknown, never, never, never, A> {
79
- readonly value: A;
80
- readonly _tag = ZTag.SucceedNow;
81
- constructor(value: A);
82
- }
83
- export declare class Succeed<A> extends Z<never, unknown, never, never, never, A> {
84
- readonly effect: () => A;
85
- readonly _tag = ZTag.Succeed;
86
- constructor(effect: () => A);
87
- }
88
- export declare class Defer<W, S1, S2, R, E, A> extends Z<W, S1, S2, R, E, A> {
89
- readonly make: () => Z<W, S1, S2, R, E, A>;
90
- readonly _tag = ZTag.Defer;
91
- constructor(make: () => Z<W, S1, S2, R, E, A>);
92
- }
93
- export declare class Fail<E> extends Z<never, unknown, never, never, E, never> {
94
- readonly cause: Cause<E>;
95
- readonly _tag = ZTag.Fail;
96
- constructor(cause: Cause<E>);
97
- }
98
- export declare class Modify<S1, S2, A> extends Z<never, S1, S2, never, never, A> {
99
- readonly run: (s1: S1) => readonly [A, S2];
100
- readonly _tag = ZTag.Modify;
101
- constructor(run: (s1: S1) => readonly [A, S2]);
102
- }
103
- export declare class Chain<W, S1, S2, R, E, A, W1, S3, Q, D, B> extends Z<W | W1, S1, S3, Q & R, D | E, B> {
104
- readonly ma: Z<W, S1, S2, R, E, A>;
105
- readonly f: (a: A) => Z<W1, S2, S3, Q, D, B>;
106
- readonly _tag = ZTag.Chain;
107
- constructor(ma: Z<W, S1, S2, R, E, A>, f: (a: A) => Z<W1, S2, S3, Q, D, B>);
108
- }
109
- export declare class Match<W, S1, S2, S5, R, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C> extends Z<W1 | W2, S1 & S5, S3 | S4, R & R1 & R2, E1 | E2, B | C> {
110
- readonly z: Z<W, S1, S2, R, E, A>;
111
- readonly onFailure: (ws: Conc<W>, e: Cause<E>) => Z<W1, S5, S3, R1, E1, B>;
112
- readonly onSuccess: (ws: Conc<W>, a: A) => Z<W2, S2, S4, R2, E2, C>;
113
- readonly _tag = ZTag.Match;
114
- constructor(z: Z<W, S1, S2, R, E, A>, onFailure: (ws: Conc<W>, e: Cause<E>) => Z<W1, S5, S3, R1, E1, B>, onSuccess: (ws: Conc<W>, a: A) => Z<W2, S2, S4, R2, E2, C>);
115
- }
116
- export declare class Access<W, R0, S1, S2, R, E, A> extends Z<W, S1, S2, R0 | R, E, A> {
117
- readonly asks: (r: Environment<R0>) => Z<W, S1, S2, R, E, A>;
118
- readonly _tag = ZTag.Access;
119
- constructor(asks: (r: Environment<R0>) => Z<W, S1, S2, R, E, A>);
120
- }
121
- export declare class Provide<W, S1, S2, R, E, A> extends Z<W, S1, S2, never, E, A> {
122
- readonly ma: Z<W, S1, S2, R, E, A>;
123
- readonly env: Environment<R>;
124
- readonly _tag = ZTag.Provide;
125
- constructor(ma: Z<W, S1, S2, R, E, A>, env: Environment<R>);
126
- }
127
- export declare class Tell<W> extends Z<W, unknown, never, never, never, void> {
128
- readonly log: Conc<W>;
129
- readonly _tag = ZTag.Tell;
130
- constructor(log: Conc<W>);
131
- }
132
- export declare class MapLog<W, S1, S2, R, E, A, W1> extends Z<W1, S1, S2, R, E, A> {
133
- readonly ma: Z<W, S1, S2, R, E, A>;
134
- readonly modifyLog: (ws: Conc<W>) => Conc<W1>;
135
- readonly _tag = ZTag.MapLog;
136
- constructor(ma: Z<W, S1, S2, R, E, A>, modifyLog: (ws: Conc<W>) => Conc<W1>);
137
- }
138
- export type Concrete = SucceedNow<any> | Fail<any> | Modify<any, any, any> | Chain<any, any, any, any, any, any, any, any, any, any, any> | Match<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> | Access<any, any, any, any, any, any, any> | Provide<any, any, any, any, any, any> | Defer<any, any, any, any, any, any> | Succeed<any> | Tell<any> | MapLog<any, any, any, any, any, any, any>;
139
- /**
140
- * @tsplus static fncts.control.ZOps concrete
141
- * @tsplus location "@fncts/base/control/Z/definition"
142
- */
143
- export declare function concrete(_: Z<any, any, any, any, any, any>): asserts _ is Concrete;
144
- export declare const ZErrorTypeId: unique symbol;
145
- export type ZErrorTypeId = typeof ZErrorTypeId;
146
- export declare class ZError<E> {
147
- readonly cause: Cause<E>;
148
- readonly [ZErrorTypeId]: ZErrorTypeId;
149
- constructor(cause: Cause<E>);
150
- }
151
- export declare function isZError(u: unknown): u is ZError<unknown>;
@@ -1,8 +0,0 @@
1
- import type * as P from "../../typeclass.js";
2
- import type { ZF } from "./definition.js";
3
- /**
4
- * @tsplus static fncts.control.ZOps Applicative
5
- * @tsplus implicit
6
- * @tsplus location "@fncts/base/control/Z/instances"
7
- */
8
- export declare const Applicative: P.Applicative<ZF, import("@fncts/typelevel/HKT.js").HKT.None>;
@@ -1,56 +0,0 @@
1
- import { Z } from "@fncts/base/control/Z/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.Z unsafeRunAll
10
- * @tsplus location "@fncts/base/control/Z/runtime"
11
- */
12
- export declare function unsafeRunAll<S1>(s: S1): <W, S2, E, A>(ma: import("./definition.js").Z<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.Z unsafeRun
17
- * @tsplus location "@fncts/base/control/Z/runtime"
18
- */
19
- export declare function unsafeRun<S1>(s: S1): <W, S2, A>(ma: import("./definition.js").Z<W, S1, S2, never, never, A>) => readonly [S2, A];
20
- /**
21
- * Runs this computation, returning the result.
22
- * @tsplus getter fncts.control.Z unsafeRunResult
23
- * @tsplus location "@fncts/base/control/Z/runtime"
24
- */
25
- export declare function unsafeRunResult<W, A>(ma: Z<W, unknown, unknown, never, never, A>): A;
26
- /**
27
- * Runs this computation with the given environment, returning the result.
28
- * @tsplus pipeable fncts.control.Z unsafeRunReader
29
- * @tsplus location "@fncts/base/control/Z/runtime"
30
- */
31
- export declare function unsafeRunReader<R>(r: Environment<R>): <W, A>(ma: import("./definition.js").Z<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.Z unsafeRunState
36
- * @tsplus location "@fncts/base/control/Z/runtime"
37
- */
38
- export declare function unsafeRunState<S1>(s: S1): <W, S2, A>(ma: import("./definition.js").Z<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.Z unsafeRunStateResult
43
- * @tsplus location "@fncts/base/control/Z/runtime"
44
- */
45
- export declare function unsafeRunStateResult<S1>(s: S1): <W, S2, A>(ma: import("./definition.js").Z<W, S1, S2, never, never, A>) => A;
46
- /**
47
- * Runs this computation returning either the result or error
48
- * @tsplus getter fncts.control.Z unsafeRunExit
49
- * @tsplus location "@fncts/base/control/Z/runtime"
50
- */
51
- export declare function unsafeRunExit<E, A>(ma: Z<never, unknown, unknown, never, E, A>): Exit<E, A>;
52
- /**
53
- * @tsplus getter fncts.control.Z unsafeRunWriter
54
- * @tsplus location "@fncts/base/control/Z/runtime"
55
- */
56
- export declare function unsafeRunWriter<W, A>(ma: Z<W, unknown, unknown, never, never, A>): readonly [Conc<W>, A];
package/control/Z.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./Z/api.js";
2
- export * from "./Z/definition.js";
3
- export * from "./Z/instances.js";
4
- export * from "./Z/runtime.js";