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

Function fromFunction

packages/effect/src/RequestResolver.ts:373–384  ·  view source on GitHub ↗
(
  f: (entry: Request.Entry<A>) => Request.Success<A>
)

Source from the content-addressed store, hash-verified

371 * @since 2.0.0
372 */
373export const fromFunction = <A extends Request.Any>(
374 f: (entry: Request.Entry<A>) => Request.Success<A>
375): RequestResolver<A> =>
376 make(
377 (entries) =>
378 Effect.sync(() => {
379 for (let i = 0; i < entries.length; i++) {
380 const entry = entries[i]
381 entry.completeUnsafe(exitSucceed(f(entry)))
382 }
383 })
384 )
385
386/**
387 * Constructs a request resolver from a pure function that takes a list of requests

Callers

nothing calls this directly

Calls 4

completeUnsafeMethod · 0.80
makeFunction · 0.70
fFunction · 0.50
syncMethod · 0.45

Tested by

no test coverage detected