@lionlang/core 0.1.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.
Files changed (119) hide show
  1. package/README.md +15 -0
  2. package/dist/environment-k2Uf6VVc.d.mts +25 -0
  3. package/dist/environment-k2Uf6VVc.d.mts.map +1 -0
  4. package/dist/errors/evaluation.d.mts +2 -0
  5. package/dist/errors/evaluation.mjs +9 -0
  6. package/dist/errors/evaluation.mjs.map +1 -0
  7. package/dist/evaluate-D7ODMrbg.mjs +84 -0
  8. package/dist/evaluate-D7ODMrbg.mjs.map +1 -0
  9. package/dist/evaluation/base-forms/array.d.mts +11 -0
  10. package/dist/evaluation/base-forms/array.d.mts.map +1 -0
  11. package/dist/evaluation/base-forms/array.mjs +2 -0
  12. package/dist/evaluation/base-forms/primitive.d.mts +10 -0
  13. package/dist/evaluation/base-forms/primitive.d.mts.map +1 -0
  14. package/dist/evaluation/base-forms/primitive.mjs +10 -0
  15. package/dist/evaluation/base-forms/primitive.mjs.map +1 -0
  16. package/dist/evaluation/base-forms/record.d.mts +13 -0
  17. package/dist/evaluation/base-forms/record.d.mts.map +1 -0
  18. package/dist/evaluation/base-forms/record.mjs +2 -0
  19. package/dist/evaluation/environment.d.mts +12 -0
  20. package/dist/evaluation/environment.d.mts.map +1 -0
  21. package/dist/evaluation/environment.mjs +19 -0
  22. package/dist/evaluation/environment.mjs.map +1 -0
  23. package/dist/evaluation/evaluate.d.mts +12 -0
  24. package/dist/evaluation/evaluate.d.mts.map +1 -0
  25. package/dist/evaluation/evaluate.mjs +2 -0
  26. package/dist/evaluation/special-forms/begin.d.mts +11 -0
  27. package/dist/evaluation/special-forms/begin.d.mts.map +1 -0
  28. package/dist/evaluation/special-forms/begin.mjs +2 -0
  29. package/dist/evaluation/special-forms/cond.d.mts +11 -0
  30. package/dist/evaluation/special-forms/cond.d.mts.map +1 -0
  31. package/dist/evaluation/special-forms/cond.mjs +2 -0
  32. package/dist/evaluation/special-forms/define.d.mts +11 -0
  33. package/dist/evaluation/special-forms/define.d.mts.map +1 -0
  34. package/dist/evaluation/special-forms/define.mjs +2 -0
  35. package/dist/evaluation/special-forms/eval.d.mts +11 -0
  36. package/dist/evaluation/special-forms/eval.d.mts.map +1 -0
  37. package/dist/evaluation/special-forms/eval.mjs +2 -0
  38. package/dist/evaluation/special-forms/function.d.mts +11 -0
  39. package/dist/evaluation/special-forms/function.d.mts.map +1 -0
  40. package/dist/evaluation/special-forms/function.mjs +2 -0
  41. package/dist/evaluation/special-forms/lambda.d.mts +11 -0
  42. package/dist/evaluation/special-forms/lambda.d.mts.map +1 -0
  43. package/dist/evaluation/special-forms/lambda.mjs +2 -0
  44. package/dist/evaluation/special-forms/match.d.mts +11 -0
  45. package/dist/evaluation/special-forms/match.d.mts.map +1 -0
  46. package/dist/evaluation/special-forms/match.mjs +2 -0
  47. package/dist/evaluation/special-forms/quote.d.mts +11 -0
  48. package/dist/evaluation/special-forms/quote.d.mts.map +1 -0
  49. package/dist/evaluation/special-forms/quote.mjs +7 -0
  50. package/dist/evaluation/special-forms/quote.mjs.map +1 -0
  51. package/dist/evaluation-AblffSQw.d.mts +17 -0
  52. package/dist/evaluation-AblffSQw.d.mts.map +1 -0
  53. package/dist/evaluation-EqzK8tQV.d.mts +13 -0
  54. package/dist/evaluation-EqzK8tQV.d.mts.map +1 -0
  55. package/dist/evaluation-uwZSKxIf.d.mts +10 -0
  56. package/dist/evaluation-uwZSKxIf.d.mts.map +1 -0
  57. package/dist/json-primitive-DUaaoNff.d.mts +8 -0
  58. package/dist/json-primitive-DUaaoNff.d.mts.map +1 -0
  59. package/dist/lion-expression-6Y3itx9l.d.mts +16 -0
  60. package/dist/lion-expression-6Y3itx9l.d.mts.map +1 -0
  61. package/dist/modules/array.d.mts +19 -0
  62. package/dist/modules/array.d.mts.map +1 -0
  63. package/dist/modules/array.mjs +23 -0
  64. package/dist/modules/array.mjs.map +1 -0
  65. package/dist/modules/boolean.d.mts +17 -0
  66. package/dist/modules/boolean.d.mts.map +1 -0
  67. package/dist/modules/boolean.mjs +17 -0
  68. package/dist/modules/boolean.mjs.map +1 -0
  69. package/dist/modules/console.d.mts +10 -0
  70. package/dist/modules/console.d.mts.map +1 -0
  71. package/dist/modules/console.mjs +10 -0
  72. package/dist/modules/console.mjs.map +1 -0
  73. package/dist/modules/func.d.mts +13 -0
  74. package/dist/modules/func.d.mts.map +1 -0
  75. package/dist/modules/func.mjs +28 -0
  76. package/dist/modules/func.mjs.map +1 -0
  77. package/dist/modules/index.d.mts +8 -0
  78. package/dist/modules/index.d.mts.map +1 -0
  79. package/dist/modules/index.mjs +31 -0
  80. package/dist/modules/index.mjs.map +1 -0
  81. package/dist/modules/lib/shared.d.mts +9 -0
  82. package/dist/modules/lib/shared.d.mts.map +1 -0
  83. package/dist/modules/lib/shared.mjs +7 -0
  84. package/dist/modules/lib/shared.mjs.map +1 -0
  85. package/dist/modules/number.d.mts +19 -0
  86. package/dist/modules/number.d.mts.map +1 -0
  87. package/dist/modules/number.mjs +19 -0
  88. package/dist/modules/number.mjs.map +1 -0
  89. package/dist/modules/object.d.mts +86 -0
  90. package/dist/modules/object.d.mts.map +1 -0
  91. package/dist/modules/object.mjs +154 -0
  92. package/dist/modules/object.mjs.map +1 -0
  93. package/dist/modules/string.d.mts +18 -0
  94. package/dist/modules/string.d.mts.map +1 -0
  95. package/dist/modules/string.mjs +17 -0
  96. package/dist/modules/string.mjs.map +1 -0
  97. package/dist/modules/value.d.mts +19 -0
  98. package/dist/modules/value.d.mts.map +1 -0
  99. package/dist/modules/value.mjs +19 -0
  100. package/dist/modules/value.mjs.map +1 -0
  101. package/dist/schemas/environment.d.mts +2 -0
  102. package/dist/schemas/environment.mjs +14 -0
  103. package/dist/schemas/environment.mjs.map +1 -0
  104. package/dist/schemas/evaluation.d.mts +24 -0
  105. package/dist/schemas/evaluation.d.mts.map +1 -0
  106. package/dist/schemas/evaluation.mjs +38 -0
  107. package/dist/schemas/evaluation.mjs.map +1 -0
  108. package/dist/schemas/json-primitive.d.mts +2 -0
  109. package/dist/schemas/json-primitive.mjs +7 -0
  110. package/dist/schemas/json-primitive.mjs.map +1 -0
  111. package/dist/schemas/lion-expression.d.mts +2 -0
  112. package/dist/schemas/lion-expression.mjs +14 -0
  113. package/dist/schemas/lion-expression.mjs.map +1 -0
  114. package/dist/services/evaluation.d.mts +2 -0
  115. package/dist/services/evaluation.mjs +8 -0
  116. package/dist/services/evaluation.mjs.map +1 -0
  117. package/dist/types/evaluation.d.mts +2 -0
  118. package/dist/types/evaluation.mjs +1 -0
  119. package/package.json +69 -0
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @lionlang/core
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.1. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,25 @@
1
+ import { Ref, Schema } from "effect";
2
+
3
+ //#region src/schemas/environment.d.ts
4
+ type BindingsRef = Ref.Ref<Record<string, unknown>>;
5
+ interface InnerEnvironment {
6
+ readonly bindingsRef: BindingsRef;
7
+ readonly parent: Environment;
8
+ }
9
+ type Environment = typeof EnvironmentSchema.Type;
10
+ type ToplevelEnvironment = typeof ToplevelEnvironmentSchema.Type;
11
+ declare const ToplevelEnvironmentSchema: Schema.Struct<{
12
+ bindingsRef: Schema.Schema<BindingsRef, BindingsRef, never>;
13
+ }>;
14
+ declare const EnvironmentSchema: Schema.Union<[Schema.Struct<{
15
+ bindingsRef: Schema.Schema<BindingsRef, BindingsRef, never>;
16
+ }>, Schema.suspend<InnerEnvironment, InnerEnvironment, never>]>;
17
+ declare const InnerEnvironmentSchema: Schema.Struct<{
18
+ bindingsRef: Schema.Schema<BindingsRef, BindingsRef, never>;
19
+ parent: Schema.Union<[Schema.Struct<{
20
+ bindingsRef: Schema.Schema<BindingsRef, BindingsRef, never>;
21
+ }>, Schema.suspend<InnerEnvironment, InnerEnvironment, never>]>;
22
+ }>;
23
+ //#endregion
24
+ export { ToplevelEnvironment as a, InnerEnvironmentSchema as i, EnvironmentSchema as n, ToplevelEnvironmentSchema as o, InnerEnvironment as r, Environment as t };
25
+ //# sourceMappingURL=environment-k2Uf6VVc.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment-k2Uf6VVc.d.mts","names":[],"sources":["../src/schemas/environment.ts"],"mappings":";;;KAEK,WAAA,GAAc,GAAA,CAAI,GAAA,CAAI,MAAA;AAAA,UAQV,gBAAA;EAAA,SACN,WAAA,EAAa,WAAA;EAAA,SACb,MAAA,EAAQ,WAAA;AAAA;AAAA,KAGP,WAAA,UAAqB,iBAAA,CAAkB,IAAA;AAAA,KAEvC,mBAAA,UAA6B,yBAAA,CAA0B,IAAA;AAAA,cAEtD,yBAAA,EAAyB,MAAA,CAAA,MAAA;;;cAIzB,iBAAA,EAAiB,MAAA,CAAA,KAAA,EAAA,MAAA,CAAA,MAAA;;;cAKjB,sBAAA,EAAsB,MAAA,CAAA,MAAA"}
@@ -0,0 +1,2 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../evaluation-AblffSQw.mjs";
2
+ export { ArgumentMismatchError, InvalidFunctionCallError };
@@ -0,0 +1,9 @@
1
+ import { LionExpressionSchema } from "../schemas/lion-expression.mjs";
2
+ import { Schema } from "effect";
3
+ //#region src/errors/evaluation.ts
4
+ var ArgumentMismatchError = class extends Schema.TaggedError("ArgumentMismatchError")("ArgumentMismatchError", {}) {};
5
+ var InvalidFunctionCallError = class extends Schema.TaggedError("InvalidFunctionCallError")("InvalidFunctionCallError", { expression: LionExpressionSchema }) {};
6
+ //#endregion
7
+ export { ArgumentMismatchError, InvalidFunctionCallError };
8
+
9
+ //# sourceMappingURL=evaluation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation.mjs","names":[],"sources":["../../src/errors/evaluation.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { LionExpressionSchema } from \"@/schemas/lion-expression\";\n\nexport class ArgumentMismatchError extends Schema.TaggedError<ArgumentMismatchError>(\n \"ArgumentMismatchError\"\n)(\"ArgumentMismatchError\", {}) {}\n\nexport class InvalidFunctionCallError extends Schema.TaggedError<InvalidFunctionCallError>(\n \"InvalidFunctionCallError\"\n)(\"InvalidFunctionCallError\", { expression: LionExpressionSchema }) {}\n"],"mappings":";;;AAGA,IAAa,wBAAb,cAA2C,OAAO,YAChD,wBACD,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAE/B,IAAa,2BAAb,cAA8C,OAAO,YACnD,2BACD,CAAC,4BAA4B,EAAE,YAAY,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { JsonPrimitiveSchema } from "./schemas/json-primitive.mjs";
2
+ import { LionArrayExpressionSchema, LionExpressionSchema, LionRecordExpressionSchema } from "./schemas/lion-expression.mjs";
3
+ import { ArgumentMismatchError, InvalidFunctionCallError } from "./errors/evaluation.mjs";
4
+ import { makeEnvironment, setGlobalBinding } from "./evaluation/environment.mjs";
5
+ import { BeginFormSchema, CondFormSchema, CondFormWithElseSchema, CondFormWithoutElseSchema, DefineFormSchema, EvalFormSchema, FunctionCallFormSchema, LambdaFormSchema, LionFunctionValueSchema, MatchFormSchema, MatchPatternSchema, QuoteFormSchema } from "./schemas/evaluation.mjs";
6
+ import { LionEnvironmentService, getService } from "./services/evaluation.mjs";
7
+ import { evaluateQuote } from "./evaluation/special-forms/quote.mjs";
8
+ import { evaluatePrimitive } from "./evaluation/base-forms/primitive.mjs";
9
+ import { Array, Effect, Match, Option, Record, Schema, pipe } from "effect";
10
+ //#region src/evaluation/special-forms/begin.ts
11
+ const evaluateBegin = ([_, ...args]) => pipe(Array.map(args, evaluate), Effect.all, Effect.map(Array.last), Effect.map(Option.getOrElse(() => [])));
12
+ //#endregion
13
+ //#region src/evaluation/special-forms/cond.ts
14
+ const evaluateCond = (expression) => pipe(Match.value(expression), Match.when(Schema.is(CondFormWithoutElseSchema), (exprWithoutElse) => Effect.gen(function* () {
15
+ const [_, ...cases] = exprWithoutElse;
16
+ for (const [condition, result] of cases) if (yield* evaluate(condition)) return yield* evaluate(result);
17
+ return null;
18
+ })), Match.when(Schema.is(CondFormWithElseSchema), (expression) => Effect.gen(function* () {
19
+ const [_, ...cases] = expression;
20
+ for (const [condition, result] of Array.initNonEmpty(cases)) if (yield* evaluate(condition)) return yield* evaluate(result);
21
+ return yield* evaluate(Array.lastNonEmpty(cases));
22
+ })), Match.exhaustive);
23
+ //#endregion
24
+ //#region src/evaluation/special-forms/define.ts
25
+ const evaluateDefine = ([_, id, expr]) => pipe(Effect.Do, Effect.bind("environment", () => getService(LionEnvironmentService)), Effect.bind("value", () => evaluate(expr)), Effect.flatMap(({ environment, value }) => pipe(setGlobalBinding(environment, id, value), Effect.map(() => value))));
26
+ //#endregion
27
+ //#region src/evaluation/special-forms/eval.ts
28
+ const evaluateEval = ([_, args]) => pipe(evaluate(args), Effect.flatMap(Schema.decodeUnknown(LionExpressionSchema)), Effect.flatMap(evaluate));
29
+ //#endregion
30
+ //#region src/evaluation/special-forms/function.ts
31
+ 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) => {
32
+ const result = fn(...tail);
33
+ return Effect.isEffect(result) ? result : Effect.succeed(result);
34
+ }), Match.orElse(() => Effect.fail(new InvalidFunctionCallError({ expression: functionCallExpression }))))));
35
+ //#endregion
36
+ //#region src/evaluation/special-forms/lambda.ts
37
+ const evaluateLambda = ([_, parameters, bodyExpression]) => Effect.gen(function* () {
38
+ const enclosedEnvironment = yield* getService(LionEnvironmentService);
39
+ return Effect.fn(function* (...args) {
40
+ if (args.length < parameters.length) return yield* new ArgumentMismatchError();
41
+ const environment = yield* makeEnvironment(Record.fromEntries(Array.zip(parameters, args)), enclosedEnvironment);
42
+ return yield* evaluate(bodyExpression).pipe(Effect.provideService(LionEnvironmentService, environment));
43
+ });
44
+ });
45
+ //#endregion
46
+ //#region src/evaluation/special-forms/match.ts
47
+ const MatchPredicateRecordSchema = Schema.Record({
48
+ key: Schema.String,
49
+ value: Schema.suspend(() => MatchPredicateSchema)
50
+ });
51
+ const MatchPredicateSchema = Schema.Union(MatchPredicateRecordSchema, LionFunctionValueSchema);
52
+ const AnyRecordSchema = Schema.Record({
53
+ key: Schema.String,
54
+ value: Schema.Any
55
+ });
56
+ const evaluatePredicate = (value, predicate) => pipe(Match.value(predicate), Match.when(Schema.is(MatchPredicateRecordSchema), (record) => Effect.gen(function* () {
57
+ if (!Schema.is(AnyRecordSchema)(value)) return false;
58
+ if (!Record.keys(record).every((key) => Record.has(value, key))) return false;
59
+ let result = true;
60
+ for (const [recordKey, recordValue] of Record.toEntries(record)) {
61
+ const recordValueResult = yield* evaluatePredicate(value[recordKey], recordValue);
62
+ result = result && recordValueResult;
63
+ }
64
+ return result;
65
+ })), Match.when(Schema.is(LionFunctionValueSchema), (predicateFn) => pipe(predicateFn(value), Effect.flatMap(Schema.decodeUnknown(Schema.Boolean)), Effect.catchAll(() => Effect.succeed(false)))), Match.orElseAbsurd);
66
+ const evaluateMatchPatterns = (value, patternExprs) => pipe(Array.head(patternExprs), Option.getOrThrow, Match.value, Match.when(Schema.is(MatchPatternSchema), ([predicateExpr, fnExpr]) => pipe(Effect.Do, Effect.bind("predicate", () => evaluate(predicateExpr)), Effect.bind("fn", () => pipe(evaluate(fnExpr), Effect.flatMap(Schema.decodeUnknown(LionFunctionValueSchema)))), Effect.flatMap(({ predicate, fn }) => pipe(Schema.decodeUnknown(MatchPredicateSchema)(predicate), Effect.flatMap((predicate) => evaluatePredicate(value, predicate)), Effect.if({
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)));
71
+ //#endregion
72
+ //#region src/evaluation/base-forms/array.ts
73
+ const evaluateArray = (expression) => pipe(Match.value(expression), Match.when(Array.isEmptyReadonlyArray, 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
+ //#endregion
75
+ //#region src/evaluation/base-forms/record.ts
76
+ const evaluateRecord = (expression) => pipe(expression, Record.map(evaluate), Effect.all);
77
+ //#endregion
78
+ //#region src/evaluation/evaluate.ts
79
+ const evaluate = (expression) => pipe(Match.value(expression), Match.when(Schema.is(LionArrayExpressionSchema), (_) => evaluateArray(_)), Match.when(Schema.is(LionRecordExpressionSchema), (_) => evaluateRecord(_)), Match.when(Schema.is(JsonPrimitiveSchema), (_) => evaluatePrimitive(_)), Match.exhaustive);
80
+ const run = (expression, environment) => pipe(Schema.decodeUnknown(LionExpressionSchema)(expression), Effect.flatMap(evaluate), Effect.provideServiceEffect(LionEnvironmentService, makeEnvironment(environment)));
81
+ //#endregion
82
+ 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
+
84
+ //# sourceMappingURL=evaluate-D7ODMrbg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate-D7ODMrbg.mjs","names":["Arr","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 { getService, LionEnvironmentService } from \"@/services/evaluation\";\n\nexport const evaluateDefine = ([_, id, expr]: typeof DefineFormSchema.Type) =>\n pipe(\n Effect.Do,\n Effect.bind(\"environment\", () => getService(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.decodeUnknown(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 { getService, 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* getService(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 {\n Array as Arr,\n Effect,\n Match,\n Option,\n pipe,\n Record,\n Schema,\n} from \"effect\";\nimport { evaluate } from \"@/evaluation/evaluate\";\nimport {\n LionFunctionValueSchema,\n type MatchFormSchema,\n MatchPatternSchema,\n} from \"@/schemas/evaluation\";\nimport { 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 key: Schema.String,\n value: Schema.suspend(\n (): Schema.Schema<AssumedMatchPredicateType> => MatchPredicateSchema\n ),\n});\n\nconst MatchPredicateSchema = Schema.Union(\n MatchPredicateRecordSchema,\n LionFunctionValueSchema\n);\n\nconst AnyRecordSchema = Schema.Record({\n key: Schema.String,\n value: Schema.Any,\n});\n\nconst evaluatePredicate = (\n value: unknown,\n predicate: typeof MatchPredicateSchema.Type\n): Effect.Effect<boolean, never, LionEnvironmentService> =>\n pipe(\n Match.value(predicate),\n Match.when(Schema.is(MatchPredicateRecordSchema), (record) =>\n Effect.gen(function* () {\n if (!Schema.is(AnyRecordSchema)(value)) {\n return false;\n }\n\n if (!Record.keys(record).every((key) => Record.has(value, key))) {\n return false;\n }\n\n let result = true;\n for (const [recordKey, recordValue] of Record.toEntries(record)) {\n const recordValueResult = yield* evaluatePredicate(\n value[recordKey],\n recordValue\n );\n result = result && recordValueResult;\n }\n\n return result;\n })\n ),\n Match.when(Schema.is(LionFunctionValueSchema), (predicateFn) =>\n pipe(\n predicateFn(value),\n Effect.flatMap(Schema.decodeUnknown(Schema.Boolean)),\n Effect.catchAll(() => Effect.succeed(false))\n )\n ),\n Match.orElseAbsurd\n );\n\nconst evaluateMatchPatterns = (\n value: unknown,\n patternExprs: (\n | typeof MatchPatternSchema.Type\n | typeof LionExpressionSchema.Type\n )[]\n): EvaluateResult =>\n pipe(\n Arr.head(patternExprs),\n Option.getOrThrow,\n Match.value,\n Match.when(Schema.is(MatchPatternSchema), ([predicateExpr, fnExpr]) =>\n pipe(\n Effect.Do,\n Effect.bind(\"predicate\", () => evaluate(predicateExpr)),\n Effect.bind(\"fn\", () =>\n pipe(\n evaluate(fnExpr),\n Effect.flatMap(Schema.decodeUnknown(LionFunctionValueSchema))\n )\n ),\n Effect.flatMap(({ predicate, fn }) =>\n pipe(\n Schema.decodeUnknown(MatchPredicateSchema)(predicate),\n Effect.flatMap((predicate) => evaluatePredicate(value, predicate)),\n Effect.if({\n onTrue: () => fn(value),\n onFalse: () =>\n pipe(Arr.tail(patternExprs), Option.getOrThrow, (tail) =>\n evaluateMatchPatterns(value, tail)\n ),\n })\n )\n )\n )\n ),\n Match.when(Schema.is(LionExpressionSchema), (fallbackFn) =>\n pipe(\n evaluate(fallbackFn),\n Effect.flatMap(Schema.decodeUnknown(LionFunctionValueSchema)),\n Effect.flatMap((fallbackFn) => fallbackFn(value))\n )\n ),\n Match.exhaustive\n );\n\nexport const evaluateMatch = ([\n _,\n valueExpr,\n ...patternExprs\n]: typeof MatchFormSchema.Type) =>\n pipe(\n evaluate(valueExpr),\n Effect.flatMap((value) => evaluateMatchPatterns(value, patternExprs))\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.isEmptyReadonlyArray, 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, Match, 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 { JsonPrimitiveSchema } from \"@/schemas/json-primitive\";\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 pipe(\n Match.value(expression),\n Match.when(Schema.is(LionArrayExpressionSchema), (_) => evaluateArray(_)),\n Match.when(Schema.is(LionRecordExpressionSchema), (_) => evaluateRecord(_)),\n Match.when(Schema.is(JsonPrimitiveSchema), (_) => evaluatePrimitive(_)),\n Match.exhaustive\n );\n\nexport const run = (\n expression: unknown,\n environment: Record<string, unknown>\n) =>\n pipe(\n Schema.decodeUnknown(LionExpressionSchema)(expression),\n Effect.flatMap(evaluate),\n Effect.provideServiceEffect(\n LionEnvironmentService,\n makeEnvironment(environment)\n )\n );\n"],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ import { r as LionArrayExpressionType } from "../../lion-expression-6Y3itx9l.mjs";
2
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
3
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/base-forms/array.d.ts
8
+ declare const evaluateArray: (expression: LionArrayExpressionType) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateArray };
11
+ //# sourceMappingURL=array.d.mts.map
@@ -0,0 +1 @@
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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { i as evaluateArray } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateArray };
@@ -0,0 +1,10 @@
1
+ import { n as JsonPrimitiveType } from "../../json-primitive-DUaaoNff.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { Effect } from "effect";
4
+
5
+ //#region src/evaluation/base-forms/primitive.d.ts
6
+ declare const evaluatePrimitive: (expression: JsonPrimitiveType) => Effect.Effect<unknown, never, LionEnvironmentService>;
7
+ declare const evaluateReference: (name: string) => Effect.Effect<unknown, never, LionEnvironmentService>;
8
+ //#endregion
9
+ export { evaluatePrimitive, evaluateReference };
10
+ //# sourceMappingURL=primitive.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitive.d.mts","names":[],"sources":["../../../src/evaluation/base-forms/primitive.ts"],"mappings":";;;;;cAKa,iBAAA,GAAqB,UAAA,EAAY,iBAAA,KAAiB,MAAA,CAAA,MAAA,iBAAA,sBAAA;AAAA,cAOlD,iBAAA,GAAqB,IAAA,aAAY,MAAA,CAAA,MAAA,iBAAA,sBAAA"}
@@ -0,0 +1,10 @@
1
+ import { getBinding } from "../environment.mjs";
2
+ import { LionEnvironmentService, getService } from "../../services/evaluation.mjs";
3
+ import { Effect, Match, Option, String, pipe } from "effect";
4
+ //#region src/evaluation/base-forms/primitive.ts
5
+ const evaluatePrimitive = (expression) => pipe(Match.value(expression), Match.when(String.isString, evaluateReference), Match.orElse(Effect.succeed));
6
+ const evaluateReference = (name) => pipe(getService(LionEnvironmentService), Effect.flatMap((environment) => getBinding(environment, name)), Effect.map(Option.getOrElse(() => name)));
7
+ //#endregion
8
+ export { evaluatePrimitive, evaluateReference };
9
+
10
+ //# sourceMappingURL=primitive.mjs.map
@@ -0,0 +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 { getService, 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 getService(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,WAAW,uBAAuB,EAClC,OAAO,SAAS,gBAAgB,WAAW,aAAa,KAAK,CAAC,EAC9D,OAAO,IAAI,OAAO,gBAAgB,KAAK,CAAC,CACzC"}
@@ -0,0 +1,13 @@
1
+ import { s as LionRecordExpressionType } from "../../lion-expression-6Y3itx9l.mjs";
2
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
3
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/base-forms/record.d.ts
8
+ declare const evaluateRecord: (expression: LionRecordExpressionType) => Effect.Effect<{
9
+ [x: string]: unknown;
10
+ }, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
11
+ //#endregion
12
+ export { evaluateRecord };
13
+ //# sourceMappingURL=record.d.mts.map
@@ -0,0 +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,qBAAA"}
@@ -0,0 +1,2 @@
1
+ import { r as evaluateRecord } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateRecord };
@@ -0,0 +1,12 @@
1
+ import { a as ToplevelEnvironment, r as InnerEnvironment, t as Environment } from "../environment-k2Uf6VVc.mjs";
2
+ import { Effect, Option } from "effect";
3
+
4
+ //#region src/evaluation/environment.d.ts
5
+ declare function makeEnvironment(bindings: Record<string, unknown>): Effect.Effect<ToplevelEnvironment>;
6
+ declare function makeEnvironment(bindings: Record<string, unknown>, parent: Environment): Effect.Effect<InnerEnvironment>;
7
+ declare const getBinding: (environment: Environment, name: string) => Effect.Effect<Option.Option<unknown>>;
8
+ declare const setLocalBinding: (environment: Environment, name: string, value: unknown) => Effect.Effect<Environment>;
9
+ declare const setGlobalBinding: (environment: Environment, name: string, value: unknown) => Effect.Effect<Environment>;
10
+ //#endregion
11
+ export { getBinding, makeEnvironment, setGlobalBinding, setLocalBinding };
12
+ //# sourceMappingURL=environment.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.mts","names":[],"sources":["../../src/evaluation/environment.ts"],"mappings":";;;;iBASgB,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,cAqBX,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"}
@@ -0,0 +1,19 @@
1
+ import { InnerEnvironmentSchema, ToplevelEnvironmentSchema } from "../schemas/environment.mjs";
2
+ import { Effect, Match, Option, Record, Ref, Schema, pipe } from "effect";
3
+ //#region src/evaluation/environment.ts
4
+ function makeEnvironment(bindings, parent) {
5
+ return Ref.make(bindings).pipe(Effect.map((bindingsRef) => typeof parent === "undefined" ? { bindingsRef } : {
6
+ bindingsRef,
7
+ parent
8
+ }));
9
+ }
10
+ const getBinding = (environment, name) => pipe(Match.value(environment), Match.when(Schema.is(InnerEnvironmentSchema), ({ bindingsRef, parent }) => pipe(Ref.get(bindingsRef), Effect.map(Record.get(name)), Effect.flatMap(Option.match({
11
+ onSome: (binding) => Effect.succeed(Option.some(binding)),
12
+ onNone: () => getBinding(parent, name)
13
+ })))), Match.when(Schema.is(ToplevelEnvironmentSchema), ({ bindingsRef }) => pipe(Ref.get(bindingsRef), Effect.map(Record.get(name)))), Match.exhaustive);
14
+ const setLocalBinding = (environment, name, value) => pipe(environment.bindingsRef, Ref.update(Record.set(name, value)), Effect.as(environment));
15
+ const setGlobalBinding = (environment, name, value) => pipe(Match.value(environment), Match.when(Schema.is(InnerEnvironmentSchema), ({ parent }) => setGlobalBinding(parent, name, value)), Match.when(Schema.is(ToplevelEnvironmentSchema), ({ bindingsRef }) => Ref.update(bindingsRef, Record.set(name, value))), Match.exhaustive, Effect.map(() => environment));
16
+ //#endregion
17
+ export { getBinding, makeEnvironment, setGlobalBinding, setLocalBinding };
18
+
19
+ //# sourceMappingURL=environment.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.mjs","names":[],"sources":["../../src/evaluation/environment.ts"],"sourcesContent":["import { Effect, Match, Option, pipe, Record, Ref, Schema } from \"effect\";\nimport {\n type Environment,\n type InnerEnvironment,\n InnerEnvironmentSchema,\n type ToplevelEnvironment,\n ToplevelEnvironmentSchema,\n} from \"@/schemas/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 pipe(\n Match.value(environment),\n Match.when(Schema.is(InnerEnvironmentSchema), ({ bindingsRef, parent }) =>\n pipe(\n Ref.get(bindingsRef),\n Effect.map(Record.get(name)),\n Effect.flatMap(\n Option.match({\n onSome: (binding) => Effect.succeed(Option.some(binding)),\n onNone: () => getBinding(parent, name),\n })\n )\n )\n ),\n Match.when(Schema.is(ToplevelEnvironmentSchema), ({ bindingsRef }) =>\n pipe(Ref.get(bindingsRef), Effect.map(Record.get(name)))\n ),\n Match.exhaustive\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 pipe(\n Match.value(environment),\n Match.when(Schema.is(InnerEnvironmentSchema), ({ parent }) =>\n setGlobalBinding(parent, name, value)\n ),\n Match.when(Schema.is(ToplevelEnvironmentSchema), ({ bindingsRef }) =>\n Ref.update(bindingsRef, Record.set(name, value))\n ),\n Match.exhaustive,\n Effect.map(() => environment)\n );\n"],"mappings":";;;AAkBA,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,KACE,MAAM,MAAM,YAAY,EACxB,MAAM,KAAK,OAAO,GAAG,uBAAuB,GAAG,EAAE,aAAa,aAC5D,KACE,IAAI,IAAI,YAAY,EACpB,OAAO,IAAI,OAAO,IAAI,KAAK,CAAC,EAC5B,OAAO,QACL,OAAO,MAAM;CACX,SAAS,YAAY,OAAO,QAAQ,OAAO,KAAK,QAAQ,CAAC;CACzD,cAAc,WAAW,QAAQ,KAAK;CACvC,CAAC,CACH,CACF,CACF,EACD,MAAM,KAAK,OAAO,GAAG,0BAA0B,GAAG,EAAE,kBAClD,KAAK,IAAI,IAAI,YAAY,EAAE,OAAO,IAAI,OAAO,IAAI,KAAK,CAAC,CAAC,CACzD,EACD,MAAM,WACP;AAEH,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,UAEA,KACE,MAAM,MAAM,YAAY,EACxB,MAAM,KAAK,OAAO,GAAG,uBAAuB,GAAG,EAAE,aAC/C,iBAAiB,QAAQ,MAAM,MAAM,CACtC,EACD,MAAM,KAAK,OAAO,GAAG,0BAA0B,GAAG,EAAE,kBAClD,IAAI,OAAO,aAAa,OAAO,IAAI,MAAM,MAAM,CAAC,CACjD,EACD,MAAM,YACN,OAAO,UAAU,YAAY,CAC9B"}
@@ -0,0 +1,12 @@
1
+ import { a as LionExpressionType } from "../lion-expression-6Y3itx9l.mjs";
2
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../evaluation-AblffSQw.mjs";
3
+ import { t as EvaluateResult } from "../evaluation-uwZSKxIf.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/evaluate.d.ts
8
+ declare const evaluate: (expression: LionExpressionType) => EvaluateResult;
9
+ declare const run: (expression: unknown, environment: Record<string, unknown>) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, never>;
10
+ //#endregion
11
+ export { evaluate, run };
12
+ //# sourceMappingURL=evaluate.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.mts","names":[],"sources":["../../src/evaluation/evaluate.ts"],"mappings":";;;;;;;cAea,QAAA,GAAY,UAAA,EAAY,kBAAA,KAAqB,cAAA;AAAA,cAS7C,GAAA,GACX,UAAA,WACA,WAAA,EAAa,MAAA,sBAAuB,MAAA,CAAA,MAAA,UAAjB,qBAAA,GAAiB,wBAAA,GAAA,qBAAA,CAAA,UAAA"}
@@ -0,0 +1,2 @@
1
+ import { n as run, t as evaluate } from "../evaluate-D7ODMrbg.mjs";
2
+ export { evaluate, run };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { BeginFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/special-forms/begin.d.ts
8
+ declare const evaluateBegin: ([_, ...args]: typeof BeginFormSchema.Type) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateBegin };
11
+ //# sourceMappingURL=begin.d.mts.map
@@ -0,0 +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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { d as evaluateBegin } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateBegin };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { CondFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/special-forms/cond.d.ts
8
+ declare const evaluateCond: (expression: typeof CondFormSchema.Type) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateCond };
11
+ //# sourceMappingURL=cond.d.mts.map
@@ -0,0 +1 @@
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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { u as evaluateCond } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateCond };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { DefineFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/special-forms/define.d.ts
8
+ declare const evaluateDefine: ([_, id, expr]: typeof DefineFormSchema.Type) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateDefine };
11
+ //# sourceMappingURL=define.d.mts.map
@@ -0,0 +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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { l as evaluateDefine } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateDefine };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { EvalFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/special-forms/eval.d.ts
8
+ declare const evaluateEval: ([_, args]: typeof EvalFormSchema.Type) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateEval };
11
+ //# sourceMappingURL=eval.d.mts.map
@@ -0,0 +1 @@
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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { c as evaluateEval } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateEval };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { FunctionCallFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/special-forms/function.d.ts
8
+ declare const evaluateFunctionCall: (functionCallExpression: typeof FunctionCallFormSchema.Type) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateFunctionCall };
11
+ //# sourceMappingURL=function.d.mts.map
@@ -0,0 +1 @@
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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { s as evaluateFunctionCall } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateFunctionCall };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { LambdaFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
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, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, never>, never, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateLambda };
11
+ //# sourceMappingURL=lambda.d.mts.map
@@ -0,0 +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,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,iBAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { o as evaluateLambda } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateLambda };
@@ -0,0 +1,11 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "../../evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "../../evaluation-EqzK8tQV.mjs";
3
+ import { MatchFormSchema } from "../../schemas/evaluation.mjs";
4
+ import { Effect } from "effect";
5
+ import * as _$effect_ParseResult0 from "effect/ParseResult";
6
+
7
+ //#region src/evaluation/special-forms/match.d.ts
8
+ declare const evaluateMatch: ([_, valueExpr, ...patternExprs]: typeof MatchFormSchema.Type) => Effect.Effect<unknown, ArgumentMismatchError | InvalidFunctionCallError | _$effect_ParseResult0.ParseError, LionEnvironmentService>;
9
+ //#endregion
10
+ export { evaluateMatch };
11
+ //# sourceMappingURL=match.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/match.ts"],"mappings":";;;;;;;cAgIa,aAAA,IAAiB,CAAA,EAAA,SAAA,KAAA,YAAA,UAIpB,eAAA,CAAgB,IAAA,KAAI,MAAA,CAAA,MAAA,UAAA,qBAAA,GAAA,wBAAA,GAAA,qBAAA,CAAA,UAAA,EAAA,sBAAA"}
@@ -0,0 +1,2 @@
1
+ import { a as evaluateMatch } from "../../evaluate-D7ODMrbg.mjs";
2
+ export { evaluateMatch };
@@ -0,0 +1,11 @@
1
+ import { t as AssumedExpressionType } from "../../lion-expression-6Y3itx9l.mjs";
2
+ import { QuoteFormSchema } from "../../schemas/evaluation.mjs";
3
+ import { Effect } from "effect";
4
+
5
+ //#region src/evaluation/special-forms/quote.d.ts
6
+ declare const evaluateQuote: ([_, args]: typeof QuoteFormSchema.Type) => Effect.Effect<string | number | boolean | readonly AssumedExpressionType[] | {
7
+ readonly [x: string]: AssumedExpressionType;
8
+ } | null, never, never>;
9
+ //#endregion
10
+ export { evaluateQuote };
11
+ //# sourceMappingURL=quote.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote.d.mts","names":[],"sources":["../../../src/evaluation/special-forms/quote.ts"],"mappings":";;;;;cAGa,aAAA,IAAiB,CAAA,EAAA,IAAA,UAAkB,eAAA,CAAgB,IAAA,KAAI,MAAA,CAAA,MAAA,sCAAA,qBAAA;EAAA,sBAAA,qBAAA;AAAA"}
@@ -0,0 +1,7 @@
1
+ import { Effect } from "effect";
2
+ //#region src/evaluation/special-forms/quote.ts
3
+ const evaluateQuote = ([_, args]) => Effect.succeed(args);
4
+ //#endregion
5
+ export { evaluateQuote };
6
+
7
+ //# sourceMappingURL=quote.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote.mjs","names":[],"sources":["../../../src/evaluation/special-forms/quote.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport type { QuoteFormSchema } from \"@/schemas/evaluation\";\n\nexport const evaluateQuote = ([_, args]: typeof QuoteFormSchema.Type) =>\n Effect.succeed(args);\n"],"mappings":";;AAGA,MAAa,iBAAiB,CAAC,GAAG,UAChC,OAAO,QAAQ,KAAK"}
@@ -0,0 +1,17 @@
1
+ import { t as AssumedExpressionType } from "./lion-expression-6Y3itx9l.mjs";
2
+ import { Schema } from "effect";
3
+
4
+ //#region src/errors/evaluation.d.ts
5
+ declare const ArgumentMismatchError_base: Schema.TaggedErrorClass<ArgumentMismatchError, "ArgumentMismatchError", {
6
+ readonly _tag: Schema.tag<"ArgumentMismatchError">;
7
+ }>;
8
+ declare class ArgumentMismatchError extends ArgumentMismatchError_base {}
9
+ declare const InvalidFunctionCallError_base: Schema.TaggedErrorClass<InvalidFunctionCallError, "InvalidFunctionCallError", {
10
+ readonly _tag: Schema.tag<"InvalidFunctionCallError">;
11
+ } & {
12
+ expression: Schema.Union<[Schema.Union<[typeof Schema.String, typeof Schema.Number, typeof Schema.Boolean, typeof Schema.Null]>, Schema.Array$<Schema.suspend<AssumedExpressionType, AssumedExpressionType, never>>, Schema.Record$<Schema.filter<Schema.filter<typeof Schema.String>>, Schema.suspend<AssumedExpressionType, AssumedExpressionType, never>>]>;
13
+ }>;
14
+ declare class InvalidFunctionCallError extends InvalidFunctionCallError_base {}
15
+ //#endregion
16
+ export { InvalidFunctionCallError as n, ArgumentMismatchError as t };
17
+ //# sourceMappingURL=evaluation-AblffSQw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation-AblffSQw.d.mts","names":[],"sources":["../src/errors/evaluation.ts"],"mappings":";;;;cAAgC,0BAAA;;;cAGnB,qBAAA,SAA8B,0BAAA;AAAA,cAEV,6BAAA;;;;;cAEpB,wBAAA,SAAiC,6BAAA"}
@@ -0,0 +1,13 @@
1
+ import { r as InnerEnvironment } from "./environment-k2Uf6VVc.mjs";
2
+ import { Context, Effect } from "effect";
3
+ import * as _$effect_Ref0 from "effect/Ref";
4
+
5
+ //#region src/services/evaluation.d.ts
6
+ declare const LionEnvironmentService_base: Context.TagClass<LionEnvironmentService, "LionEnvironmentService", {
7
+ readonly bindingsRef: _$effect_Ref0.Ref<Record<string, unknown>>;
8
+ } | InnerEnvironment>;
9
+ declare class LionEnvironmentService extends LionEnvironmentService_base {}
10
+ declare const getService: <T, U>(context: Context.Tag<T, U>) => Effect.Effect<U, never, T>;
11
+ //#endregion
12
+ export { getService as n, LionEnvironmentService as t };
13
+ //# sourceMappingURL=evaluation-EqzK8tQV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation-EqzK8tQV.d.mts","names":[],"sources":["../src/services/evaluation.ts"],"mappings":";;;;;cAA+C,2BAAA;;;cAGlC,sBAAA,SAA+B,2BAAA;AAAA,cAI/B,UAAA,SAAoB,OAAA,EAAS,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,CAAA,MAAE,MAAA,CAAA,MAAA,CAAA,CAAA,SAAA,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { n as InvalidFunctionCallError, t as ArgumentMismatchError } from "./evaluation-AblffSQw.mjs";
2
+ import { t as LionEnvironmentService } from "./evaluation-EqzK8tQV.mjs";
3
+ import { Effect } from "effect";
4
+ import { ParseError } from "effect/ParseResult";
5
+
6
+ //#region src/types/evaluation.d.ts
7
+ type EvaluateResult = Effect.Effect<unknown, ParseError | ArgumentMismatchError | InvalidFunctionCallError, LionEnvironmentService>;
8
+ //#endregion
9
+ export { EvaluateResult as t };
10
+ //# sourceMappingURL=evaluation-uwZSKxIf.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation-uwZSKxIf.d.mts","names":[],"sources":["../src/types/evaluation.ts"],"mappings":";;;;;;KAQY,cAAA,GAAiB,MAAA,CAAO,MAAA,UAElC,UAAA,GAAa,qBAAA,GAAwB,wBAAA,EACrC,sBAAA"}
@@ -0,0 +1,8 @@
1
+ import { Schema } from "effect";
2
+
3
+ //#region src/schemas/json-primitive.d.ts
4
+ declare const JsonPrimitiveSchema: Schema.Union<[typeof Schema.String, typeof Schema.Number, typeof Schema.Boolean, typeof Schema.Null]>;
5
+ type JsonPrimitiveType = typeof JsonPrimitiveSchema.Type;
6
+ //#endregion
7
+ export { JsonPrimitiveType as n, JsonPrimitiveSchema as t };
8
+ //# sourceMappingURL=json-primitive-DUaaoNff.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-primitive-DUaaoNff.d.mts","names":[],"sources":["../src/schemas/json-primitive.ts"],"mappings":";;;cAEa,mBAAA,EAAmB,MAAA,CAAA,KAAA,SAAA,MAAA,CAAA,MAAA,SAAA,MAAA,CAAA,MAAA,SAAA,MAAA,CAAA,OAAA,SAAA,MAAA,CAAA,IAAA;AAAA,KAOpB,iBAAA,UAA2B,mBAAA,CAAoB,IAAA"}