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

Function isEmpty

packages/effect/src/internal/cause.ts:165–184  ·  view source on GitHub ↗
(self: Cause.Cause<E>)

Source from the content-addressed store, hash-verified

163
164/** @internal */
165export const isEmpty = <E>(self: Cause.Cause<E>): boolean => {
166 if (self._tag === OpCodes.OP_EMPTY) {
167 return true
168 }
169 return reduce(self, true, (acc, cause) => {
170 switch (cause._tag) {
171 case OpCodes.OP_EMPTY: {
172 return Option.some(acc)
173 }
174 case OpCodes.OP_DIE:
175 case OpCodes.OP_FAIL:
176 case OpCodes.OP_INTERRUPT: {
177 return Option.some(false)
178 }
179 default: {
180 return Option.none()
181 }
182 }
183 })
184}
185
186/** @internal */
187export const isFailure = <E>(self: Cause.Cause<E>): boolean => Option.isSome(failureOption(self))

Callers

nothing calls this directly

Calls 1

reduceFunction · 0.70

Tested by

no test coverage detected