@lionlang/core 0.1.0 → 0.2.0
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/README.md +326 -6
- package/dist/analysis/analyze.d.mts +34 -0
- package/dist/analysis/analyze.d.mts.map +1 -0
- package/dist/analysis/analyze.mjs +181 -0
- package/dist/analysis/analyze.mjs.map +1 -0
- package/dist/environment-BQw8BPXl.d.mts +25 -0
- package/dist/{environment-k2Uf6VVc.d.mts.map → environment-BQw8BPXl.d.mts.map} +1 -1
- package/dist/errors/evaluation.d.mts +1 -1
- package/dist/errors/evaluation.mjs +2 -2
- package/dist/errors/evaluation.mjs.map +1 -1
- package/dist/{evaluate-D7ODMrbg.mjs → evaluate-BJOG7kaS.mjs} +36 -33
- package/dist/evaluate-BJOG7kaS.mjs.map +1 -0
- package/dist/evaluation/base-forms/array.d.mts +5 -6
- package/dist/evaluation/base-forms/array.d.mts.map +1 -1
- package/dist/evaluation/base-forms/array.mjs +1 -1
- package/dist/evaluation/base-forms/primitive.d.mts +2 -2
- package/dist/evaluation/base-forms/primitive.mjs +2 -2
- package/dist/evaluation/base-forms/primitive.mjs.map +1 -1
- package/dist/evaluation/base-forms/record.d.mts +5 -5
- package/dist/evaluation/base-forms/record.d.mts.map +1 -1
- package/dist/evaluation/base-forms/record.mjs +1 -1
- package/dist/evaluation/environment.d.mts +1 -1
- package/dist/evaluation/environment.d.mts.map +1 -1
- package/dist/evaluation/environment.mjs +10 -7
- package/dist/evaluation/environment.mjs.map +1 -1
- package/dist/evaluation/evaluate.d.mts +5 -6
- package/dist/evaluation/evaluate.d.mts.map +1 -1
- package/dist/evaluation/evaluate.mjs +1 -1
- package/dist/evaluation/special-forms/begin.d.mts +4 -4
- package/dist/evaluation/special-forms/begin.d.mts.map +1 -1
- package/dist/evaluation/special-forms/begin.mjs +1 -1
- package/dist/evaluation/special-forms/cond.d.mts +4 -5
- package/dist/evaluation/special-forms/cond.d.mts.map +1 -1
- package/dist/evaluation/special-forms/cond.mjs +1 -1
- package/dist/evaluation/special-forms/define.d.mts +4 -4
- package/dist/evaluation/special-forms/define.d.mts.map +1 -1
- package/dist/evaluation/special-forms/define.mjs +1 -1
- package/dist/evaluation/special-forms/eval.d.mts +4 -5
- package/dist/evaluation/special-forms/eval.d.mts.map +1 -1
- package/dist/evaluation/special-forms/eval.mjs +1 -1
- package/dist/evaluation/special-forms/function.d.mts +4 -5
- package/dist/evaluation/special-forms/function.d.mts.map +1 -1
- package/dist/evaluation/special-forms/function.mjs +1 -1
- package/dist/evaluation/special-forms/lambda.d.mts +4 -4
- package/dist/evaluation/special-forms/lambda.d.mts.map +1 -1
- package/dist/evaluation/special-forms/lambda.mjs +1 -1
- package/dist/evaluation/special-forms/match.d.mts +4 -5
- package/dist/evaluation/special-forms/match.d.mts.map +1 -1
- package/dist/evaluation/special-forms/match.mjs +1 -1
- package/dist/evaluation/special-forms/quote.d.mts +1 -1
- package/dist/evaluation-B6K0DbPS.d.mts +14 -0
- package/dist/evaluation-B6K0DbPS.d.mts.map +1 -0
- package/dist/evaluation-Bs36vy1h.d.mts +12 -0
- package/dist/evaluation-Bs36vy1h.d.mts.map +1 -0
- package/dist/evaluation-Dwo4KN_D.d.mts +9 -0
- package/dist/evaluation-Dwo4KN_D.d.mts.map +1 -0
- package/dist/{json-primitive-DUaaoNff.d.mts → json-primitive-gcv9Q1E4.d.mts} +2 -2
- package/dist/json-primitive-gcv9Q1E4.d.mts.map +1 -0
- package/dist/lion-expression-DMR7Psmu.d.mts +16 -0
- package/dist/lion-expression-DMR7Psmu.d.mts.map +1 -0
- package/dist/modules/array.d.mts +9 -10
- package/dist/modules/array.d.mts.map +1 -1
- package/dist/modules/array.mjs +9 -5
- package/dist/modules/array.mjs.map +1 -1
- package/dist/modules/boolean.d.mts +8 -9
- package/dist/modules/boolean.d.mts.map +1 -1
- package/dist/modules/boolean.mjs +6 -6
- package/dist/modules/boolean.mjs.map +1 -1
- package/dist/modules/console.mjs.map +1 -1
- package/dist/modules/lib/shared.d.mts +1 -2
- package/dist/modules/lib/shared.d.mts.map +1 -1
- package/dist/modules/lib/shared.mjs +1 -1
- package/dist/modules/lib/shared.mjs.map +1 -1
- package/dist/modules/number.d.mts +10 -11
- package/dist/modules/number.d.mts.map +1 -1
- package/dist/modules/number.mjs +9 -9
- package/dist/modules/number.mjs.map +1 -1
- package/dist/modules/object.d.mts +39 -59
- package/dist/modules/object.d.mts.map +1 -1
- package/dist/modules/object.mjs +12 -18
- package/dist/modules/object.mjs.map +1 -1
- package/dist/modules/string.d.mts +8 -9
- package/dist/modules/string.d.mts.map +1 -1
- package/dist/modules/string.mjs +6 -6
- package/dist/modules/string.mjs.map +1 -1
- package/dist/schemas/environment.d.mts +1 -1
- package/dist/schemas/environment.mjs +3 -3
- package/dist/schemas/environment.mjs.map +1 -1
- package/dist/schemas/evaluation.d.mts +17 -17
- package/dist/schemas/evaluation.d.mts.map +1 -1
- package/dist/schemas/evaluation.mjs +23 -15
- package/dist/schemas/evaluation.mjs.map +1 -1
- package/dist/schemas/json-primitive.d.mts +1 -1
- package/dist/schemas/json-primitive.mjs +6 -1
- package/dist/schemas/json-primitive.mjs.map +1 -1
- package/dist/schemas/lion-expression.d.mts +1 -1
- package/dist/schemas/lion-expression.mjs +6 -5
- package/dist/schemas/lion-expression.mjs.map +1 -1
- package/dist/services/evaluation.d.mts +2 -2
- package/dist/services/evaluation.mjs +3 -4
- package/dist/services/evaluation.mjs.map +1 -1
- package/dist/types/evaluation.d.mts +1 -1
- package/package.json +8 -6
- package/dist/environment-k2Uf6VVc.d.mts +0 -25
- package/dist/evaluate-D7ODMrbg.mjs.map +0 -1
- package/dist/evaluation-AblffSQw.d.mts +0 -17
- package/dist/evaluation-AblffSQw.d.mts.map +0 -1
- package/dist/evaluation-EqzK8tQV.d.mts +0 -13
- package/dist/evaluation-EqzK8tQV.d.mts.map +0 -1
- package/dist/evaluation-uwZSKxIf.d.mts +0 -10
- package/dist/evaluation-uwZSKxIf.d.mts.map +0 -1
- package/dist/json-primitive-DUaaoNff.d.mts.map +0 -1
- package/dist/lion-expression-6Y3itx9l.d.mts +0 -16
- package/dist/lion-expression-6Y3itx9l.d.mts.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { JsonPrimitiveSchema } from "./schemas/json-primitive.mjs";
|
|
2
1
|
import { LionArrayExpressionSchema, LionExpressionSchema, LionRecordExpressionSchema } from "./schemas/lion-expression.mjs";
|
|
2
|
+
import { BeginFormSchema, CondFormSchema, CondFormWithElseSchema, CondFormWithoutElseSchema, DefineFormSchema, EvalFormSchema, FunctionCallFormSchema, LambdaFormSchema, LionFunctionValueSchema, MatchFormSchema, MatchPatternSchema, QuoteFormSchema } from "./schemas/evaluation.mjs";
|
|
3
3
|
import { ArgumentMismatchError, InvalidFunctionCallError } from "./errors/evaluation.mjs";
|
|
4
4
|
import { makeEnvironment, setGlobalBinding } from "./evaluation/environment.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { LionEnvironmentService, getService } from "./services/evaluation.mjs";
|
|
5
|
+
import { LionEnvironmentService } from "./services/evaluation.mjs";
|
|
7
6
|
import { evaluateQuote } from "./evaluation/special-forms/quote.mjs";
|
|
8
7
|
import { evaluatePrimitive } from "./evaluation/base-forms/primitive.mjs";
|
|
9
8
|
import { Array, Effect, Match, Option, Record, Schema, pipe } from "effect";
|
|
@@ -22,10 +21,10 @@ const evaluateCond = (expression) => pipe(Match.value(expression), Match.when(Sc
|
|
|
22
21
|
})), Match.exhaustive);
|
|
23
22
|
//#endregion
|
|
24
23
|
//#region src/evaluation/special-forms/define.ts
|
|
25
|
-
const evaluateDefine = ([_, id, expr]) => pipe(Effect.Do, Effect.bind("environment", () =>
|
|
24
|
+
const evaluateDefine = ([_, id, expr]) => pipe(Effect.Do, Effect.bind("environment", () => Effect.service(LionEnvironmentService)), Effect.bind("value", () => evaluate(expr)), Effect.flatMap(({ environment, value }) => pipe(setGlobalBinding(environment, id, value), Effect.map(() => value))));
|
|
26
25
|
//#endregion
|
|
27
26
|
//#region src/evaluation/special-forms/eval.ts
|
|
28
|
-
const evaluateEval = ([_, args]) => pipe(evaluate(args), Effect.flatMap(Schema.
|
|
27
|
+
const evaluateEval = ([_, args]) => pipe(evaluate(args), Effect.flatMap(Schema.decodeUnknownEffect(LionExpressionSchema)), Effect.flatMap(evaluate));
|
|
29
28
|
//#endregion
|
|
30
29
|
//#region src/evaluation/special-forms/function.ts
|
|
31
30
|
const evaluateFunctionCall = (functionCallExpression) => pipe(Effect.all(Array.map(functionCallExpression, evaluate)), Effect.map(Array.unprepend), Effect.flatMap(([head, tail]) => pipe(Match.value(head), Match.when(Schema.is(LionFunctionValueSchema), (fn) => {
|
|
@@ -35,7 +34,7 @@ const evaluateFunctionCall = (functionCallExpression) => pipe(Effect.all(Array.m
|
|
|
35
34
|
//#endregion
|
|
36
35
|
//#region src/evaluation/special-forms/lambda.ts
|
|
37
36
|
const evaluateLambda = ([_, parameters, bodyExpression]) => Effect.gen(function* () {
|
|
38
|
-
const enclosedEnvironment = yield*
|
|
37
|
+
const enclosedEnvironment = yield* LionEnvironmentService;
|
|
39
38
|
return Effect.fn(function* (...args) {
|
|
40
39
|
if (args.length < parameters.length) return yield* new ArgumentMismatchError();
|
|
41
40
|
const environment = yield* makeEnvironment(Record.fromEntries(Array.zip(parameters, args)), enclosedEnvironment);
|
|
@@ -44,41 +43,45 @@ const evaluateLambda = ([_, parameters, bodyExpression]) => Effect.gen(function*
|
|
|
44
43
|
});
|
|
45
44
|
//#endregion
|
|
46
45
|
//#region src/evaluation/special-forms/match.ts
|
|
47
|
-
const MatchPredicateRecordSchema = Schema.Record(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
const MatchPredicateRecordSchema = Schema.Record(Schema.String, Schema.suspend(() => MatchPredicateSchema));
|
|
47
|
+
const MatchPredicateSchema = Schema.Union([MatchPredicateRecordSchema, LionFunctionValueSchema]);
|
|
48
|
+
const AnyRecordSchema = Schema.Record(Schema.String, Schema.Any);
|
|
49
|
+
const evaluatePredicate = (value, predicate) => {
|
|
50
|
+
if (Schema.is(MatchPredicateRecordSchema)(predicate)) return Effect.gen(function* () {
|
|
51
|
+
if (!Schema.is(AnyRecordSchema)(value)) return false;
|
|
52
|
+
if (!Record.keys(predicate).every((key) => Record.has(value, key))) return false;
|
|
53
|
+
for (const [key, nestedPredicate] of Record.toEntries(predicate)) if (!(yield* evaluatePredicate(value[key], nestedPredicate))) return false;
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
return predicate(value).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.Boolean)), Effect.catch(() => Effect.succeed(false)));
|
|
57
|
+
};
|
|
58
|
+
const evaluateMatchPatterns = (value, patternExprs) => Effect.gen(function* () {
|
|
59
|
+
const patternExpr = patternExprs[0];
|
|
60
|
+
if (patternExpr === void 0) return yield* Effect.die(/* @__PURE__ */ new Error("Match expression requires a fallback function"));
|
|
61
|
+
if (Schema.is(MatchPatternSchema)(patternExpr)) {
|
|
62
|
+
const [predicateExpr, functionExpr] = patternExpr;
|
|
63
|
+
const predicate = yield* evaluate(predicateExpr).pipe(Effect.flatMap(Schema.decodeUnknownEffect(MatchPredicateSchema)));
|
|
64
|
+
const fn = yield* evaluate(functionExpr).pipe(Effect.flatMap(Schema.decodeUnknownEffect(LionFunctionValueSchema)));
|
|
65
|
+
return (yield* evaluatePredicate(value, predicate)) ? yield* fn(value) : yield* evaluateMatchPatterns(value, patternExprs.slice(1));
|
|
63
66
|
}
|
|
64
|
-
return
|
|
65
|
-
})
|
|
66
|
-
const
|
|
67
|
-
onTrue: () => fn(value),
|
|
68
|
-
onFalse: () => pipe(Array.tail(patternExprs), Option.getOrThrow, (tail) => evaluateMatchPatterns(value, tail))
|
|
69
|
-
}))))), Match.when(Schema.is(LionExpressionSchema), (fallbackFn) => pipe(evaluate(fallbackFn), Effect.flatMap(Schema.decodeUnknown(LionFunctionValueSchema)), Effect.flatMap((fallbackFn) => fallbackFn(value)))), Match.exhaustive);
|
|
70
|
-
const evaluateMatch = ([_, valueExpr, ...patternExprs]) => pipe(evaluate(valueExpr), Effect.flatMap((value) => evaluateMatchPatterns(value, patternExprs)));
|
|
67
|
+
return yield* (yield* evaluate(patternExpr).pipe(Effect.flatMap(Schema.decodeUnknownEffect(LionFunctionValueSchema))))(value);
|
|
68
|
+
});
|
|
69
|
+
const evaluateMatch = ([_, valueExpression, ...patternExpressions]) => evaluate(valueExpression).pipe(Effect.flatMap((value) => evaluateMatchPatterns(value, patternExpressions)));
|
|
71
70
|
//#endregion
|
|
72
71
|
//#region src/evaluation/base-forms/array.ts
|
|
73
|
-
const evaluateArray = (expression) => pipe(Match.value(expression), Match.when(Array.
|
|
72
|
+
const evaluateArray = (expression) => pipe(Match.value(expression), Match.when(Array.isReadonlyArrayEmpty, Effect.succeed), Match.when(Schema.is(EvalFormSchema), (_) => evaluateEval(_)), Match.when(Schema.is(QuoteFormSchema), (_) => evaluateQuote(_)), Match.when(Schema.is(BeginFormSchema), (_) => evaluateBegin(_)), Match.when(Schema.is(DefineFormSchema), (_) => evaluateDefine(_)), Match.when(Schema.is(LambdaFormSchema), (_) => evaluateLambda(_)), Match.when(Schema.is(CondFormSchema), (_) => evaluateCond(_)), Match.when(Schema.is(MatchFormSchema), (_) => evaluateMatch(_)), Match.when(Schema.is(FunctionCallFormSchema), (_) => evaluateFunctionCall(_)), Match.orElse(() => Effect.fail(new InvalidFunctionCallError({ expression }))));
|
|
74
73
|
//#endregion
|
|
75
74
|
//#region src/evaluation/base-forms/record.ts
|
|
76
75
|
const evaluateRecord = (expression) => pipe(expression, Record.map(evaluate), Effect.all);
|
|
77
76
|
//#endregion
|
|
78
77
|
//#region src/evaluation/evaluate.ts
|
|
79
|
-
const evaluate = (expression) =>
|
|
80
|
-
|
|
78
|
+
const evaluate = (expression) => {
|
|
79
|
+
if (Schema.is(LionArrayExpressionSchema)(expression)) return evaluateArray(expression);
|
|
80
|
+
if (Schema.is(LionRecordExpressionSchema)(expression)) return evaluateRecord(expression);
|
|
81
|
+
return evaluatePrimitive(expression);
|
|
82
|
+
};
|
|
83
|
+
const run = (expression, environment) => pipe(Schema.decodeUnknownEffect(LionExpressionSchema)(expression), Effect.flatMap(evaluate), Effect.provideServiceEffect(LionEnvironmentService, makeEnvironment(environment)));
|
|
81
84
|
//#endregion
|
|
82
85
|
export { evaluateMatch as a, evaluateEval as c, evaluateBegin as d, evaluateArray as i, evaluateDefine as l, run as n, evaluateLambda as o, evaluateRecord as r, evaluateFunctionCall as s, evaluate as t, evaluateCond as u };
|
|
83
86
|
|
|
84
|
-
//# sourceMappingURL=evaluate-
|
|
87
|
+
//# sourceMappingURL=evaluate-BJOG7kaS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-BJOG7kaS.mjs","names":["Arr","Arr","Arr","Arr","Arr"],"sources":["../src/evaluation/special-forms/begin.ts","../src/evaluation/special-forms/cond.ts","../src/evaluation/special-forms/define.ts","../src/evaluation/special-forms/eval.ts","../src/evaluation/special-forms/function.ts","../src/evaluation/special-forms/lambda.ts","../src/evaluation/special-forms/match.ts","../src/evaluation/base-forms/array.ts","../src/evaluation/base-forms/record.ts","../src/evaluation/evaluate.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, pipe } from \"effect\";\nimport { evaluate } from \"@/evaluation/evaluate\";\nimport type { BeginFormSchema } from \"@/schemas/evaluation\";\n\nexport const evaluateBegin = ([_, ...args]: typeof BeginFormSchema.Type) =>\n pipe(\n Arr.map(args, evaluate),\n Effect.all,\n Effect.map(Arr.last),\n Effect.map(Option.getOrElse(() => []))\n );\n","import { Array as Arr, Effect, Match, pipe, Schema } from \"effect\";\nimport { evaluate } from \"@/evaluation/evaluate\";\nimport {\n type CondFormSchema,\n CondFormWithElseSchema,\n CondFormWithoutElseSchema,\n} from \"@/schemas/evaluation\";\n\nexport const evaluateCond = (expression: typeof CondFormSchema.Type) =>\n pipe(\n Match.value(expression),\n Match.when(Schema.is(CondFormWithoutElseSchema), (exprWithoutElse) =>\n Effect.gen(function* () {\n const [_, ...cases] = exprWithoutElse;\n for (const [condition, result] of cases) {\n const conditionResult = yield* evaluate(condition);\n if (conditionResult) {\n return yield* evaluate(result);\n }\n }\n return null;\n })\n ),\n Match.when(Schema.is(CondFormWithElseSchema), (expression) =>\n Effect.gen(function* () {\n const [_, ...cases] = expression;\n for (const [condition, result] of Arr.initNonEmpty(cases)) {\n const conditionResult = yield* evaluate(condition);\n if (conditionResult) {\n return yield* evaluate(result);\n }\n }\n const elseCase = Arr.lastNonEmpty(cases);\n return yield* evaluate(elseCase);\n })\n ),\n Match.exhaustive\n );\n","import { Effect, pipe } from \"effect\";\nimport { setGlobalBinding } from \"@/evaluation/environment\";\nimport { evaluate } from \"@/evaluation/evaluate\";\nimport type { DefineFormSchema } from \"@/schemas/evaluation\";\nimport { LionEnvironmentService } from \"@/services/evaluation\";\n\nexport const evaluateDefine = ([_, id, expr]: typeof DefineFormSchema.Type) =>\n pipe(\n Effect.Do,\n Effect.bind(\"environment\", () => Effect.service(LionEnvironmentService)),\n Effect.bind(\"value\", () => evaluate(expr)),\n Effect.flatMap(({ environment, value }) =>\n pipe(\n setGlobalBinding(environment, id, value),\n Effect.map(() => value)\n )\n )\n );\n","import { Effect, pipe, Schema } from \"effect\";\nimport { evaluate } from \"@/evaluation/evaluate.ts\";\nimport type { EvalFormSchema } from \"@/schemas/evaluation\";\nimport { LionExpressionSchema } from \"@/schemas/lion-expression\";\n\nexport const evaluateEval = ([_, args]: typeof EvalFormSchema.Type) =>\n pipe(\n evaluate(args),\n Effect.flatMap(Schema.decodeUnknownEffect(LionExpressionSchema)),\n Effect.flatMap(evaluate)\n );\n","import { Array as Arr, Effect, Match, pipe, Schema } from \"effect\";\nimport { InvalidFunctionCallError } from \"@/errors/evaluation\";\nimport { evaluate } from \"@/evaluation/evaluate.ts\";\nimport {\n type FunctionCallFormSchema,\n LionFunctionValueSchema,\n} from \"@/schemas/evaluation\";\n\nexport const evaluateFunctionCall = (\n functionCallExpression: typeof FunctionCallFormSchema.Type\n) =>\n pipe(\n Effect.all(Arr.map(functionCallExpression, evaluate)),\n Effect.map(Arr.unprepend),\n Effect.flatMap(([head, tail]) =>\n pipe(\n Match.value(head),\n Match.when(Schema.is(LionFunctionValueSchema), (fn) => {\n const result = fn(...tail);\n return Effect.isEffect(result) ? result : Effect.succeed(result);\n }),\n Match.orElse(() =>\n Effect.fail(\n new InvalidFunctionCallError({ expression: functionCallExpression })\n )\n )\n )\n )\n );\n","import { Array as Arr, Effect, Record } from \"effect\";\nimport { ArgumentMismatchError } from \"@/errors/evaluation\";\nimport { makeEnvironment } from \"@/evaluation/environment\";\nimport { evaluate } from \"@/evaluation/evaluate\";\nimport type { LambdaFormSchema } from \"@/schemas/evaluation\";\nimport { LionEnvironmentService } from \"@/services/evaluation\";\n\nexport const evaluateLambda = ([\n _,\n parameters,\n bodyExpression,\n]: typeof LambdaFormSchema.Type) =>\n Effect.gen(function* () {\n const enclosedEnvironment = yield* LionEnvironmentService;\n const lambda = Effect.fn(function* (...args: unknown[]) {\n if (args.length < parameters.length) {\n return yield* new ArgumentMismatchError();\n }\n const paramsEnvironment = Record.fromEntries(Arr.zip(parameters, args));\n const environment = yield* makeEnvironment(\n paramsEnvironment,\n enclosedEnvironment\n );\n return yield* evaluate(bodyExpression).pipe(\n Effect.provideService(LionEnvironmentService, environment)\n );\n });\n return lambda;\n });\n","import { Effect, Record, Schema } from \"effect\";\nimport { evaluate } from \"@/evaluation/evaluate\";\nimport {\n LionFunctionValueSchema,\n type MatchFormSchema,\n MatchPatternSchema,\n} from \"@/schemas/evaluation\";\nimport type { LionExpressionSchema } from \"@/schemas/lion-expression\";\nimport type { LionEnvironmentService } from \"@/services/evaluation\";\nimport type { EvaluateResult } from \"@/types/evaluation\";\n\n/*\n[\"match\", <value>, [<predicate>, <fn>], ..., <fallback-fn>]\n*/\n\ntype AssumedMatchPredicateType =\n | { readonly [key: string]: AssumedMatchPredicateType }\n | typeof LionFunctionValueSchema.Type;\n\nconst MatchPredicateRecordSchema = Schema.Record(\n Schema.String,\n Schema.suspend(\n (): Schema.Codec<AssumedMatchPredicateType> => MatchPredicateSchema\n )\n);\n\nconst MatchPredicateSchema = Schema.Union([\n MatchPredicateRecordSchema,\n LionFunctionValueSchema,\n]);\n\nconst AnyRecordSchema = Schema.Record(Schema.String, Schema.Any);\n\nconst evaluatePredicate = (\n value: unknown,\n predicate: typeof MatchPredicateSchema.Type\n): Effect.Effect<boolean, never, LionEnvironmentService> => {\n if (Schema.is(MatchPredicateRecordSchema)(predicate)) {\n return Effect.gen(function* () {\n if (!Schema.is(AnyRecordSchema)(value)) {\n return false;\n }\n\n if (!Record.keys(predicate).every((key) => Record.has(value, key))) {\n return false;\n }\n\n for (const [key, nestedPredicate] of Record.toEntries(predicate)) {\n if (!(yield* evaluatePredicate(value[key], nestedPredicate))) {\n return false;\n }\n }\n return true;\n });\n }\n\n return predicate(value).pipe(\n Effect.flatMap(Schema.decodeUnknownEffect(Schema.Boolean)),\n Effect.catch(() => Effect.succeed(false))\n );\n};\n\nconst evaluateMatchPatterns = (\n value: unknown,\n patternExprs: ReadonlyArray<\n typeof MatchPatternSchema.Type | typeof LionExpressionSchema.Type\n >\n): EvaluateResult =>\n Effect.gen(function* () {\n const patternExpr = patternExprs[0];\n if (patternExpr === undefined) {\n return yield* Effect.die(\n new Error(\"Match expression requires a fallback function\")\n );\n }\n\n if (Schema.is(MatchPatternSchema)(patternExpr)) {\n const [predicateExpr, functionExpr] = patternExpr;\n const predicate = yield* evaluate(predicateExpr).pipe(\n Effect.flatMap(Schema.decodeUnknownEffect(MatchPredicateSchema))\n );\n const fn = yield* evaluate(functionExpr).pipe(\n Effect.flatMap(Schema.decodeUnknownEffect(LionFunctionValueSchema))\n );\n return (yield* evaluatePredicate(value, predicate))\n ? yield* fn(value)\n : yield* evaluateMatchPatterns(value, patternExprs.slice(1));\n }\n\n const fallback = yield* evaluate(patternExpr).pipe(\n Effect.flatMap(Schema.decodeUnknownEffect(LionFunctionValueSchema))\n );\n return yield* fallback(value);\n });\n\nexport const evaluateMatch = ([\n _,\n valueExpression,\n ...patternExpressions\n]: typeof MatchFormSchema.Type) =>\n evaluate(valueExpression).pipe(\n Effect.flatMap((value) => evaluateMatchPatterns(value, patternExpressions))\n );\n","import { Array as Arr, Effect, Match, pipe, Schema } from \"effect\";\nimport { InvalidFunctionCallError } from \"@/errors/evaluation\";\nimport { evaluateBegin } from \"@/evaluation/special-forms/begin.ts\";\nimport { evaluateCond } from \"@/evaluation/special-forms/cond.ts\";\nimport { evaluateDefine } from \"@/evaluation/special-forms/define.ts\";\nimport { evaluateEval } from \"@/evaluation/special-forms/eval.ts\";\nimport { evaluateFunctionCall } from \"@/evaluation/special-forms/function.ts\";\nimport { evaluateLambda } from \"@/evaluation/special-forms/lambda\";\nimport { evaluateMatch } from \"@/evaluation/special-forms/match\";\nimport { evaluateQuote } from \"@/evaluation/special-forms/quote.ts\";\nimport {\n BeginFormSchema,\n CondFormSchema,\n DefineFormSchema,\n EvalFormSchema,\n FunctionCallFormSchema,\n LambdaFormSchema,\n MatchFormSchema,\n QuoteFormSchema,\n} from \"@/schemas/evaluation.ts\";\nimport type { LionArrayExpressionType } from \"@/schemas/lion-expression.ts\";\n\nexport const evaluateArray = (expression: LionArrayExpressionType) =>\n pipe(\n Match.value(expression),\n Match.when(Arr.isReadonlyArrayEmpty, Effect.succeed),\n Match.when(Schema.is(EvalFormSchema), (_) => evaluateEval(_)),\n Match.when(Schema.is(QuoteFormSchema), (_) => evaluateQuote(_)),\n Match.when(Schema.is(BeginFormSchema), (_) => evaluateBegin(_)),\n Match.when(Schema.is(DefineFormSchema), (_) => evaluateDefine(_)),\n Match.when(Schema.is(LambdaFormSchema), (_) => evaluateLambda(_)),\n Match.when(Schema.is(CondFormSchema), (_) => evaluateCond(_)),\n Match.when(Schema.is(MatchFormSchema), (_) => evaluateMatch(_)),\n Match.when(Schema.is(FunctionCallFormSchema), (_) =>\n evaluateFunctionCall(_)\n ),\n Match.orElse(() =>\n Effect.fail(new InvalidFunctionCallError({ expression }))\n )\n );\n","import { Effect, pipe, Record } from \"effect\";\nimport { evaluate } from \"@/evaluation/evaluate.ts\";\nimport type { LionRecordExpressionType } from \"@/schemas/lion-expression\";\n\nexport const evaluateRecord = (expression: LionRecordExpressionType) =>\n pipe(expression, Record.map(evaluate), Effect.all);\n","import { Effect, pipe, Schema } from \"effect\";\nimport { evaluateArray } from \"@/evaluation/base-forms/array\";\nimport { evaluatePrimitive } from \"@/evaluation/base-forms/primitive\";\nimport { evaluateRecord } from \"@/evaluation/base-forms/record\";\nimport { makeEnvironment } from \"@/evaluation/environment\";\nimport {\n LionArrayExpressionSchema,\n LionExpressionSchema,\n type LionExpressionType,\n LionRecordExpressionSchema,\n} from \"@/schemas/lion-expression\";\nimport { LionEnvironmentService } from \"@/services/evaluation\";\nimport type { EvaluateResult } from \"@/types/evaluation\";\n\nexport const evaluate = (expression: LionExpressionType): EvaluateResult => {\n if (Schema.is(LionArrayExpressionSchema)(expression)) {\n return evaluateArray(expression);\n }\n if (Schema.is(LionRecordExpressionSchema)(expression)) {\n return evaluateRecord(expression);\n }\n return evaluatePrimitive(expression);\n};\n\nexport const run = (\n expression: unknown,\n environment: Record<string, unknown>\n) =>\n pipe(\n Schema.decodeUnknownEffect(LionExpressionSchema)(expression),\n Effect.flatMap(evaluate),\n Effect.provideServiceEffect(\n LionEnvironmentService,\n makeEnvironment(environment)\n )\n );\n"],"mappings":"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"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { r as LionArrayExpressionType } from "../../lion-expression-
|
|
2
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
3
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import * as _$effect_ParseResult0 from "effect/ParseResult";
|
|
1
|
+
import { r as LionArrayExpressionType } from "../../lion-expression-DMR7Psmu.mjs";
|
|
2
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
3
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
6
5
|
|
|
7
6
|
//#region src/evaluation/base-forms/array.d.ts
|
|
8
|
-
declare const evaluateArray: (expression: LionArrayExpressionType) => Effect.Effect<unknown,
|
|
7
|
+
declare const evaluateArray: (expression: LionArrayExpressionType) => Effect.Effect<unknown, Schema.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
8
|
//#endregion
|
|
10
9
|
export { evaluateArray };
|
|
11
10
|
//# sourceMappingURL=array.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.mts","names":[],"sources":["../../../src/evaluation/base-forms/array.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"array.d.mts","names":[],"sources":["../../../src/evaluation/base-forms/array.ts"],"mappings":";;;;;;cAsBa,aAAA,GAAiB,UAAA,EAAY,uBAAA,KAAuB,MAAA,CAAA,MAAA,UAAA,MAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as evaluateArray } from "../../evaluate-
|
|
1
|
+
import { i as evaluateArray } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateArray };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as JsonPrimitiveType } from "../../json-primitive-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as JsonPrimitiveType } from "../../json-primitive-gcv9Q1E4.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region src/evaluation/base-forms/primitive.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getBinding } from "../environment.mjs";
|
|
2
|
-
import { LionEnvironmentService
|
|
2
|
+
import { LionEnvironmentService } from "../../services/evaluation.mjs";
|
|
3
3
|
import { Effect, Match, Option, String, pipe } from "effect";
|
|
4
4
|
//#region src/evaluation/base-forms/primitive.ts
|
|
5
5
|
const evaluatePrimitive = (expression) => pipe(Match.value(expression), Match.when(String.isString, evaluateReference), Match.orElse(Effect.succeed));
|
|
6
|
-
const evaluateReference = (name) => pipe(
|
|
6
|
+
const evaluateReference = (name) => pipe(Effect.service(LionEnvironmentService), Effect.flatMap((environment) => getBinding(environment, name)), Effect.map(Option.getOrElse(() => name)));
|
|
7
7
|
//#endregion
|
|
8
8
|
export { evaluatePrimitive, evaluateReference };
|
|
9
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.mjs","names":["Str"],"sources":["../../../src/evaluation/base-forms/primitive.ts"],"sourcesContent":["import { Effect, Match, Option, pipe, String as Str } from \"effect\";\nimport { getBinding } from \"@/evaluation/environment\";\nimport type { JsonPrimitiveType } from \"@/schemas/json-primitive\";\nimport {
|
|
1
|
+
{"version":3,"file":"primitive.mjs","names":["Str"],"sources":["../../../src/evaluation/base-forms/primitive.ts"],"sourcesContent":["import { Effect, Match, Option, pipe, String as Str } from \"effect\";\nimport { getBinding } from \"@/evaluation/environment\";\nimport type { JsonPrimitiveType } from \"@/schemas/json-primitive\";\nimport { LionEnvironmentService } from \"@/services/evaluation.ts\";\n\nexport const evaluatePrimitive = (expression: JsonPrimitiveType) =>\n pipe(\n Match.value(expression),\n Match.when(Str.isString, evaluateReference),\n Match.orElse(Effect.succeed)\n );\n\nexport const evaluateReference = (name: string) =>\n pipe(\n Effect.service(LionEnvironmentService),\n Effect.flatMap((environment) => getBinding(environment, name)),\n Effect.map(Option.getOrElse(() => name))\n );\n"],"mappings":";;;;AAKA,MAAa,qBAAqB,eAChC,KACE,MAAM,MAAM,WAAW,EACvB,MAAM,KAAKA,OAAI,UAAU,kBAAkB,EAC3C,MAAM,OAAO,OAAO,QAAQ,CAC7B;AAEH,MAAa,qBAAqB,SAChC,KACE,OAAO,QAAQ,uBAAuB,EACtC,OAAO,SAAS,gBAAgB,WAAW,aAAa,KAAK,CAAC,EAC9D,OAAO,IAAI,OAAO,gBAAgB,KAAK,CAAC,CACzC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { s as LionRecordExpressionType } from "../../lion-expression-
|
|
2
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
3
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { s as LionRecordExpressionType } from "../../lion-expression-DMR7Psmu.mjs";
|
|
2
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
3
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
import * as _$
|
|
5
|
+
import * as _$effect_Schema0 from "effect/Schema";
|
|
6
6
|
|
|
7
7
|
//#region src/evaluation/base-forms/record.d.ts
|
|
8
8
|
declare const evaluateRecord: (expression: LionRecordExpressionType) => Effect.Effect<{
|
|
9
9
|
[x: string]: unknown;
|
|
10
|
-
},
|
|
10
|
+
}, _$effect_Schema0.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { evaluateRecord };
|
|
13
13
|
//# sourceMappingURL=record.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.mts","names":[],"sources":["../../../src/evaluation/base-forms/record.ts"],"mappings":";;;;;;;cAIa,cAAA,GAAkB,UAAA,EAAY,wBAAA,KAAwB,MAAA,CAAA,MAAA;EAAA;GAAA,
|
|
1
|
+
{"version":3,"file":"record.d.mts","names":[],"sources":["../../../src/evaluation/base-forms/record.ts"],"mappings":";;;;;;;cAIa,cAAA,GAAkB,UAAA,EAAY,wBAAA,KAAwB,MAAA,CAAA,MAAA;EAAA;GAAA,gBAAA,CAAA,WAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as evaluateRecord } from "../../evaluate-
|
|
1
|
+
import { r as evaluateRecord } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateRecord };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ToplevelEnvironment, r as InnerEnvironment, t as Environment } from "../environment-
|
|
1
|
+
import { a as ToplevelEnvironment, r as InnerEnvironment, t as Environment } from "../environment-BQw8BPXl.mjs";
|
|
2
2
|
import { Effect, Option } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/evaluation/environment.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.mts","names":[],"sources":["../../src/evaluation/environment.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"environment.d.mts","names":[],"sources":["../../src/evaluation/environment.ts"],"mappings":";;;;iBAWgB,eAAA,CACd,QAAA,EAAU,MAAA,oBACT,MAAA,CAAO,MAAA,CAAO,mBAAA;AAAA,iBAED,eAAA,CACd,QAAA,EAAU,MAAA,mBACV,MAAA,EAAQ,WAAA,GACP,MAAA,CAAO,MAAA,CAAO,gBAAA;AAAA,cAeJ,UAAA,GACX,WAAA,EAAa,WAAA,EACb,IAAA,aACC,MAAA,CAAO,MAAA,CAAO,MAAA,CAAO,MAAA;AAAA,cAcX,eAAA,GACX,WAAA,EAAa,WAAA,EACb,IAAA,UACA,KAAA,cACC,MAAA,CAAO,MAAA,CAAO,WAAA;AAAA,cAOJ,gBAAA,GACX,WAAA,EAAa,WAAA,EACb,IAAA,UACA,KAAA,cACC,MAAA,CAAO,MAAA,CAAO,WAAA"}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Effect, Match, Option, Record, Ref, Schema, pipe } from "effect";
|
|
1
|
+
import { Effect, Option, Record, Ref, pipe } from "effect";
|
|
3
2
|
//#region src/evaluation/environment.ts
|
|
3
|
+
const isInnerEnvironment = (environment) => "parent" in environment;
|
|
4
4
|
function makeEnvironment(bindings, parent) {
|
|
5
5
|
return Ref.make(bindings).pipe(Effect.map((bindingsRef) => typeof parent === "undefined" ? { bindingsRef } : {
|
|
6
6
|
bindingsRef,
|
|
7
7
|
parent
|
|
8
8
|
}));
|
|
9
9
|
}
|
|
10
|
-
const getBinding = (environment, name) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const getBinding = (environment, name) => Effect.gen(function* () {
|
|
11
|
+
const binding = yield* pipe(Ref.get(environment.bindingsRef), Effect.map(Record.get(name)));
|
|
12
|
+
if (Option.isSome(binding)) return binding;
|
|
13
|
+
return isInnerEnvironment(environment) ? yield* getBinding(environment.parent, name) : Option.none();
|
|
14
|
+
});
|
|
14
15
|
const setLocalBinding = (environment, name, value) => pipe(environment.bindingsRef, Ref.update(Record.set(name, value)), Effect.as(environment));
|
|
15
|
-
const setGlobalBinding = (environment, name, value) =>
|
|
16
|
+
const setGlobalBinding = (environment, name, value) => {
|
|
17
|
+
return (isInnerEnvironment(environment) ? setGlobalBinding(environment.parent, name, value) : Ref.update(environment.bindingsRef, Record.set(name, value))).pipe(Effect.as(environment));
|
|
18
|
+
};
|
|
16
19
|
//#endregion
|
|
17
20
|
export { getBinding, makeEnvironment, setGlobalBinding, setLocalBinding };
|
|
18
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.mjs","names":[],"sources":["../../src/evaluation/environment.ts"],"sourcesContent":["import { Effect,
|
|
1
|
+
{"version":3,"file":"environment.mjs","names":[],"sources":["../../src/evaluation/environment.ts"],"sourcesContent":["import { Effect, Option, pipe, Record, Ref } from \"effect\";\nimport type {\n Environment,\n InnerEnvironment,\n ToplevelEnvironment,\n} from \"@/schemas/environment\";\n\nconst isInnerEnvironment = (\n environment: Environment\n): environment is InnerEnvironment => \"parent\" in environment;\n\nexport function makeEnvironment(\n bindings: Record<string, unknown>\n): Effect.Effect<ToplevelEnvironment>;\n\nexport function makeEnvironment(\n bindings: Record<string, unknown>,\n parent: Environment\n): Effect.Effect<InnerEnvironment>;\n\nexport function makeEnvironment(\n bindings: Record<string, unknown>,\n parent?: Environment\n) {\n return Ref.make(bindings).pipe(\n Effect.map((bindingsRef) =>\n typeof parent === \"undefined\"\n ? ({ bindingsRef } as ToplevelEnvironment)\n : ({ bindingsRef, parent } as InnerEnvironment)\n )\n );\n}\n\nexport const getBinding = (\n environment: Environment,\n name: string\n): Effect.Effect<Option.Option<unknown>> =>\n Effect.gen(function* () {\n const binding = yield* pipe(\n Ref.get(environment.bindingsRef),\n Effect.map(Record.get(name))\n );\n if (Option.isSome(binding)) {\n return binding;\n }\n return isInnerEnvironment(environment)\n ? yield* getBinding(environment.parent, name)\n : Option.none();\n });\n\nexport const setLocalBinding = (\n environment: Environment,\n name: string,\n value: unknown\n): Effect.Effect<Environment> =>\n pipe(\n environment.bindingsRef,\n Ref.update(Record.set(name, value)),\n Effect.as(environment)\n );\n\nexport const setGlobalBinding = (\n environment: Environment,\n name: string,\n value: unknown\n): Effect.Effect<Environment> => {\n const update = isInnerEnvironment(environment)\n ? setGlobalBinding(environment.parent, name, value)\n : Ref.update(environment.bindingsRef, Record.set(name, value));\n return update.pipe(Effect.as(environment));\n};\n"],"mappings":";;AAOA,MAAM,sBACJ,gBACoC,YAAY;AAWlD,SAAgB,gBACd,UACA,QACA;AACA,QAAO,IAAI,KAAK,SAAS,CAAC,KACxB,OAAO,KAAK,gBACV,OAAO,WAAW,cACb,EAAE,aAAa,GACf;EAAE;EAAa;EAAQ,CAC7B,CACF;;AAGH,MAAa,cACX,aACA,SAEA,OAAO,IAAI,aAAa;CACtB,MAAM,UAAU,OAAO,KACrB,IAAI,IAAI,YAAY,YAAY,EAChC,OAAO,IAAI,OAAO,IAAI,KAAK,CAAC,CAC7B;AACD,KAAI,OAAO,OAAO,QAAQ,CACxB,QAAO;AAET,QAAO,mBAAmB,YAAY,GAClC,OAAO,WAAW,YAAY,QAAQ,KAAK,GAC3C,OAAO,MAAM;EACjB;AAEJ,MAAa,mBACX,aACA,MACA,UAEA,KACE,YAAY,aACZ,IAAI,OAAO,OAAO,IAAI,MAAM,MAAM,CAAC,EACnC,OAAO,GAAG,YAAY,CACvB;AAEH,MAAa,oBACX,aACA,MACA,UAC+B;AAI/B,SAHe,mBAAmB,YAAY,GAC1C,iBAAiB,YAAY,QAAQ,MAAM,MAAM,GACjD,IAAI,OAAO,YAAY,aAAa,OAAO,IAAI,MAAM,MAAM,CAAC,EAClD,KAAK,OAAO,GAAG,YAAY,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { a as LionExpressionType } from "../lion-expression-
|
|
2
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../evaluation-
|
|
3
|
-
import { t as EvaluateResult } from "../evaluation-
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import * as _$effect_ParseResult0 from "effect/ParseResult";
|
|
1
|
+
import { a as LionExpressionType } from "../lion-expression-DMR7Psmu.mjs";
|
|
2
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../evaluation-B6K0DbPS.mjs";
|
|
3
|
+
import { t as EvaluateResult } from "../evaluation-Dwo4KN_D.mjs";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
6
5
|
|
|
7
6
|
//#region src/evaluation/evaluate.d.ts
|
|
8
7
|
declare const evaluate: (expression: LionExpressionType) => EvaluateResult;
|
|
9
|
-
declare const run: (expression: unknown, environment: Record<string, unknown>) => Effect.Effect<unknown,
|
|
8
|
+
declare const run: (expression: unknown, environment: Record<string, unknown>) => Effect.Effect<unknown, Schema.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, never>;
|
|
10
9
|
//#endregion
|
|
11
10
|
export { evaluate, run };
|
|
12
11
|
//# sourceMappingURL=evaluate.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.mts","names":[],"sources":["../../src/evaluation/evaluate.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"evaluate.d.mts","names":[],"sources":["../../src/evaluation/evaluate.ts"],"mappings":";;;;;;cAca,QAAA,GAAY,UAAA,EAAY,kBAAA,KAAqB,cAAA;AAAA,cAU7C,GAAA,GACX,UAAA,WACA,WAAA,EAAa,MAAA,sBAAuB,MAAA,CAAA,MAAA,UAAA,MAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as run, t as evaluate } from "../evaluate-
|
|
1
|
+
import { n as run, t as evaluate } from "../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluate, run };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { BeginFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
import * as _$
|
|
5
|
+
import * as _$effect_Schema0 from "effect/Schema";
|
|
6
6
|
|
|
7
7
|
//#region src/evaluation/special-forms/begin.d.ts
|
|
8
|
-
declare const evaluateBegin: ([_, ...args]: typeof BeginFormSchema.Type) => Effect.Effect<unknown,
|
|
8
|
+
declare const evaluateBegin: ([_, ...args]: typeof BeginFormSchema.Type) => Effect.Effect<unknown, _$effect_Schema0.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { evaluateBegin };
|
|
11
11
|
//# sourceMappingURL=begin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"begin.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/begin.ts"],"mappings":";;;;;;;cAIa,aAAA,IAAiB,CAAA,KAAA,IAAA,UAAqB,eAAA,CAAgB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,
|
|
1
|
+
{"version":3,"file":"begin.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/begin.ts"],"mappings":";;;;;;;cAIa,aAAA,IAAiB,CAAA,KAAA,IAAA,UAAqB,eAAA,CAAgB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,gBAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as evaluateBegin } from "../../evaluate-
|
|
1
|
+
import { d as evaluateBegin } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateBegin };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { CondFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import * as _$effect_ParseResult0 from "effect/ParseResult";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
6
5
|
|
|
7
6
|
//#region src/evaluation/special-forms/cond.d.ts
|
|
8
|
-
declare const evaluateCond: (expression: typeof CondFormSchema.Type) => Effect.Effect<unknown,
|
|
7
|
+
declare const evaluateCond: (expression: typeof CondFormSchema.Type) => Effect.Effect<unknown, Schema.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
8
|
//#endregion
|
|
10
9
|
export { evaluateCond };
|
|
11
10
|
//# sourceMappingURL=cond.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cond.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/cond.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cond.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/cond.ts"],"mappings":";;;;;;cAQa,YAAA,GAAgB,UAAA,SAAmB,cAAA,CAAe,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,MAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { u as evaluateCond } from "../../evaluate-
|
|
1
|
+
import { u as evaluateCond } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateCond };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { DefineFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
import * as _$
|
|
5
|
+
import * as _$effect_Schema0 from "effect/Schema";
|
|
6
6
|
|
|
7
7
|
//#region src/evaluation/special-forms/define.d.ts
|
|
8
|
-
declare const evaluateDefine: ([_, id, expr]: typeof DefineFormSchema.Type) => Effect.Effect<unknown,
|
|
8
|
+
declare const evaluateDefine: ([_, id, expr]: typeof DefineFormSchema.Type) => Effect.Effect<unknown, _$effect_Schema0.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { evaluateDefine };
|
|
11
11
|
//# sourceMappingURL=define.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/define.ts"],"mappings":";;;;;;;cAMa,cAAA,IAAkB,CAAA,EAAA,EAAA,EAAA,IAAA,UAAsB,gBAAA,CAAiB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,
|
|
1
|
+
{"version":3,"file":"define.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/define.ts"],"mappings":";;;;;;;cAMa,cAAA,IAAkB,CAAA,EAAA,EAAA,EAAA,IAAA,UAAsB,gBAAA,CAAiB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,gBAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { l as evaluateDefine } from "../../evaluate-
|
|
1
|
+
import { l as evaluateDefine } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateDefine };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { EvalFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import * as _$effect_ParseResult0 from "effect/ParseResult";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
6
5
|
|
|
7
6
|
//#region src/evaluation/special-forms/eval.d.ts
|
|
8
|
-
declare const evaluateEval: ([_, args]: typeof EvalFormSchema.Type) => Effect.Effect<unknown,
|
|
7
|
+
declare const evaluateEval: ([_, args]: typeof EvalFormSchema.Type) => Effect.Effect<unknown, Schema.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
8
|
//#endregion
|
|
10
9
|
export { evaluateEval };
|
|
11
10
|
//# sourceMappingURL=eval.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/eval.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"eval.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/eval.ts"],"mappings":";;;;;;cAKa,YAAA,IAAgB,CAAA,EAAA,IAAA,UAAkB,cAAA,CAAe,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,MAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as evaluateEval } from "../../evaluate-
|
|
1
|
+
import { c as evaluateEval } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateEval };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { FunctionCallFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import * as _$effect_ParseResult0 from "effect/ParseResult";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
6
5
|
|
|
7
6
|
//#region src/evaluation/special-forms/function.d.ts
|
|
8
|
-
declare const evaluateFunctionCall: (functionCallExpression: typeof FunctionCallFormSchema.Type) => Effect.Effect<unknown,
|
|
7
|
+
declare const evaluateFunctionCall: (functionCallExpression: typeof FunctionCallFormSchema.Type) => Effect.Effect<unknown, Schema.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
8
|
//#endregion
|
|
10
9
|
export { evaluateFunctionCall };
|
|
11
10
|
//# sourceMappingURL=function.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/function.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"function.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/function.ts"],"mappings":";;;;;;cAQa,oBAAA,GACX,sBAAA,SAA+B,sBAAA,CAAuB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,MAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { s as evaluateFunctionCall } from "../../evaluate-
|
|
1
|
+
import { s as evaluateFunctionCall } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateFunctionCall };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { LambdaFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
import * as _$
|
|
5
|
+
import * as _$effect_Schema0 from "effect/Schema";
|
|
6
6
|
|
|
7
7
|
//#region src/evaluation/special-forms/lambda.d.ts
|
|
8
|
-
declare const evaluateLambda: ([_, parameters, bodyExpression]: typeof LambdaFormSchema.Type) => Effect.Effect<(...args: unknown[]) => Effect.Effect<unknown,
|
|
8
|
+
declare const evaluateLambda: ([_, parameters, bodyExpression]: typeof LambdaFormSchema.Type) => Effect.Effect<(...args: unknown[]) => Effect.Effect<unknown, _$effect_Schema0.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, never>, never, LionEnvironmentService>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { evaluateLambda };
|
|
11
11
|
//# sourceMappingURL=lambda.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/lambda.ts"],"mappings":";;;;;;;cAOa,cAAA,IAAkB,CAAA,EAAA,UAAA,EAAA,cAAA,UAIrB,gBAAA,CAAiB,IAAA,KAAI,MAAA,CAAA,MAAA,KAAA,IAAA,gBAAA,MAAA,CAAA,MAAA,UAAA,
|
|
1
|
+
{"version":3,"file":"lambda.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/lambda.ts"],"mappings":";;;;;;;cAOa,cAAA,IAAkB,CAAA,EAAA,UAAA,EAAA,cAAA,UAIrB,gBAAA,CAAiB,IAAA,KAAI,MAAA,CAAA,MAAA,KAAA,IAAA,gBAAA,MAAA,CAAA,MAAA,UAAA,gBAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,iBAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { o as evaluateLambda } from "../../evaluate-
|
|
1
|
+
import { o as evaluateLambda } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateLambda };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-
|
|
2
|
-
import { t as LionEnvironmentService } from "../../evaluation-
|
|
1
|
+
import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-B6K0DbPS.mjs";
|
|
2
|
+
import { t as LionEnvironmentService } from "../../evaluation-Bs36vy1h.mjs";
|
|
3
3
|
import { MatchFormSchema } from "../../schemas/evaluation.mjs";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import * as _$effect_ParseResult0 from "effect/ParseResult";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
6
5
|
|
|
7
6
|
//#region src/evaluation/special-forms/match.d.ts
|
|
8
|
-
declare const evaluateMatch: ([_,
|
|
7
|
+
declare const evaluateMatch: ([_, valueExpression, ...patternExpressions]: typeof MatchFormSchema.Type) => Effect.Effect<unknown, Schema.SchemaError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
|
|
9
8
|
//#endregion
|
|
10
9
|
export { evaluateMatch };
|
|
11
10
|
//# sourceMappingURL=match.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/match.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"match.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/match.ts"],"mappings":";;;;;;cA+Fa,aAAA,IAAiB,CAAA,EAAA,eAAA,KAAA,kBAAA,UAIpB,eAAA,CAAgB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,MAAA,CAAA,WAAA,GAAA,qBAAA,GAAA,wBAAA,EAAA,sBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as evaluateMatch } from "../../evaluate-
|
|
1
|
+
import { a as evaluateMatch } from "../../evaluate-BJOG7kaS.mjs";
|
|
2
2
|
export { evaluateMatch };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as AssumedExpressionType } from "./lion-expression-DMR7Psmu.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import * as _$effect_Cause0 from "effect/Cause";
|
|
4
|
+
|
|
5
|
+
//#region src/errors/evaluation.d.ts
|
|
6
|
+
declare const ArgumentMismatchError_base: Schema.Class<ArgumentMismatchError, Schema.TaggedStruct<"ArgumentMismatchError", {}>, _$effect_Cause0.YieldableError>;
|
|
7
|
+
declare class ArgumentMismatchError extends ArgumentMismatchError_base {}
|
|
8
|
+
declare const InvalidFunctionCallError_base: Schema.Class<InvalidFunctionCallError, Schema.TaggedStruct<"InvalidFunctionCallError", {
|
|
9
|
+
readonly expression: Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.suspend<Schema.Codec<AssumedExpressionType, AssumedExpressionType, never, never>>>, Schema.$Record<Schema.String, Schema.suspend<Schema.Codec<AssumedExpressionType, AssumedExpressionType, never, never>>>]>;
|
|
10
|
+
}>, _$effect_Cause0.YieldableError>;
|
|
11
|
+
declare class InvalidFunctionCallError extends InvalidFunctionCallError_base {}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { InvalidFunctionCallError as n, ArgumentMismatchError as t };
|
|
14
|
+
//# sourceMappingURL=evaluation-B6K0DbPS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation-B6K0DbPS.d.mts","names":[],"sources":["../src/errors/evaluation.ts"],"mappings":";;;;;cAAgC,0BAAA;cAGnB,qBAAA,SAA8B,0BAAA;AAAA,cAGvC,6BAAA;;;cAES,wBAAA,SAAiC,6BAAA"}
|