effect 3.4.4 → 3.4.6
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.
- package/dist/cjs/Match.js.map +1 -1
- package/dist/cjs/Micro.js +481 -425
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/internal/channel.js +5 -2
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +14 -11
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +4 -9
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/matcher.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Match.d.ts +16 -16
- package/dist/dts/Match.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +344 -260
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/internal/core-effect.d.ts.map +1 -1
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Micro.js +456 -402
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/internal/channel.js +5 -2
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/core-effect.js +11 -9
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +4 -9
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/matcher.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Match.ts +20 -20
- package/src/Micro.ts +715 -603
- package/src/internal/channel.ts +17 -19
- package/src/internal/core-effect.ts +14 -10
- package/src/internal/fiberRuntime.ts +4 -10
- package/src/internal/matcher.ts +20 -19
- package/src/internal/version.ts +1 -1
package/src/Match.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as internal from "./internal/matcher.js"
|
|
|
6
6
|
import type * as Option from "./Option.js"
|
|
7
7
|
import type { Pipeable } from "./Pipeable.js"
|
|
8
8
|
import * as Predicate from "./Predicate.js"
|
|
9
|
-
import type
|
|
9
|
+
import type * as T from "./Types.js"
|
|
10
10
|
import type { Unify } from "./Unify.js"
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -36,11 +36,11 @@ export type Matcher<Input, Filters, RemainingApplied, Result, Provided, Return =
|
|
|
36
36
|
export interface TypeMatcher<in Input, out Filters, out Remaining, out Result, out Return = any> extends Pipeable {
|
|
37
37
|
readonly _tag: "TypeMatcher"
|
|
38
38
|
readonly [MatcherTypeId]: {
|
|
39
|
-
readonly _input: Contravariant<Input>
|
|
40
|
-
readonly _filters: Covariant<Filters>
|
|
41
|
-
readonly _remaining: Covariant<Remaining>
|
|
42
|
-
readonly _result: Covariant<Result>
|
|
43
|
-
readonly _return: Covariant<Return>
|
|
39
|
+
readonly _input: T.Contravariant<Input>
|
|
40
|
+
readonly _filters: T.Covariant<Filters>
|
|
41
|
+
readonly _remaining: T.Covariant<Remaining>
|
|
42
|
+
readonly _result: T.Covariant<Result>
|
|
43
|
+
readonly _return: T.Covariant<Return>
|
|
44
44
|
}
|
|
45
45
|
readonly cases: ReadonlyArray<Case>
|
|
46
46
|
add<I, R, RA, A>(_case: Case): TypeMatcher<I, R, RA, A>
|
|
@@ -55,10 +55,10 @@ export interface ValueMatcher<in Input, Filters, out Remaining, out Result, Prov
|
|
|
55
55
|
{
|
|
56
56
|
readonly _tag: "ValueMatcher"
|
|
57
57
|
readonly [MatcherTypeId]: {
|
|
58
|
-
readonly _input: Contravariant<Input>
|
|
59
|
-
readonly _filters: Covariant<Filters>
|
|
60
|
-
readonly _result: Covariant<Result>
|
|
61
|
-
readonly _return: Covariant<Return>
|
|
58
|
+
readonly _input: T.Contravariant<Input>
|
|
59
|
+
readonly _filters: T.Covariant<Filters>
|
|
60
|
+
readonly _result: T.Covariant<Result>
|
|
61
|
+
readonly _return: T.Covariant<Return>
|
|
62
62
|
}
|
|
63
63
|
readonly provided: Provided
|
|
64
64
|
readonly value: Either.Either<Provided, Remaining>
|
|
@@ -140,7 +140,7 @@ export const typeTags: <I>() => <
|
|
|
140
140
|
*/
|
|
141
141
|
export const withReturnType: <Ret>() => <I, F, R, A, Pr, _>(
|
|
142
142
|
self: Matcher<I, F, R, A, Pr, _>
|
|
143
|
-
) => Ret extends
|
|
143
|
+
) => [Ret] extends [[A] extends [never] ? any : A] ? Matcher<I, F, R, A, Pr, Ret>
|
|
144
144
|
: "withReturnType constraint does not extend Result type" = internal.withReturnType
|
|
145
145
|
|
|
146
146
|
/**
|
|
@@ -196,15 +196,15 @@ export const whenAnd: <
|
|
|
196
196
|
R,
|
|
197
197
|
const P extends ReadonlyArray<Types.PatternPrimitive<R> | Types.PatternBase<R>>,
|
|
198
198
|
Ret,
|
|
199
|
-
Fn extends (_: Types.WhenMatch<R, UnionToIntersection<P[number]>>) => Ret
|
|
199
|
+
Fn extends (_: Types.WhenMatch<R, T.UnionToIntersection<P[number]>>) => Ret
|
|
200
200
|
>(
|
|
201
201
|
...args: [...patterns: P, f: Fn]
|
|
202
202
|
) => <I, F, A, Pr>(
|
|
203
203
|
self: Matcher<I, F, R, A, Pr, Ret>
|
|
204
204
|
) => Matcher<
|
|
205
205
|
I,
|
|
206
|
-
Types.AddWithout<F, Types.PForExclude<UnionToIntersection<P[number]>>>,
|
|
207
|
-
Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<UnionToIntersection<P[number]>>>>,
|
|
206
|
+
Types.AddWithout<F, Types.PForExclude<T.UnionToIntersection<P[number]>>>,
|
|
207
|
+
Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<T.UnionToIntersection<P[number]>>>>,
|
|
208
208
|
A | ReturnType<Fn>,
|
|
209
209
|
Pr
|
|
210
210
|
> = internal.whenAnd
|
|
@@ -297,7 +297,7 @@ export const discriminatorsExhaustive: <D extends string>(
|
|
|
297
297
|
* @since 1.0.0
|
|
298
298
|
*/
|
|
299
299
|
export const tag: <R, P extends Types.Tags<"_tag", R> & string, Ret, B extends Ret>(
|
|
300
|
-
...pattern: [first: P, ...values: Array<P>, f: (_: Extract<R
|
|
300
|
+
...pattern: [first: P, ...values: Array<P>, f: (_: Extract<T.NoInfer<R>, Record<"_tag", P>>) => B]
|
|
301
301
|
) => <I, F, A, Pr>(
|
|
302
302
|
self: Matcher<I, F, R, A, Pr, Ret>
|
|
303
303
|
) => Matcher<
|
|
@@ -315,7 +315,7 @@ export const tag: <R, P extends Types.Tags<"_tag", R> & string, Ret, B extends R
|
|
|
315
315
|
*/
|
|
316
316
|
export const tagStartsWith: <R, P extends string, Ret, B extends Ret>(
|
|
317
317
|
pattern: P,
|
|
318
|
-
f: (_: Extract<R
|
|
318
|
+
f: (_: Extract<T.NoInfer<R>, Record<"_tag", `${P}${string}`>>) => B
|
|
319
319
|
) => <I, F, A, Pr>(
|
|
320
320
|
self: Matcher<I, F, R, A, Pr, Ret>
|
|
321
321
|
) => Matcher<
|
|
@@ -496,11 +496,11 @@ export const instanceOfUnsafe: <A extends abstract new(...args: any) => any>(
|
|
|
496
496
|
* @category conversions
|
|
497
497
|
* @since 1.0.0
|
|
498
498
|
*/
|
|
499
|
-
export const orElse: <RA, Ret,
|
|
500
|
-
f:
|
|
499
|
+
export const orElse: <RA, Ret, F extends (_: RA) => Ret>(
|
|
500
|
+
f: F
|
|
501
501
|
) => <I, R, A, Pr>(
|
|
502
502
|
self: Matcher<I, R, RA, A, Pr, Ret>
|
|
503
|
-
) => [Pr] extends [never] ? (input: I) => Unify<
|
|
503
|
+
) => [Pr] extends [never] ? (input: I) => Unify<ReturnType<F> | A> : Unify<ReturnType<F> | A> = internal.orElse
|
|
504
504
|
|
|
505
505
|
/**
|
|
506
506
|
* @category conversions
|
|
@@ -692,7 +692,7 @@ export declare namespace Types {
|
|
|
692
692
|
/**
|
|
693
693
|
* @since 1.0.0
|
|
694
694
|
*/
|
|
695
|
-
export type ArrayToIntersection<A extends ReadonlyArray<any>> = UnionToIntersection<
|
|
695
|
+
export type ArrayToIntersection<A extends ReadonlyArray<any>> = T.UnionToIntersection<
|
|
696
696
|
A[number]
|
|
697
697
|
>
|
|
698
698
|
|