MCPcopy Index your code
hub / github.com/Effect-TS/effect / attempt

Function attempt

packages/cli/src/internal/primitive.ts:481–496  ·  view source on GitHub ↗
(
  option: Option.Option<string>,
  typeName: string,
  parse: (value: string) => Effect.Effect<A, E>
)

Source from the content-addressed store, hash-verified

479}
480
481const attempt = <E, A>(
482 option: Option.Option<string>,
483 typeName: string,
484 parse: (value: string) => Effect.Effect<A, E>
485): Effect.Effect<A, string> =>
486 Effect.orElseFail(
487 option,
488 () => `${typeName} options do not have a default value`
489 ).pipe(
490 Effect.flatMap((value) =>
491 Effect.orElseFail(
492 parse(value),
493 () => `'${value}' is not a ${typeName}`
494 )
495 )
496 )
497
498const validatePathExistence = (
499 path: string,

Callers 1

validateInternalFunction · 0.70

Calls 2

parseFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected