MCPcopy Create free account
hub / github.com/effect-app/libs / modify

Function modify

packages/effect-app/src/Pure.ts:200–208  ·  view source on GitHub ↗
(
  mod: (s: S2) => readonly [S3, A]
)

Source from the content-addressed store, hash-verified

198}
199
200export function modify<S2, A, S3>(
201 mod: (s: S2) => readonly [S3, A]
202): Effect.Effect<A, never, { env: PureEnv<never, S2, S3> }> {
203 return (castTag<never, S3, S2>()).useSync((_) => {
204 const [s, a] = mod(_.env.state)
205 _.env.state = s as any
206 return a
207 }) as any
208}
209
210export function modifyM<W, R, E, A, S2, S3>(
211 mod: (s: S2) => Effect.Effect<readonly [S3, A], E, FixEnv<R, W, S2, S3>>

Callers 1

updateWithFunction · 0.70

Calls 2

castTagFunction · 0.85
useSyncMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…