@fncts/io 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/Channel/api.d.ts +2 -2
  2. package/Clock/api.d.ts +3 -1
  3. package/Clock/definition.d.ts +3 -1
  4. package/Clock/live.d.ts +2 -0
  5. package/Fiber/api/interruptFork.d.ts +1 -1
  6. package/IO/api/asyncIO.d.ts +6 -0
  7. package/IO/api/ensuringChildren.d.ts +7 -0
  8. package/IO/api/sequenceT.d.ts +2 -3
  9. package/IO/api/sleep.d.ts +3 -1
  10. package/IO/api/timeout.d.ts +14 -0
  11. package/IO/api.d.ts +2 -2
  12. package/IO/definition.d.ts +8 -4
  13. package/IO.d.ts +3 -0
  14. package/IOSpec.d.ts +10 -1
  15. package/Latch.d.ts +3 -0
  16. package/Schedule/Decision.d.ts +1 -1
  17. package/Schedule/api.d.ts +1 -1
  18. package/Schedule.d.ts +0 -1
  19. package/Scope/Finalizer/definition.d.ts +1 -1
  20. package/Scope/ReleaseMap/definition.d.ts +1 -1
  21. package/Stream/api.d.ts +5 -22
  22. package/Stream/internal/DebounceState.d.ts +3 -3
  23. package/Stream/internal/Handoff.d.ts +9 -9
  24. package/Stream/internal/SinkEndReason.d.ts +6 -18
  25. package/TFuture/definition.d.ts +1 -1
  26. package/TSemaphore/definition.d.ts +1 -1
  27. package/_cjs/Cached.cjs +3 -3
  28. package/_cjs/Channel/ChildExecutorDecision.cjs +2 -2
  29. package/_cjs/Channel/UpstreamPullRequest.cjs +2 -2
  30. package/_cjs/Channel/UpstreamPullStrategy.cjs +1 -1
  31. package/_cjs/Channel/api/interruptWhen.cjs +1 -1
  32. package/_cjs/Channel/api/interruptWhen.cjs.map +1 -1
  33. package/_cjs/Channel/api/mapOutIOC.cjs +1 -1
  34. package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
  35. package/_cjs/Channel/api/mergeAllWith.cjs +1 -1
  36. package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
  37. package/_cjs/Channel/api/mergeWith.cjs +6 -6
  38. package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
  39. package/_cjs/Channel/api.cjs +14 -14
  40. package/_cjs/Channel/api.cjs.map +1 -1
  41. package/_cjs/Channel/core-api.cjs +1 -1
  42. package/_cjs/Channel/internal/ChannelExecutor.cjs +2 -2
  43. package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
  44. package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +8 -7
  45. package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
  46. package/_cjs/Channel.cjs +3 -3
  47. package/_cjs/Clock/api.cjs.map +1 -1
  48. package/_cjs/Clock/live.cjs +1 -1
  49. package/_cjs/Clock/live.cjs.map +1 -1
  50. package/_cjs/Clock.cjs +3 -3
  51. package/_cjs/Console.cjs +3 -3
  52. package/_cjs/Fiber/FiberContext.cjs +57 -56
  53. package/_cjs/Fiber/FiberContext.cjs.map +1 -1
  54. package/_cjs/Fiber/api/interruptFork.cjs +1 -1
  55. package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
  56. package/_cjs/Fiber.cjs +23 -23
  57. package/_cjs/FiberRef/constructors.cjs +1 -1
  58. package/_cjs/FiberRef/constructors.cjs.map +1 -1
  59. package/_cjs/FiberRef.cjs +5 -5
  60. package/_cjs/FiberRefs/join.cjs +2 -2
  61. package/_cjs/FiberRefs/join.cjs.map +1 -1
  62. package/_cjs/FiberRefs.cjs +3 -3
  63. package/_cjs/FiberScope.cjs +2 -2
  64. package/_cjs/FiberState/constructors.cjs +1 -1
  65. package/_cjs/FiberState.cjs +3 -3
  66. package/_cjs/FiberStatus/constructors.cjs +1 -1
  67. package/_cjs/FiberStatus.cjs +2 -2
  68. package/_cjs/Future.cjs +3 -3
  69. package/_cjs/Hub.cjs +2 -2
  70. package/_cjs/IO/api/asyncIO.cjs +37 -0
  71. package/_cjs/IO/api/asyncIO.cjs.map +1 -0
  72. package/_cjs/IO/api/core-scope.cjs +1 -1
  73. package/_cjs/IO/api/ensuringChildren.cjs +24 -0
  74. package/_cjs/IO/api/ensuringChildren.cjs.map +1 -0
  75. package/_cjs/IO/api/interrupt.cjs +5 -5
  76. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  77. package/_cjs/IO/api/sleep.cjs.map +1 -1
  78. package/_cjs/IO/api/timeout.cjs +42 -0
  79. package/_cjs/IO/api/timeout.cjs.map +1 -0
  80. package/_cjs/IO/api.cjs +41 -40
  81. package/_cjs/IO/api.cjs.map +1 -1
  82. package/_cjs/IO/definition.cjs +9 -6
  83. package/_cjs/IO/definition.cjs.map +1 -1
  84. package/_cjs/IO/runtime.cjs +1 -1
  85. package/_cjs/IO/runtime.cjs.map +1 -1
  86. package/_cjs/IO.cjs +86 -47
  87. package/_cjs/IO.cjs.map +1 -1
  88. package/_cjs/IOEnv.cjs +3 -3
  89. package/_cjs/InterruptStatus.cjs +2 -2
  90. package/_cjs/Layer/api.cjs +5 -3
  91. package/_cjs/Layer/api.cjs.map +1 -1
  92. package/_cjs/Layer.cjs +3 -3
  93. package/_cjs/Logger.cjs +3 -3
  94. package/_cjs/Queue/api.cjs +7 -7
  95. package/_cjs/Queue.cjs +5 -5
  96. package/_cjs/Random.cjs +3 -3
  97. package/_cjs/Ref/Atomic/Atomic.cjs +3 -3
  98. package/_cjs/Ref/Atomic/api.cjs +10 -6
  99. package/_cjs/Ref/Atomic/api.cjs.map +1 -1
  100. package/_cjs/Ref/Atomic.cjs +2 -2
  101. package/_cjs/Ref/Derived.cjs +2 -2
  102. package/_cjs/Ref/DerivedAll.cjs +1 -1
  103. package/_cjs/Ref/Synchronized/api.cjs +1 -1
  104. package/_cjs/Ref/Synchronized/constructors.cjs +1 -1
  105. package/_cjs/Ref/Synchronized/definition.cjs +1 -1
  106. package/_cjs/Ref/api/get.cjs +1 -1
  107. package/_cjs/Ref/api/match.cjs +1 -1
  108. package/_cjs/Ref/api/matchAll.cjs +1 -1
  109. package/_cjs/Ref/api/modify.cjs +1 -1
  110. package/_cjs/Ref/api/set.cjs +1 -1
  111. package/_cjs/Ref/api.cjs +8 -8
  112. package/_cjs/Ref/constructors.cjs +1 -1
  113. package/_cjs/Ref.cjs +9 -9
  114. package/_cjs/STM/api/core-api.cjs +1 -1
  115. package/_cjs/STM/api/core-constructors.cjs +1 -1
  116. package/_cjs/STM/api.cjs +2 -2
  117. package/_cjs/STM/driver.cjs +1 -1
  118. package/_cjs/STM/internal/Entry.cjs +1 -1
  119. package/_cjs/STM/internal/Journal.cjs +2 -2
  120. package/_cjs/STM.cjs +5 -5
  121. package/_cjs/Schedule/Decision.cjs.map +1 -1
  122. package/_cjs/Schedule/api/driver.cjs +11 -9
  123. package/_cjs/Schedule/api/driver.cjs.map +1 -1
  124. package/_cjs/Schedule/api.cjs +49 -49
  125. package/_cjs/Schedule/api.cjs.map +1 -1
  126. package/_cjs/Schedule.cjs +4 -17
  127. package/_cjs/Schedule.cjs.map +1 -1
  128. package/_cjs/Scope/Finalizer/definition.cjs +6 -4
  129. package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
  130. package/_cjs/Scope/Finalizer.cjs +1 -1
  131. package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -1
  132. package/_cjs/Scope/ReleaseMap/api.cjs +1 -1
  133. package/_cjs/Scope/ReleaseMap/constructors.cjs +1 -1
  134. package/_cjs/Scope/ReleaseMap/definition.cjs +4 -2
  135. package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
  136. package/_cjs/Scope/ReleaseMap.cjs +3 -3
  137. package/_cjs/Scope/api.cjs +1 -1
  138. package/_cjs/Scope.cjs +2 -2
  139. package/_cjs/ScopedRef.cjs +2 -2
  140. package/_cjs/Sink/api.cjs +1 -1
  141. package/_cjs/Sink/api.cjs.map +1 -1
  142. package/_cjs/Sink.cjs +2 -2
  143. package/_cjs/State/api.cjs +2 -2
  144. package/_cjs/State/definition.cjs +1 -1
  145. package/_cjs/State.cjs +2 -2
  146. package/_cjs/Stream/api/zipAllWith.cjs +1 -1
  147. package/_cjs/Stream/api/zipWith.cjs +1 -1
  148. package/_cjs/Stream/api.cjs +308 -308
  149. package/_cjs/Stream/api.cjs.map +1 -1
  150. package/_cjs/Stream/internal/DebounceState.cjs.map +1 -1
  151. package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
  152. package/_cjs/Stream/internal/SinkEndReason.cjs +2 -37
  153. package/_cjs/Stream/internal/SinkEndReason.cjs.map +1 -1
  154. package/_cjs/Stream.cjs +2 -2
  155. package/_cjs/Supervisor/constructors.cjs +1 -1
  156. package/_cjs/Supervisor.cjs +3 -3
  157. package/_cjs/TExit/constructors.cjs +1 -1
  158. package/_cjs/TExit.cjs +2 -2
  159. package/_cjs/TFuture/definition.cjs +4 -2
  160. package/_cjs/TFuture/definition.cjs.map +1 -1
  161. package/_cjs/TFuture.cjs +3 -3
  162. package/_cjs/TRef/api.cjs +2 -2
  163. package/_cjs/TRef/constructors.cjs +3 -3
  164. package/_cjs/TRef.cjs +3 -3
  165. package/_cjs/TSemaphore/api.cjs +1 -1
  166. package/_cjs/TSemaphore/definition.cjs +4 -2
  167. package/_cjs/TSemaphore/definition.cjs.map +1 -1
  168. package/_cjs/TSemaphore.cjs +3 -3
  169. package/_cjs/collection/immutable/Conc.cjs +3 -3
  170. package/_mjs/Channel/api/interruptWhen.mjs +1 -1
  171. package/_mjs/Channel/api/interruptWhen.mjs.map +1 -1
  172. package/_mjs/Channel/api/mapOutIOC.mjs +1 -1
  173. package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
  174. package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
  175. package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
  176. package/_mjs/Channel/api/mergeWith.mjs +6 -6
  177. package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
  178. package/_mjs/Channel/api.mjs +14 -14
  179. package/_mjs/Channel/api.mjs.map +1 -1
  180. package/_mjs/Channel/internal/ChannelExecutor.mjs +2 -2
  181. package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
  182. package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs +8 -7
  183. package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs.map +1 -1
  184. package/_mjs/Clock/api.mjs.map +1 -1
  185. package/_mjs/Clock/live.mjs +1 -1
  186. package/_mjs/Clock/live.mjs.map +1 -1
  187. package/_mjs/Fiber/FiberContext.mjs +57 -56
  188. package/_mjs/Fiber/FiberContext.mjs.map +1 -1
  189. package/_mjs/Fiber/api/interruptFork.mjs +1 -1
  190. package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
  191. package/_mjs/FiberRef/constructors.mjs +1 -1
  192. package/_mjs/FiberRef/constructors.mjs.map +1 -1
  193. package/_mjs/FiberRefs/join.mjs +2 -2
  194. package/_mjs/FiberRefs/join.mjs.map +1 -1
  195. package/_mjs/IO/api/asyncIO.mjs +20 -0
  196. package/_mjs/IO/api/asyncIO.mjs.map +1 -0
  197. package/_mjs/IO/api/ensuringChildren.mjs +11 -0
  198. package/_mjs/IO/api/ensuringChildren.mjs.map +1 -0
  199. package/_mjs/IO/api/interrupt.mjs +4 -4
  200. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  201. package/_mjs/IO/api/sleep.mjs.map +1 -1
  202. package/_mjs/IO/api/timeout.mjs +23 -0
  203. package/_mjs/IO/api/timeout.mjs.map +1 -0
  204. package/_mjs/IO/api.mjs +41 -40
  205. package/_mjs/IO/api.mjs.map +1 -1
  206. package/_mjs/IO/definition.mjs +6 -4
  207. package/_mjs/IO/definition.mjs.map +1 -1
  208. package/_mjs/IO/runtime.mjs +1 -1
  209. package/_mjs/IO/runtime.mjs.map +1 -1
  210. package/_mjs/IO.mjs +3 -0
  211. package/_mjs/IO.mjs.map +1 -1
  212. package/_mjs/Layer/api.mjs +4 -3
  213. package/_mjs/Layer/api.mjs.map +1 -1
  214. package/_mjs/Ref/Atomic/api.mjs +10 -6
  215. package/_mjs/Ref/Atomic/api.mjs.map +1 -1
  216. package/_mjs/Schedule/Decision.mjs.map +1 -1
  217. package/_mjs/Schedule/api/driver.mjs +10 -9
  218. package/_mjs/Schedule/api/driver.mjs.map +1 -1
  219. package/_mjs/Schedule/api.mjs +49 -49
  220. package/_mjs/Schedule/api.mjs.map +1 -1
  221. package/_mjs/Schedule.mjs +0 -1
  222. package/_mjs/Schedule.mjs.map +1 -1
  223. package/_mjs/Scope/Finalizer/definition.mjs +5 -4
  224. package/_mjs/Scope/Finalizer/definition.mjs.map +1 -1
  225. package/_mjs/Scope/ReleaseMap/definition.mjs +3 -2
  226. package/_mjs/Scope/ReleaseMap/definition.mjs.map +1 -1
  227. package/_mjs/Sink/api.mjs +1 -1
  228. package/_mjs/Sink/api.mjs.map +1 -1
  229. package/_mjs/Stream/api.mjs +308 -302
  230. package/_mjs/Stream/api.mjs.map +1 -1
  231. package/_mjs/Stream/internal/DebounceState.mjs.map +1 -1
  232. package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
  233. package/_mjs/Stream/internal/SinkEndReason.mjs +1 -30
  234. package/_mjs/Stream/internal/SinkEndReason.mjs.map +1 -1
  235. package/_mjs/TFuture/definition.mjs +3 -2
  236. package/_mjs/TFuture/definition.mjs.map +1 -1
  237. package/_mjs/TSemaphore/definition.mjs +3 -2
  238. package/_mjs/TSemaphore/definition.mjs.map +1 -1
  239. package/_src/Channel/api.ts +3 -3
  240. package/_src/Channel/internal/ChannelExecutor.ts +2 -2
  241. package/_src/Channel/internal/SingleProducerAsyncInput.ts +1 -0
  242. package/_src/Clock/api.ts +1 -1
  243. package/_src/Clock/definition.ts +1 -1
  244. package/_src/Clock/live.ts +2 -2
  245. package/_src/Fiber/FiberContext.ts +3 -2
  246. package/_src/Fiber/api/interruptFork.ts +1 -1
  247. package/_src/FiberRef/constructors.ts +1 -1
  248. package/_src/FiberRefs/join.ts +2 -2
  249. package/_src/IO/api/asyncIO.ts +16 -0
  250. package/_src/IO/api/ensuringChildren.ts +11 -0
  251. package/_src/IO/api/interrupt.ts +2 -1
  252. package/_src/IO/api/sequenceT.ts +1 -1
  253. package/_src/IO/api/sleep.ts +1 -1
  254. package/_src/IO/api/timeout.ts +19 -0
  255. package/_src/IO/api.ts +6 -4
  256. package/_src/IO/definition.ts +8 -4
  257. package/_src/IO.ts +3 -0
  258. package/_src/Layer/api.ts +1 -1
  259. package/_src/Ref/Atomic/api.ts +4 -0
  260. package/_src/Schedule/Decision.ts +0 -2
  261. package/_src/Schedule/api/driver.ts +1 -1
  262. package/_src/Schedule/api.ts +0 -3
  263. package/_src/Schedule.ts +0 -1
  264. package/_src/Scope/Finalizer/definition.ts +1 -1
  265. package/_src/Scope/ReleaseMap/definition.ts +1 -1
  266. package/_src/Stream/api.ts +199 -134
  267. package/_src/Stream/internal/DebounceState.ts +2 -2
  268. package/_src/Stream/internal/Handoff.ts +9 -9
  269. package/_src/Stream/internal/SinkEndReason.ts +7 -25
  270. package/_src/TFuture/definition.ts +2 -2
  271. package/_src/TSemaphore/definition.ts +1 -1
  272. package/package.json +5 -5
  273. package/runTests.d.ts +1 -0
  274. package/Schedule/Interval.d.ts +0 -71
  275. package/_cjs/Schedule/Interval.cjs +0 -154
  276. package/_cjs/Schedule/Interval.cjs.map +0 -1
  277. package/_mjs/Schedule/Interval.mjs +0 -114
  278. package/_mjs/Schedule/Interval.mjs.map +0 -1
  279. package/_src/Schedule/Interval.ts +0 -103
