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

Function compose

packages/effect/src/TestAnnotation.ts:84–101  ·  view source on GitHub ↗
(
  left: Either.Either<Chunk.Chunk<A>, number>,
  right: Either.Either<Chunk.Chunk<A>, number>
)

Source from the content-addressed store, hash-verified

82 * @since 2.0.0
83 */
84export const compose = <A>(
85 left: Either.Either<Chunk.Chunk<A>, number>,
86 right: Either.Either<Chunk.Chunk<A>, number>
87): Either.Either<Chunk.Chunk<A>, number> => {
88 if (Either.isLeft(left) && Either.isLeft(right)) {
89 return Either.left(left.left + right.left)
90 }
91 if (Either.isRight(left) && Either.isRight(right)) {
92 return Either.right(pipe(left.right, Chunk.appendAll(right.right)))
93 }
94 if (Either.isRight(left) && Either.isLeft(right)) {
95 return right
96 }
97 if (Either.isLeft(left) && Either.isRight(right)) {
98 return right
99 }
100 throw new Error(getBugErrorMessage("TestAnnotation.compose"))
101}
102
103/**
104 * @since 2.0.0

Callers

nothing calls this directly

Calls 2

getBugErrorMessageFunction · 0.85
pipeFunction · 0.70

Tested by

no test coverage detected