Skip to content

Commit

Permalink
docs: add links to previous works
Browse files Browse the repository at this point in the history
  • Loading branch information
susisu committed Oct 23, 2022
1 parent 5669ee8 commit b692100
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const putState = (value: number) =>

// 3. Write effect handlers

function runState<T>(comp: Effectful<"state/get" | "state/put", T>, state: { current: number }): T {
function runState<T>(
comp: Effectful<"state/get" | "state/put", T>,
state: { current: number }
): T {
return run(comp, x => x, {
"state/get": (eff, resume) => {
return resume(eff.value.k(state.current));
Expand All @@ -55,7 +58,9 @@ function runState<T>(comp: Effectful<"state/get" | "state/put", T>, state: { cur

// 4. Write computations using generators

function* getAndMultiplyState(multiplier: number): Effectful<"state/get", number> {
function* getAndMultiplyState(
multiplier: number
): Effectful<"state/get", number> {
// use `yield*` to perform an effect
const value = yield* getState;
return multiplier * value;
Expand Down Expand Up @@ -85,3 +90,8 @@ console.log(state);
## Author

Susisu ([GitHub](https://github.com/susisu), [Twitter](https://twitter.com/susisu2413))

## Previous works

- [briancavalier/fx-ts](https://github.com/briancavalier/fx-ts/)
- [susisu/effects](https://github.com/susisu/effects)

0 comments on commit b692100

Please sign in to comment.