| 225 | |
| 226 | /** @internal */ |
| 227 | export const toOption = (self: FiberId.FiberId): Option.Option<FiberId.FiberId> => { |
| 228 | const fiberIds = toSet(self) |
| 229 | if (HashSet.size(fiberIds) === 0) { |
| 230 | return Option.none() |
| 231 | } |
| 232 | let first = true |
| 233 | let acc: FiberId.FiberId |
| 234 | for (const fiberId of fiberIds) { |
| 235 | if (first) { |
| 236 | acc = fiberId |
| 237 | first = false |
| 238 | } else { |
| 239 | // @ts-expect-error |
| 240 | acc = pipe(acc, combine(fiberId)) |
| 241 | } |
| 242 | } |
| 243 | // @ts-expect-error |
| 244 | return Option.some(acc) |
| 245 | } |
| 246 | |
| 247 | /** @internal */ |
| 248 | export const toSet = (self: FiberId.FiberId): HashSet.HashSet<FiberId.Runtime> => { |