@@ -23,7 +23,7 @@ export const CurrentTag = Symbol();
23
23
  export type CurrentTag = typeof CurrentTag;
24
24
  export class Current<E, A> {
25
25
  readonly _tag = DebounceStateTag.Current;
26
- constructor(readonly fiber: Fiber<E, HandoffSignal<void, E, A>>) {}
26
+ constructor(readonly fiber: Fiber<E, HandoffSignal<E, A>>) {}
27
27
  }
28
28
 
29
29
  /**
@@ -53,7 +53,7 @@ export function previous<A>(fiber: Fiber<never, Conc<A>>): DebounceState<never,
53
53
  /**
54
54
  * @tsplus static fncts.io.Stream.DebounceStateOps Current
55
55
  */
56
- export function current<E, A>(fiber: Fiber<E, HandoffSignal<void, E, A>>): DebounceState<E, A> {
56
+ export function current<E, A>(fiber: Fiber<E, HandoffSignal<E, A>>): DebounceState<E, A> {
57
57
  return new Current(fiber);
58
58
  }
59
59
 
@@ -112,17 +112,17 @@ export class Halt<E> {
112
112
 
113
113
  export const EndTypeId = Symbol("fncts.io.Stream.HandoffSignal.End");
114
114
  export type EndTypeId = typeof EndTypeId;
115
- export class End<C> {
115
+ export class End {
116
116
  readonly _typeId: typeof HandoffSignalTypeId = HandoffSignalTypeId;
117
117
  readonly _tag: typeof EndTypeId = EndTypeId;
118
118
 
119
- constructor(readonly reason: SinkEndReason<C>) {}
119
+ constructor(readonly reason: SinkEndReason) {}
120
120
  }
121
121
 
122
122
  /**
123
123
  * @tsplus type fncts.io.Stream.HandoffSignal
124
124
  */
125
- export type HandoffSignal<C, E, A> = Emit<A> | Halt<E> | End<C>;
125
+ export type HandoffSignal<E, A> = Emit<A> | Halt<E> | End;
126
126
 
127
127
  /**
128
128
  * @tsplus type fncts.io.Stream.HandoffSignalOps
@@ -134,33 +134,33 @@ export const HandoffSignal: HandoffSignalOps = {};
134
134
  /**
135
135
  * @tsplus static fncts.io.Stream.HandoffSignalOps Emit
136
136
  */
137
- export function emit<A>(els: Conc<A>): HandoffSignal<never, never, A> {
137
+ export function emit<A>(els: Conc<A>): HandoffSignal<never, A> {
138
138
  return new Emit(els);
139
139
  }
140
140
 
141
141
  /**
142
142
  * @tsplus static fncts.io.Stream.HandoffSignalOps Halt
143
143
  */
144
- export function halt<E>(error: Cause<E>): HandoffSignal<never, E, never> {
144
+ export function halt<E>(error: Cause<E>): HandoffSignal<E, never> {
145
145
  return new Halt(error);
146
146
  }
147
147
 
148
148
  /**
149
149
  * @tsplus static fncts.io.Stream.HandoffSignalOps End
150
150
  */
151
- export function end<C>(reason: SinkEndReason<C>): HandoffSignal<C, never, never> {
151
+ export function end<C>(reason: SinkEndReason): HandoffSignal<never, never> {
152
152
  return new End(reason);
153
153
  }
154
154
 
155
155
  /**
156
156
  * @tsplus fluent fncts.io.Stream.HandoffSignal match
157
157
  */
158
- export function matchSignal_<C, E, A, B, D, F>(
159
- signal: HandoffSignal<C, E, A>,
158
+ export function matchSignal_<E, A, B, D, F>(
159
+ signal: HandoffSignal<E, A>,
160
160
  cases: {
161
161
  Emit: (_: Emit<A>) => B;
162
162
  Halt: (_: Halt<E>) => D;
163
- End: (_: End<C>) => F;
163
+ End: (_: End) => F;
164
164
  },
165
165
  ): B | D | F {
166
166
  switch (signal._tag) {
@@ -7,21 +7,9 @@ export const enum SinkEndReasonTag {
7
7
 
8
8
  export const SinkEndReasonTypeId = Symbol.for("fncts.io.Stream.SinkEndReason");
9
9
 
10
- export class SinkEnd {
11
- readonly _typeId: typeof SinkEndReasonTypeId = SinkEndReasonTypeId;
12
- readonly _tag = SinkEndReasonTag.SinkEnd;
13
- }
14
-
15
- export class ScheduleTimeout {
16
- readonly _typeId: typeof SinkEndReasonTypeId = SinkEndReasonTypeId;
17
- readonly _tag = SinkEndReasonTag.ScheduleTimeout;
18
- }
19
-
20
- export class ScheduleEnd<C> {
10
+ export class ScheduleEnd {
21
11
  readonly _typeId: typeof SinkEndReasonTypeId = SinkEndReasonTypeId;
22
12
  readonly _tag = SinkEndReasonTag.ScheduleEnd;
23
-
24
- constructor(readonly c: C) {}
25
13
  }
26
14
 
27
15
  export class UpstreamEnd {
@@ -32,25 +20,19 @@ export class UpstreamEnd {
32
20
  /**
33
21
  * @tsplus type fncts.io.Stream.SinkEndReason
34
22
  */
35
- export type SinkEndReason<C> = SinkEnd | ScheduleTimeout | ScheduleEnd<C> | UpstreamEnd;
23
+ export type SinkEndReason = ScheduleEnd | UpstreamEnd;
36
24
 
37
25
  /**
38
26
  * @tsplus fluent fncts.io.Stream.SinkEndReason match
39
27
  */
40
- export function matchSinkEndReason_<A, B, C, D, E>(
41
- self: SinkEndReason<A>,
28
+ export function matchSinkEndReason_<A, B>(
29
+ self: SinkEndReason,
42
30
  cases: {
43
- SinkEnd: (_: SinkEnd) => B;
44
- ScheduleTimeout: (_: ScheduleTimeout) => C;
45
- ScheduleEnd: (_: ScheduleEnd<A>) => D;
46
- UpstreamEnd: (_: UpstreamEnd) => E;
31
+ ScheduleEnd: (_: ScheduleEnd) => A;
32
+ UpstreamEnd: (_: UpstreamEnd) => B;
47
33
  },
48
- ): B | C | D | E {
34
+ ): A | B {
49
35
  switch (self._tag) {
50
- case SinkEndReasonTag.SinkEnd:
51
- return cases.SinkEnd(self);
52
- case SinkEndReasonTag.ScheduleTimeout:
53
- return cases.ScheduleTimeout(self);
54
36
  case SinkEndReasonTag.ScheduleEnd:
55
37
  return cases.ScheduleEnd(self);
56
38
  case SinkEndReasonTag.UpstreamEnd:
@@ -1,7 +1,7 @@
1
1
  import type { UTRef } from "../TRef.js";
2
2
 
3
3
  interface TFutureN extends HKT {
4
- readonly type: TFuture<this["E"], this["A"]>;
4
+ readonly [HKT.T]: TFuture<HKT._E<this>, HKT._A<this>>;
5
5
  }
6
6
 
7
7
  /**
@@ -20,4 +20,4 @@ export interface TFuture<E, A>
20
20
  */
21
21
  export interface TFutureOps extends NewtypeIso<TFutureN> {}
22
22
 
23
- export const TFuture: TFutureOps = Newtype<TFutureN>();
23
+ export const TFuture: TFutureOps = Newtype<TFutureN>();
@@ -1,5 +1,5 @@
1
1
  interface TSemaphoreN extends HKT {
2
- readonly type: TSemaphore;
2
+ readonly [HKT.T]: TSemaphore;
3
3
  }
4
4
 
5
5
  /**
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@fncts/io",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "dependencies": {
5
- "@fncts/base": "0.0.1",
6
- "@fncts/typelevel": "0.0.1"
5
+ "@fncts/base": "0.0.4",
6
+ "@fncts/typelevel": "0.0.4"
7
7
  },
8
8
  "exports": {
9
9
  "./*": {
10
- "import": "./_mjs/*",
11
- "require": "./_cjs/*"
10
+ "import": "./_mjs/*.mjs",
11
+ "require": "./_cjs/*.cjs"
12
12
  }
13
13
  },
14
14
  "publishConfig": {
package/runTests.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,71 +0,0 @@
1
- import { Maybe } from "@fncts/base/data/Maybe";
2
- /**
3
- * @tsplus type fncts.io.Schedule.Interval
4
- * @tsplus companion fncts.io.Schedule.IntervalOps
5
- */
6
- export declare class Interval {
7
- readonly startMilliseconds: number;
8
- readonly endMilliseconds: number;
9
- constructor(startMilliseconds: number, endMilliseconds: number);
10
- }
11
- /**
12
- * @tsplus static fncts.io.Schedule.IntervalOps after
13
- * @tsplus location "@fncts/io/Schedule/Interval"
14
- */
15
- export declare function after(start: number): Interval;
16
- /**
17
- * @tsplus static fncts.io.Schedule.IntervalOps before
18
- * @tsplus location "@fncts/io/Schedule/Interval"
19
- */
20
- export declare function before(end: number): Interval;
21
- /**
22
- * @tsplus static fncts.io.Schedule.IntervalOps empty
23
- * @tsplus location "@fncts/io/Schedule/Interval"
24
- */
25
- export declare const empty: Interval;
26
- /**
27
- * @tsplus getter fncts.io.Schedule.Interval isEmpty
28
- * @tsplus location "@fncts/io/Schedule/Interval"
29
- */
30
- export declare function isEmpty(self: Interval): boolean;
31
- /**
32
- * @tsplus fluent fncts.io.Schedule.Interval intersect
33
- * @tsplus location "@fncts/io/Schedule/Interval"
34
- */
35
- export declare function intersect_(self: Interval, that: Interval): Interval;
36
- /**
37
- * @tsplus fluent fncts.io.Schedule.Interval lt
38
- * @tsplus operator fncts.io.Schedule.Interval <
39
- * @tsplus location "@fncts/io/Schedule/Interval"
40
- */
41
- export declare function lt_(self: Interval, that: Interval): boolean;
42
- /**
43
- * @tsplus static fncts.io.Schedule.IntervalOps __call
44
- * @tsplus location "@fncts/io/Schedule/Interval"
45
- */
46
- export declare function makeInterval(start: number, end: number): Interval;
47
- /**
48
- * @tsplus fluent fncts.io.Schedule.Interval max
49
- * @tsplus location "@fncts/io/Schedule/Interval"
50
- */
51
- export declare function max_(self: Interval, that: Interval): Interval;
52
- /**
53
- * @tsplus fluent fncts.io.Schedule.Interval min
54
- * @tsplus location "@fncts/io/Schedule/Interval"
55
- */
56
- export declare function min_(self: Interval, that: Interval): Interval;
57
- /**
58
- * @tsplus getter fncts.io.Schedule.Interval isNonEmpty
59
- * @tsplus location "@fncts/io/Schedule/Interval"
60
- */
61
- export declare function isNonEmpty(self: Interval): boolean;
62
- /**
63
- * @tsplus getter fncts.io.Schedule.Interval size
64
- * @tsplus location "@fncts/io/Schedule/Interval"
65
- */
66
- export declare function size(self: Interval): number;
67
- /**
68
- * @tsplus fluent fncts.io.Schedule.Interval union
69
- * @tsplus location "@fncts/io/Schedule/Interval"
70
- */
71
- export declare function union_(self: Interval, that: Interval): Maybe<Interval>;
@@ -1,154 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Interval = void 0;
7
- exports.after = after;
8
- exports.before = before;
9
- exports.empty = void 0;
10
- exports.intersect_ = intersect_;
11
- exports.isEmpty = void 0;
12
- exports.isNonEmpty = isNonEmpty;
13
- exports.lt_ = lt_;
14
- exports.makeInterval = void 0;
15
- exports.max_ = max_;
16
- exports.min_ = void 0;
17
- exports.size = size;
18
- exports.union_ = union_;
19
-
20
- var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- const isEmpty = isEmpty_1;
27
- exports.isEmpty = isEmpty;
28
- const makeInterval = makeInterval_1;
29
- exports.makeInterval = makeInterval;
30
- const min_ = min_1;
31
- /**
32
- * @tsplus type fncts.io.Schedule.Interval
33
- * @tsplus companion fncts.io.Schedule.IntervalOps
34
- */
35
-
36
- exports.min_ = min_;
37
-
38
- class Interval {
39
- constructor(startMilliseconds, endMilliseconds) {
40
- this.startMilliseconds = startMilliseconds;
41
- this.endMilliseconds = endMilliseconds;
42
- }
43
-
44
- }
45
- /**
46
- * @tsplus static fncts.io.Schedule.IntervalOps after
47
- */
48
-
49
-
50
- exports.Interval = Interval;
51
-
52
- function after(start) {
53
- return makeInterval_1(start, Number.MAX_SAFE_INTEGER);
54
- }
55
- /**
56
- * @tsplus static fncts.io.Schedule.IntervalOps before
57
- */
58
-
59
-
60
- function before(end) {
61
- return makeInterval_1(Number.MIN_SAFE_INTEGER, end);
62
- }
63
- /**
64
- * @tsplus static fncts.io.Schedule.IntervalOps empty
65
- */
66
-
67
-
68
- const empty_1 = /*#__PURE__*/new Interval(Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);
69
- const empty = empty_1;
70
- /**
71
- * @tsplus getter fncts.io.Schedule.Interval isEmpty
72
- */
73
-
74
- exports.empty = empty;
75
-
76
- function isEmpty_1(self) {
77
- return self.startMilliseconds >= self.endMilliseconds;
78
- }
79
- /**
80
- * @tsplus fluent fncts.io.Schedule.Interval intersect
81
- */
82
-
83
-
84
- function intersect_(self, that) {
85
- const start = Math.max(self.startMilliseconds, that.startMilliseconds);
86
- const end = Math.min(self.endMilliseconds, that.endMilliseconds);
87
- return makeInterval_1(start, end);
88
- }
89
- /**
90
- * @tsplus fluent fncts.io.Schedule.Interval lt
91
- * @tsplus operator fncts.io.Schedule.Interval <
92
- */
93
-
94
-
95
- function lt_(self, that) {
96
- return min_1(self, that) === self;
97
- }
98
- /**
99
- * @tsplus static fncts.io.Schedule.IntervalOps __call
100
- */
101
-
102
-
103
- function makeInterval_1(start, end) {
104
- if (start <= end) return makeInterval_1(start, end);else return empty_1;
105
- }
106
- /**
107
- * @tsplus fluent fncts.io.Schedule.Interval max
108
- */
109
-
110
-
111
- function max_(self, that) {
112
- const m = min_1(self, that);
113
- if (m === self) return that;else return self;
114
- }
115
- /**
116
- * @tsplus fluent fncts.io.Schedule.Interval min
117
- */
118
-
119
-
120
- function min_1(self, that) {
121
- if (self.endMilliseconds <= that.startMilliseconds) return self;
122
- if (that.endMilliseconds <= self.startMilliseconds) return that;
123
- if (self.startMilliseconds < that.startMilliseconds) return self;
124
- if (that.startMilliseconds < self.startMilliseconds) return that;
125
- if (self.endMilliseconds <= that.endMilliseconds) return self;
126
- return that;
127
- }
128
- /**
129
- * @tsplus getter fncts.io.Schedule.Interval isNonEmpty
130
- */
131
-
132
-
133
- function isNonEmpty(self) {
134
- return !isEmpty_1(self);
135
- }
136
- /**
137
- * @tsplus getter fncts.io.Schedule.Interval size
138
- */
139
-
140
-
141
- function size(self) {
142
- return self.endMilliseconds - self.startMilliseconds;
143
- }
144
- /**
145
- * @tsplus fluent fncts.io.Schedule.Interval union
146
- */
147
-
148
-
149
- function union_(self, that) {
150
- const istart = Math.max(self.startMilliseconds, that.startMilliseconds);
151
- const iend = Math.min(self.endMilliseconds, that.endMilliseconds);
152
- if (istart <= iend) return tsplus_module_1.nothing();else return tsplus_module_1.just(makeInterval_1(istart, iend));
153
- }
154
- //# sourceMappingURL=Interval.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Interval.cjs","mappings":";;;;;;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ACK,OAAOA,qBAAKvB,eAASqB,MAAT,EAAiBC,IAAjB,CAAL,CAAP;AACN","names":["isEmpty","makeInterval","min_","Interval","constructor","startMilliseconds","endMilliseconds","after","start","makeInterval_1","Number","MAX_SAFE_INTEGER","before","end","MIN_SAFE_INTEGER","empty_1","empty","self","intersect_","that","Math","max","min","lt_","min_1","max_","m","isNonEmpty","size","union_","istart","iend","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/Schedule/Interval.ts"],"sourcesContent":[null]}
@@ -1,114 +0,0 @@
1
- import * as tsplus_module_1 from "@fncts/base/data/Maybe/constructors";
2
- export const isEmpty = isEmpty_1;
3
- export const makeInterval = makeInterval_1;
4
- export const min_ = min_1;
5
- /**
6
- * @tsplus type fncts.io.Schedule.Interval
7
- * @tsplus companion fncts.io.Schedule.IntervalOps
8
- */
9
-
10
- export class Interval {
11
- constructor(startMilliseconds, endMilliseconds) {
12
- this.startMilliseconds = startMilliseconds;
13
- this.endMilliseconds = endMilliseconds;
14
- }
15
-
16
- }
17
- /**
18
- * @tsplus static fncts.io.Schedule.IntervalOps after
19
- */
20
-
21
- export function after(start) {
22
- return makeInterval_1(start, Number.MAX_SAFE_INTEGER);
23
- }
24
- /**
25
- * @tsplus static fncts.io.Schedule.IntervalOps before
26
- */
27
-
28
- export function before(end) {
29
- return makeInterval_1(Number.MIN_SAFE_INTEGER, end);
30
- }
31
- /**
32
- * @tsplus static fncts.io.Schedule.IntervalOps empty
33
- */
34
-
35
- const empty_1 = /*#__PURE__*/new Interval(Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);
36
- export const empty = empty_1;
37
- /**
38
- * @tsplus getter fncts.io.Schedule.Interval isEmpty
39
- */
40
-
41
- function isEmpty_1(self) {
42
- return self.startMilliseconds >= self.endMilliseconds;
43
- }
44
- /**
45
- * @tsplus fluent fncts.io.Schedule.Interval intersect
46
- */
47
-
48
-
49
- export function intersect_(self, that) {
50
- const start = Math.max(self.startMilliseconds, that.startMilliseconds);
51
- const end = Math.min(self.endMilliseconds, that.endMilliseconds);
52
- return makeInterval_1(start, end);
53
- }
54
- /**
55
- * @tsplus fluent fncts.io.Schedule.Interval lt
56
- * @tsplus operator fncts.io.Schedule.Interval <
57
- */
58
-
59
- export function lt_(self, that) {
60
- return min_1(self, that) === self;
61
- }
62
- /**
63
- * @tsplus static fncts.io.Schedule.IntervalOps __call
64
- */
65
-
66
- function makeInterval_1(start, end) {
67
- if (start <= end) return makeInterval_1(start, end);else return empty_1;
68
- }
69
- /**
70
- * @tsplus fluent fncts.io.Schedule.Interval max
71
- */
72
-
73
-
74
- export function max_(self, that) {
75
- const m = min_1(self, that);
76
- if (m === self) return that;else return self;
77
- }
78
- /**
79
- * @tsplus fluent fncts.io.Schedule.Interval min
80
- */
81
-
82
- function min_1(self, that) {
83
- if (self.endMilliseconds <= that.startMilliseconds) return self;
84
- if (that.endMilliseconds <= self.startMilliseconds) return that;
85
- if (self.startMilliseconds < that.startMilliseconds) return self;
86
- if (that.startMilliseconds < self.startMilliseconds) return that;
87
- if (self.endMilliseconds <= that.endMilliseconds) return self;
88
- return that;
89
- }
90
- /**
91
- * @tsplus getter fncts.io.Schedule.Interval isNonEmpty
92
- */
93
-
94
-
95
- export function isNonEmpty(self) {
96
- return !isEmpty_1(self);
97
- }
98
- /**
99
- * @tsplus getter fncts.io.Schedule.Interval size
100
- */
101
-
102
- export function size(self) {
103
- return self.endMilliseconds - self.startMilliseconds;
104
- }
105
- /**
106
- * @tsplus fluent fncts.io.Schedule.Interval union
107
- */
108
-
109
- export function union_(self, that) {
110
- const istart = Math.max(self.startMilliseconds, that.startMilliseconds);
111
- const iend = Math.min(self.endMilliseconds, that.endMilliseconds);
112
- if (istart <= iend) return tsplus_module_1.nothing();else return tsplus_module_1.just(makeInterval_1(istart, iend));
113
- }
114
- //# sourceMappingURL=Interval.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Interval.mjs","mappings":";aA8BgBA,OAAO;aAwBPC,YAAY;aAiBZC,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,MAAT,EAAiBC,IAAjB,CAAL,CAAP;AACN","names":["isEmpty","makeInterval","min_","Interval","constructor","startMilliseconds","endMilliseconds","after","start","makeInterval_1","Number","MAX_SAFE_INTEGER","before","end","MIN_SAFE_INTEGER","empty_1","empty","self","intersect_","that","Math","max","min","lt_","min_1","max_","m","isNonEmpty","size","union_","istart","iend","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/Schedule/Interval.ts"],"sourcesContent":[null]}
@@ -1,103 +0,0 @@
1
- /**
2
- * @tsplus type fncts.io.Schedule.Interval
3
- * @tsplus companion fncts.io.Schedule.IntervalOps
4
- */
5
- export class Interval {
6
- constructor(readonly startMilliseconds: number, readonly endMilliseconds: number) {}
7
- }
8
-
9
- /**
10
- * @tsplus static fncts.io.Schedule.IntervalOps after
11
- */
12
- export function after(start: number): Interval {
13
- return Interval(start, Number.MAX_SAFE_INTEGER);
14
- }
15
-
16
- /**
17
- * @tsplus static fncts.io.Schedule.IntervalOps before
18
- */
19
- export function before(end: number): Interval {
20
- return Interval(Number.MIN_SAFE_INTEGER, end);
21
- }
22
-
23
- /**
24
- * @tsplus static fncts.io.Schedule.IntervalOps empty
25
- */
26
- export const empty: Interval = new Interval(Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);
27
-
28
- /**
29
- * @tsplus getter fncts.io.Schedule.Interval isEmpty
30
- */
31
- export function isEmpty(self: Interval): boolean {
32
- return self.startMilliseconds >= self.endMilliseconds;
33
- }
34
-
35
- /**
36
- * @tsplus fluent fncts.io.Schedule.Interval intersect
37
- */
38
- export function intersect_(self: Interval, that: Interval): Interval {
39
- const start = Math.max(self.startMilliseconds, that.startMilliseconds);
40
- const end = Math.min(self.endMilliseconds, that.endMilliseconds);
41
- return Interval(start, end);
42
- }
43
-
44
- /**
45
- * @tsplus fluent fncts.io.Schedule.Interval lt
46
- * @tsplus operator fncts.io.Schedule.Interval <
47
- */
48
- export function lt_(self: Interval, that: Interval): boolean {
49
- return self.min(that) === self;
50
- }
51
-
52
- /**
53
- * @tsplus static fncts.io.Schedule.IntervalOps __call
54
- */
55
- export function makeInterval(start: number, end: number): Interval {
56
- if (start <= end) return Interval(start, end);
57
- else return Interval.empty;
58
- }
59
-
60
- /**
61
- * @tsplus fluent fncts.io.Schedule.Interval max
62
- */
63
- export function max_(self: Interval, that: Interval): Interval {
64
- const m = self.min(that);
65
- if (m === self) return that;
66
- else return self;
67
- }
68
-
69
- /**
70
- * @tsplus fluent fncts.io.Schedule.Interval min
71
- */
72
- export function min_(self: Interval, that: Interval): Interval {
73
- if (self.endMilliseconds <= that.startMilliseconds) return self;
74
- if (that.endMilliseconds <= self.startMilliseconds) return that;
75
- if (self.startMilliseconds < that.startMilliseconds) return self;
76
- if (that.startMilliseconds < self.startMilliseconds) return that;
77
- if (self.endMilliseconds <= that.endMilliseconds) return self;
78
- return that;
79
- }
80
-
81
- /**
82
- * @tsplus getter fncts.io.Schedule.Interval isNonEmpty
83
- */
84
- export function isNonEmpty(self: Interval): boolean {
85
- return !self.isEmpty;
86
- }
87
-
88
- /**
89
- * @tsplus getter fncts.io.Schedule.Interval size
90
- */
91
- export function size(self: Interval): number {
92
- return self.endMilliseconds - self.startMilliseconds;
93
- }
94
-
95
- /**
96
- * @tsplus fluent fncts.io.Schedule.Interval union
97
- */
98
- export function union_(self: Interval, that: Interval): Maybe<Interval> {
99
- const istart = Math.max(self.startMilliseconds, that.startMilliseconds);
100
- const iend = Math.min(self.endMilliseconds, that.endMilliseconds);
101
- if (istart <= iend) return Nothing();
102
- else return Just(Interval(istart, iend));
103
- }