mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
* Expand static Effect support across common APIs * Preserve compiler parity across expanded Effect patterns * Fix compiler regressions exposed by Effect coverage * Bound shared type conversion traversal * Clarify conversion contracts and tidy fixtures * Run every Effect fixture in CI shards * Preserve inferred array assignments in concurrent Effect programs * Record inferred array fixture compiler ordering
7 lines
397 B
TypeScript
7 lines
397 B
TypeScript
import { Match, pipe } from "effect";
|
|
type Result = { readonly _tag: "Ok"; readonly n: number } | { readonly _tag: "Bad"; readonly message: string };
|
|
function render(v: Result) {
|
|
return pipe(Match.value(v), Match.tag("Ok", (r) => "ok:" + r.n), Match.tag("Bad", (r) => "bad:" + r.message), Match.exhaustive);
|
|
}
|
|
console.log(render({ _tag: "Ok", n: 42 }), render({ _tag: "Bad", message: "oops" }));
|