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

Function makeFn

packages/effect/src/unstable/reactivity/Atom.ts:1171–1180  ·  view source on GitHub ↗
(
  f: (arg: Arg, get: FnContext) => Stream.Stream<A, E, AtomRegistry> | Effect.Effect<A, E, Scope.Scope | AtomRegistry>,
  options?: {
    readonly initialValue?: A | undefined
    readonly concurrent?: boolean | undefined
  }
)

Source from the content-addressed store, hash-verified

1169}
1170
1171const makeFn = <Arg, E, A>(
1172 f: (arg: Arg, get: FnContext) => Stream.Stream<A, E, AtomRegistry> | Effect.Effect<A, E, Scope.Scope | AtomRegistry>,
1173 options?: {
1174 readonly initialValue?: A | undefined
1175 readonly concurrent?: boolean | undefined
1176 }
1177): AtomResultFn<Arg, A, E | Cause.NoSuchElementError> => {
1178 const [read, write] = makeResultFn(f, options)
1179 return writable(read, write) as any
1180}
1181
1182function makeResultFn<Arg, E, A>(
1183 f: (arg: Arg, get: FnContext) => Effect.Effect<A, E, Scope.Scope | AtomRegistry> | Stream.Stream<A, E, AtomRegistry>,

Callers 1

fnFunction · 0.70

Calls 1

makeResultFnFunction · 0.85

Tested by

no test coverage detected