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

Function isEmpty

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

Source from the content-addressed store, hash-verified

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