-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo.ts
More file actions
25 lines (22 loc) · 732 Bytes
/
Copy pathtwo.ts
File metadata and controls
25 lines (22 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { nodeString } from "@/schemas/nodes/union";
import { Console, Effect } from "effect";
import { Schema } from "effect";
import { nativeToExp } from "src/schemas/nodes/exps/union";
import { ReturnStmt } from "src/schemas/nodes/stmts/return";
import { Stmt, isExpStmt } from "src/schemas/nodes/stmts/union";
const program = Effect.gen(function* () {
const istmt = nativeToExp(6);
const rstmt = ReturnStmt.make({
token: { _tag: "let", literal: "let" },
value: istmt,
}) as Stmt;
yield* Console.log(Schema.decodeUnknownSync(Stmt)(rstmt));
if (isExpStmt(rstmt)) {
console.log(`${nodeString(rstmt)}`);
}
}).pipe(
Effect.withSpan("program", {
attributes: { source: "Playground" },
}),
);
Effect.runSync(program);