(self: Handoff<A>)
| 137 | |
| 138 | /** @internal */ |
| 139 | export const take = <A>(self: Handoff<A>): Effect.Effect<A> => |
| 140 | Effect.flatMap(Deferred.make<void>(), (deferred) => |
| 141 | Effect.flatten( |
| 142 | Ref.modify(self.ref, (state) => |
| 143 | pipe( |
| 144 | state, |
| 145 | handoffStateMatch( |
| 146 | (notifyConsumer) => |
| 147 | [ |
| 148 | Effect.flatMap( |
| 149 | Deferred.await(notifyConsumer), |
| 150 | () => take(self) |
| 151 | ), |
| 152 | state |
| 153 | ] as const, |
| 154 | (value, notifyProducer) => [ |
| 155 | Effect.as( |
| 156 | Deferred.succeed(notifyProducer, void 0), |
| 157 | value |
| 158 | ), |
| 159 | handoffStateEmpty<A>(deferred) |
| 160 | ] |
| 161 | ) |
| 162 | )) |
| 163 | )) |
| 164 | |
| 165 | /** @internal */ |
| 166 | export const poll = <A>(self: Handoff<A>): Effect.Effect<Option.Option<A>> => |
nothing calls this directly
no test coverage detected
searching dependent graphs…