@@ -219,11 +219,13 @@ extends LensImpl<A, never, never, never, never> {
|
|||||||
* Note: since `Ref` does not provide any kind of reactivity mechanism, the produced `Lens` will be non-reactive.
|
* Note: since `Ref` does not provide any kind of reactivity mechanism, the produced `Lens` will be non-reactive.
|
||||||
* This means its `changes` stream will only emit the current value once when evaluated and nothing else.
|
* This means its `changes` stream will only emit the current value once when evaluated and nothing else.
|
||||||
*/
|
*/
|
||||||
export const fromRef = Effect.fnUntraced(function* <A>(
|
export const fromRef = <A>(
|
||||||
ref: Ref.Ref<A>
|
ref: Ref.Ref<A>
|
||||||
): Effect.fn.Return<Lens<A, never, never, never, never>, never, never> {
|
): Effect.Effect<Lens<A, never, never, never, never>, never, never> => Effect.map(
|
||||||
return new RefLensImpl(ref, yield* Semaphore.make(1))
|
Semaphore.make(1),
|
||||||
})
|
semaphore => new RefLensImpl(ref, semaphore),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
export class SynchronizedRefLensImpl<in out A>
|
export class SynchronizedRefLensImpl<in out A>
|
||||||
extends LensImpl<A, never, never, never, never> {
|
extends LensImpl<A, never, never, never, never> {
|
||||||
|
|||||||
@@ -182,11 +182,12 @@ extends LensImpl<A, never, never, never, never> {
|
|||||||
* Note: since `Ref` does not provide any kind of reactivity mechanism, the produced `Lens` will be non-reactive.
|
* Note: since `Ref` does not provide any kind of reactivity mechanism, the produced `Lens` will be non-reactive.
|
||||||
* This means its `changes` stream will only emit the current value once when evaluated and nothing else.
|
* This means its `changes` stream will only emit the current value once when evaluated and nothing else.
|
||||||
*/
|
*/
|
||||||
export const fromRef = Effect.fnUntraced(function* <A>(
|
export const fromRef = <A>(
|
||||||
ref: Ref.Ref<A>
|
ref: Ref.Ref<A>
|
||||||
): Effect.fn.Return<Lens<A, never, never, never, never>, never, never> {
|
): Effect.Effect<Lens<A, never, never, never, never>, never, never> => Effect.map(
|
||||||
return new RefLensImpl(ref, yield* Effect.makeSemaphore(1))
|
Effect.makeSemaphore(1),
|
||||||
})
|
semaphore => new RefLensImpl(ref, semaphore),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
export declare namespace SynchronizedRefLensImpl {
|
export declare namespace SynchronizedRefLensImpl {
|
||||||
|
|||||||
Reference in New Issue
Block a user