Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
fix: effect run result type (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
harrysolovay authored Aug 9, 2022
1 parent b114a23 commit 52ea7d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions effect/sys/Atom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { E_, Effect, Resolved, T_, ValCollection } from "./Effect.ts";
import { key } from "./key.ts";
import { RunContext } from "./run.ts";
import { run } from "./run.ts";
import { run, RunContext, RunResult } from "./run.ts";

export function atom<N extends string, A extends unknown[], R>(
fqn: N,
Expand All @@ -24,7 +23,7 @@ export class Atom<N extends string, A extends unknown[], R>
super(fqn);
}

run() {
run(): RunResult<this> {
return run(this);
}
}
Expand Down
4 changes: 2 additions & 2 deletions effect/sys/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { key } from "./key.ts";
export interface RunContext {
run: Run;
}

export type Run = <Root extends AnyAtom>(root: Root) => Promise<T_<Root> | E_<Root>>;
export type RunResult<Root extends AnyAtom> = Promise<T_<Root> | E_<Root>>;
export type Run = <Root extends AnyAtom>(root: Root) => RunResult<Root>;

export const { run } = (new class Runtime implements RunContext {
#cache = new Map<string, Promise<unknown>>(); // TODO: set max size / use LRU
Expand Down

0 comments on commit 52ea7d1

Please sign in to comment.