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

Function fastPath

packages/effect/src/internal/runtime.ts:244–266  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

242export const isFiberFailure = (u: unknown): u is Runtime.FiberFailure => Predicate.hasProperty(u, FiberFailureId)
243
244const fastPath = <A, E, R>(effect: Effect.Effect<A, E, R>): Exit.Exit<A, E> | undefined => {
245 const op = effect as core.Primitive
246 switch (op._op) {
247 case "Failure":
248 case "Success": {
249 // @ts-expect-error
250 return op
251 }
252 case "Left": {
253 return core.exitFail(op.left)
254 }
255 case "Right": {
256 return core.exitSucceed(op.right)
257 }
258 case "Some": {
259 return core.exitSucceed(op.value)
260 }
261 case "None": {
262 // @ts-expect-error
263 return core.exitFail(new core.NoSuchElementException())
264 }
265 }
266}
267
268/** @internal */
269export const unsafeRunSyncExit: {

Callers 1

runtime.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected