Skip to content

Commit

Permalink
update effect
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Mar 14, 2024
1 parent 07905b8 commit ed93343
Show file tree
Hide file tree
Showing 8 changed files with 657 additions and 321 deletions.
7 changes: 7 additions & 0 deletions .changeset/brown-eyes-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@effect-rx/rx-react": minor
"@effect-rx/rx-vue": minor
"@effect-rx/rx": minor
---

update effect
7 changes: 7 additions & 0 deletions .changeset/nine-maps-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@effect-rx/rx-react": patch
"@effect-rx/rx-vue": patch
"@effect-rx/rx": patch
---

allow resetting a Rx.fn
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"devDependencies": {
"@babel/cli": "^7.23.9",
"@babel/core": "^7.23.9",
"@babel/core": "^7.24.0",
"@babel/plugin-transform-export-namespace-from": "^7.23.4",
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@changesets/changelog-github": "^0.5.0",
Expand All @@ -28,23 +28,23 @@
"@effect/docgen": "^0.3.8",
"@effect/eslint-plugin": "^0.1.2",
"@effect/language-service": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitest/coverage-v8": "^1.3.1",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"eslint": "^8.57.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-codegen": "^0.23.0",
"eslint-plugin-codegen": "^0.26.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-sort-destructure-keys": "^1.5.0",
"fast-check": "^3.15.1",
"fast-check": "^3.16.0",
"glob": "^10.3.10",
"madge": "^6.1.0",
"prettier": "^3.2.5",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"typescript": "^5.4.2",
"vitest": "^1.3.1"
}
}
6 changes: 3 additions & 3 deletions packages/rx-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"license": "MIT",
"sideEffects": false,
"devDependencies": {
"@types/react": "^18.2.58",
"effect": "^2.4.0",
"@types/react": "^18.2.65",
"effect": "^2.4.6",
"react": "^18.2.0"
},
"peerDependencies": {
"effect": "^2.4.0",
"effect": "^2.4.6",
"react": "^18"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/rx-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"license": "MIT",
"sideEffects": false,
"devDependencies": {
"effect": "^2.4.0",
"vue": "^3.4.19"
"effect": "^2.4.6",
"vue": "^3.4.21"
},
"peerDependencies": {
"effect": "^2.4.0",
"effect": "^2.4.6",
"vue": "^3.4"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/rx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"license": "MIT",
"sideEffects": false,
"devDependencies": {
"effect": "^2.4.0"
"effect": "^2.4.6"
},
"peerDependencies": {
"effect": "^2.4.0"
"effect": "^2.4.6"
}
}
32 changes: 24 additions & 8 deletions packages/rx/src/Rx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,6 @@ export const subRef: {
// constructors - functions
// -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category models
*/
export interface RxResultFn<Arg, A, E = never> extends Writable<Result.Result<A, E>, Arg> {}

/**
* @since 1.0.0
* @category constructors
Expand Down Expand Up @@ -738,6 +732,24 @@ export const fnSync: {
})
}

/**
* @since 1.0.0
* @category models
*/
export interface RxResultFn<Arg, A, E = never> extends Writable<Result.Result<A, E>, Arg | Reset> {}

/**
* @since 1.0.0
* @category symbols
*/
export const Reset = Symbol.for("@effect-rx/rx/Rx/Reset")

/**
* @since 1.0.0
* @category symbols
*/
export type Reset = typeof Reset

/**
* @since 1.0.0
* @category constructors
Expand Down Expand Up @@ -776,8 +788,12 @@ function makeResultFn<Arg, E, A>(
}
return makeStream(get, value, initialValue, runtime)
}
function write(ctx: WriteContext<Result.Result<A, E | NoSuchElementException>>, arg: Arg) {
ctx.set(argRx, [ctx.get(argRx)[0] + 1, arg])
function write(ctx: WriteContext<Result.Result<A, E | NoSuchElementException>>, arg: Arg | Reset) {
if (arg === Reset) {
ctx.set(argRx, [0, undefined as any])
} else {
ctx.set(argRx, [ctx.get(argRx)[0] + 1, arg])
}
}
return [read, write] as const
}
Expand Down
Loading

0 comments on commit ed93343

Please sign in to comment.