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

Function EitherFromSelf

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

Source from the content-addressed store, hash-verified

7429 * @since 3.10.0
7430 */
7431export const EitherFromSelf = <R extends Schema.All, L extends Schema.All>({ left, right }: {
7432 readonly left: L
7433 readonly right: R
7434}): EitherFromSelf<R, L> => {
7435 return declare(
7436 [right, left],
7437 {
7438 decode: (right, left) => eitherParse(ParseResult.decodeUnknown(right), ParseResult.decodeUnknown(left)),
7439 encode: (right, left) => eitherParse(ParseResult.encodeUnknown(right), ParseResult.encodeUnknown(left))
7440 },
7441 {
7442 typeConstructor: { _tag: "effect/Either" },
7443 description: `Either<${format(right)}, ${format(left)}>`,
7444 pretty: eitherPretty,
7445 arbitrary: eitherArbitrary,
7446 equivalence: (right, left) => either_.getEquivalence({ left, right })
7447 }
7448 )
7449}
7450
7451const makeLeftEncoded = <E>(left: E) => (({
7452 _tag: "Left",

Callers 2

EitherFunction · 0.70
EitherFromUnionFunction · 0.70

Calls 3

declareInterface · 0.85
eitherParseFunction · 0.85
formatFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…