scrowl/src/lang/result.ts
2026-02-07 10:43:30 +01:00

10 lines
289 B
TypeScript

export type Result<T, E> =
| { tag: "ok", value: T }
| { tag: "error", error: E }
export namespace Result {
export function ok<T, E>(value: T): Result<T, E> { return { tag: "ok", value } }
export function error<T, E>(error: E): Result<T, E> { return { tag: "error", error } }
}