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

Function Either

packages/effect/src/Schema.ts:7484–7504  ·  view source on GitHub ↗
({ left, right }: {
  readonly left: L
  readonly right: R
})

Source from the content-addressed store, hash-verified

7482 * @since 3.10.0
7483 */
7484export const Either = <R extends Schema.All, L extends Schema.All>({ left, right }: {
7485 readonly left: L
7486 readonly right: R
7487}): Either<R, L> => {
7488 const right_ = asSchema(right)
7489 const left_ = asSchema(left)
7490 const out = transform(
7491 eitherEncoded(right_, left_),
7492 EitherFromSelf({ left: typeSchema(left_), right: typeSchema(right_) }),
7493 {
7494 strict: true,
7495 decode: (i) => eitherDecode(i),
7496 encode: (a) =>
7497 either_.match(a, {
7498 onLeft: makeLeftEncoded,
7499 onRight: makeRightEncoded
7500 })
7501 }
7502 )
7503 return out as any
7504}
7505
7506/**
7507 * @category api interface

Callers

nothing calls this directly

Calls 6

asSchemaFunction · 0.85
eitherEncodedFunction · 0.85
typeSchemaFunction · 0.85
eitherDecodeFunction · 0.85
transformInterface · 0.70
EitherFromSelfFunction · 0.70

Tested by

no test coverage detected