MCPcopy
hub / github.com/Effect-TS/effect / makePrimitiveProto

Function makePrimitiveProto

packages/effect/src/Micro.ts:729–746  ·  view source on GitHub ↗
(options: {
  readonly op: Op
  readonly eval?: (fiber: MicroFiberImpl) => Primitive | Micro<any, any, any> | Yield
  readonly contA?: (this: Primitive, value: any, fiber: MicroFiberImpl) => Primitive | Micro<any, any, any> | Yield
  readonly contE?: (
    this: Primitive,
    cause: MicroCause<any>,
    fiber: MicroFiberImpl
  ) => Primitive | Micro<any, any, any> | Yield
  readonly ensure?: (this: Primitive, fiber: MicroFiberImpl) => void | ((value: any, fiber: MicroFiberImpl) => void)
})

Source from the content-addressed store, hash-verified

727}
728
729const makePrimitiveProto = <Op extends string>(options: {
730 readonly op: Op
731 readonly eval?: (fiber: MicroFiberImpl) => Primitive | Micro<any, any, any> | Yield
732 readonly contA?: (this: Primitive, value: any, fiber: MicroFiberImpl) => Primitive | Micro<any, any, any> | Yield
733 readonly contE?: (
734 this: Primitive,
735 cause: MicroCause<any>,
736 fiber: MicroFiberImpl
737 ) => Primitive | Micro<any, any, any> | Yield
738 readonly ensure?: (this: Primitive, fiber: MicroFiberImpl) => void | ((value: any, fiber: MicroFiberImpl) => void)
739}): Primitive => ({
740 ...MicroProto,
741 [identifier]: options.op,
742 [evaluate]: options.eval ?? defaultEvaluate,
743 [successCont]: options.contA,
744 [failureCont]: options.contE,
745 [ensureCont]: options.ensure
746} as any)
747
748const makePrimitive = <Fn extends (...args: Array<any>) => any, Single extends boolean = true>(options: {
749 readonly op: string

Callers 3

makePrimitiveFunction · 0.85
makeExitFunction · 0.85
Micro.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected