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

Function makePrimitiveProto

packages/effect/src/Micro.ts:730–747  ·  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

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