0.1.0 #1

Merged
Thilawyn merged 81 commits from next into master 2025-07-17 21:17:57 +02:00
Showing only changes of commit 591ec17e9f - Show all commits

View File

@@ -33,7 +33,161 @@ export namespace make {
}
}
export const make = <
export const make: {
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, P extends {} = {}>(
body: (props: P) => Generator<Eff, React.ReactNode, never>,
): Component<
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never,
P
>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => Effect.Effect<React.ReactNode, EOut, ROut>
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, C, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => C,
d: (_: C, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, C, D, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => C,
d: (_: C, props: NoInfer<P>) => D,
e: (_: D, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, C, D, E, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => C,
d: (_: C, props: NoInfer<P>) => D,
e: (_: D, props: NoInfer<P>) => E,
f: (_: E, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, C, D, E, F, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => C,
d: (_: C, props: NoInfer<P>) => D,
e: (_: D, props: NoInfer<P>) => E,
f: (_: E, props: NoInfer<P>) => F,
g: (_: F, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, C, D, E, F, G, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => C,
d: (_: C, props: NoInfer<P>) => D,
e: (_: D, props: NoInfer<P>) => E,
f: (_: E, props: NoInfer<P>) => F,
g: (_: F, props: NoInfer<P>) => G,
h: (_: G, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, AEff, A, B, C, D, E, F, G, H, EOut, ROut, P extends {} = {}>(
body: (props: P) => Generator<Eff, AEff, never>,
a: (
_: Effect.Effect<
AEff,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
>,
props: NoInfer<P>,
) => A,
b: (_: A, props: NoInfer<P>) => B,
c: (_: B, props: NoInfer<P>) => C,
d: (_: C, props: NoInfer<P>) => D,
e: (_: D, props: NoInfer<P>) => E,
f: (_: E, props: NoInfer<P>) => F,
g: (_: F, props: NoInfer<P>) => G,
h: (_: G, props: NoInfer<P>) => H,
i: (_: H, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P>
} = (...pipeables: readonly [any]) => {
const displayName: string = !String.isEmpty(pipeables[0].name) ? pipeables[0].name : undefined
return Object.setPrototypeOf({
body: displayName
? Effect.fn(displayName)(...pipeables)
: Effect.fn(...pipeables),
displayName,
}, ComponentProto)
}
export const make_old = <
Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>,
P extends {} = {},
>(