MCPcopy Create free account
hub / github.com/Effect-TS/effect / constructor

Method constructor

packages/effect/src/Optic.ts:1141–1145  ·  view source on GitHub ↗
(node: Node, get: (s: S) => A, replace: (a: A, s: S) => S)

Source from the content-addressed store, hash-verified

1139class LensImpl<S, A> extends OptionalImpl<S, A> implements Lens<S, A> {
1140 readonly get: (s: S) => A
1141 constructor(node: Node, get: (s: S) => A, replace: (a: A, s: S) => S) {
1142 super(node, (s) => Result.succeed(get(s)), (a, s) => Result.succeed(replace(a, s)))
1143 this.get = get
1144 this.replace = replace
1145 }
1146 override modify(f: (a: A) => A): (s: S) => S {
1147 return (s) => this.replace(f(this.get(s)), s)
1148 }

Callers

nothing calls this directly

Calls 3

replaceFunction · 0.85
getFunction · 0.70
succeedMethod · 0.45

Tested by

no test coverage detected