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