effect 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.7.0";
1
+ let moduleVersion = "3.7.1";
2
2
  export const getCurrentVersion = () => moduleVersion;
3
3
  export const setCurrentVersion = version => {
4
4
  moduleVersion = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "The missing standard library for TypeScript, for writing production-grade software.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/Array.ts CHANGED
@@ -1255,7 +1255,8 @@ export const sortWith: {
1255
1255
  <A, B>(self: Iterable<A>, f: (a: A) => B, order: Order.Order<B>): Array<A>
1256
1256
  } = dual(
1257
1257
  3,
1258
- <A, B>(self: Iterable<A>, f: (a: A) => B, order: Order.Order<B>): Array<A> => sort(self, Order.mapInput(order, f))
1258
+ <A, B>(self: Iterable<A>, f: (a: A) => B, order: Order.Order<B>): Array<A> =>
1259
+ Array.from(self).map((a) => [a, f(a)] as const).sort((a, b) => order(a[1], b[1])).map((x) => x[0])
1259
1260
  )
1260
1261
 
1261
1262
  /**
package/src/Effect.ts CHANGED
@@ -1832,7 +1832,7 @@ export const catchSomeDefect: {
1832
1832
  export const catchTag: {
1833
1833
  <K extends E extends { _tag: string } ? E["_tag"] : never, E, A1, E1, R1>(
1834
1834
  k: K,
1835
- f: (e: Extract<E, { _tag: K }>) => Effect<A1, E1, R1>
1835
+ f: (e: NoInfer<Extract<E, { _tag: K }>>) => Effect<A1, E1, R1>
1836
1836
  ): <A, R>(self: Effect<A, E, R>) => Effect<A1 | A, E1 | Exclude<E, { _tag: K }>, R1 | R>
1837
1837
  <A, E, R, K extends E extends { _tag: string } ? E["_tag"] : never, R1, E1, A1>(
1838
1838
  self: Effect<A, E, R>,
@@ -4347,7 +4347,7 @@ export const tapError: {
4347
4347
  export const tapErrorTag: {
4348
4348
  <K extends E extends { _tag: string } ? E["_tag"] : never, E, A1, E1, R1>(
4349
4349
  k: K,
4350
- f: (e: Extract<E, { _tag: K }>) => Effect<A1, E1, R1>
4350
+ f: (e: NoInfer<Extract<E, { _tag: K }>>) => Effect<A1, E1, R1>
4351
4351
  ): <A, R>(self: Effect<A, E, R>) => Effect<A, E | E1, R1 | R>
4352
4352
  <A, E, R, K extends E extends { _tag: string } ? E["_tag"] : never, A1, E1, R1>(
4353
4353
  self: Effect<A, E, R>,
package/src/Micro.ts CHANGED
@@ -2594,9 +2594,11 @@ export const withTrace: {
2594
2594
  const f = (name: string) => (self: Micro<any, any, any>) =>
2595
2595
  unsafeMakeOptions(function(env, onExit) {
2596
2596
  self[runSymbol](env, function(exit) {
2597
+ console.log(name, exit)
2597
2598
  onExit(exit._tag === "Left" ? Either.left(generate(name, exit.left)) : exit)
2598
2599
  })
2599
2600
  }, false)
2601
+ console.log(arguments.length)
2600
2602
  if (arguments.length === 2) {
2601
2603
  return f(arguments[1])(arguments[0])
2602
2604
  }
@@ -3465,6 +3467,9 @@ export const forEach: {
3465
3467
  let result: MicroExit<any, any> | undefined = undefined
3466
3468
  const items = Array.from(iterable)
3467
3469
  let length = items.length
3470
+ if (length === 0) {
3471
+ return onExit(Either.right(options?.discard ? undefined : []))
3472
+ }
3468
3473
  const out: Array<B> | undefined = options?.discard ? undefined : new Array(length)
3469
3474
  let index = 0
3470
3475
  let inProgress = 0
@@ -3949,6 +3954,7 @@ export const runSyncExit = <A, E>(effect: Micro<A, E>): MicroExit<A, E> => {
3949
3954
  const handle = runFork(effect, { scheduler })
3950
3955
  scheduler.flush()
3951
3956
  const exit = handle.unsafePoll()
3957
+ console.log(exit)
3952
3958
  if (exit === null) {
3953
3959
  return exitDie(handle)
3954
3960
  }
@@ -2405,7 +2405,7 @@ export const either = <A, E, R>(self: Stream.Stream<A, E, R>): Stream.Stream<Eit
2405
2405
  pipe(self, map(Either.right), catchAll((error) => make(Either.left(error))))
2406
2406
 
2407
2407
  /** @internal */
2408
- export const empty: Stream.Stream<never> = new StreamImpl(core.write(Chunk.empty()))
2408
+ export const empty: Stream.Stream<never> = new StreamImpl(core.void)
2409
2409
 
2410
2410
  /** @internal */
2411
2411
  export const ensuring = dual<
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.7.0"
1
+ let moduleVersion = "3.7.1"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4