|
|
|
@ -97,8 +97,8 @@ type Apply<L /* extends Func */, R /* extends Func */, Cont, IO> =
|
|
|
|
|
* Evalutate an expression.
|
|
|
|
|
*/
|
|
|
|
|
export type Eval<E /* extends Expression */, Cont, IO> =
|
|
|
|
|
// Expression is a function, apply the continuation.
|
|
|
|
|
E extends Func ? Continue<Cont, E, IO>
|
|
|
|
|
// Expression is an application, evaluate the left part (the "operator").
|
|
|
|
|
: E extends [infer L, infer R] ? Eval<L, ['a1', R, Cont], IO>
|
|
|
|
|
: never;
|
|
|
|
|
// Expression is a function, apply the continuation.
|
|
|
|
|
E extends Func ? Continue<Cont, E, IO>
|
|
|
|
|
// Expression is an application, evaluate the left part (the "operator").
|
|
|
|
|
: E extends [infer L, infer R] ? Eval<L, ['a1', R, Cont], IO>
|
|
|
|
|
: never;
|
|
|
|
|