| 162 | |
| 163 | /** @internal */ |
| 164 | export 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 */ |
| 186 | export const isFailure = <E>(self: Cause.Cause<E>): boolean => Option.isSome(failureOption(self)) |