diff --git a/packages/effect-lens/src/Lens.ts b/packages/effect-lens/src/Lens.ts
index b5ddd94..d7faf36 100644
--- a/packages/effect-lens/src/Lens.ts
+++ b/packages/effect-lens/src/Lens.ts
@@ -129,6 +129,49 @@ export const makeLazy = (
): Lens => new LensLazyImpl(source)
+export declare namespace SynchronizedRefLensImpl {
+ export interface SynchronizedRefWithInternals
+ extends SynchronizedRef.SynchronizedRef {
+ readonly ref: Ref.Ref
+ readonly withLock: (self: Effect.Effect) => Effect.Effect
+ }
+}
+
+export class SynchronizedRefLensImpl
+extends Pipeable.Class() implements LensWithInternals {
+ readonly [Readable.TypeId]: Readable.TypeId = Readable.TypeId
+ readonly [Subscribable.TypeId]: Subscribable.TypeId = Subscribable.TypeId
+ readonly [LensTypeId]: LensTypeId = LensTypeId
+ readonly [LensWithInternalsTypeId]: LensWithInternalsTypeId = LensWithInternalsTypeId
+
+ readonly ref: SynchronizedRefLensImpl.SynchronizedRefWithInternals
+
+ constructor(
+ ref: SynchronizedRef.SynchronizedRef
+ ) {
+ super()
+ this.ref = ref as SynchronizedRefLensImpl.SynchronizedRefWithInternals
+ }
+
+ get get() { return this.ref.get }
+ get changes() { return Stream.unwrap(Effect.map(this.ref.get, Stream.make)) }
+ update(a: A) { return Ref.set(this.ref.ref, a) }
+ get withLock() { return this.ref.withLock }
+
+ modifyEffect = modifyEffect
+}
+
+/**
+ * Creates a `Lens` that proxies a `SynchronizedRef`.
+ *
+ * Note: since `SynchronizedRef` 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.
+ */
+export const fromSynchronizedRef = (
+ ref: SynchronizedRef.SynchronizedRef
+): Lens => new SynchronizedRefLensImpl(ref)
+
+
export declare namespace SubscriptionRefLensImpl {
export interface SubscriptionRefWithInternals
extends SubscriptionRef.SubscriptionRef {
@@ -175,23 +218,6 @@ export const fromSubscriptionRef = (
): Lens => new SubscriptionRefLensImpl(ref)
-/**
- * Creates a `Lens` that proxies a `SynchronizedRef`.
- *
- * Note: since `SynchronizedRef` 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.
- */
-export const fromSynchronizedRef = (
- ref: SynchronizedRef.SynchronizedRef
-): Lens => make({
- get get() { return ref.get },
- get changes() { return Stream.unwrap(Effect.map(ref.get, Stream.make)) },
- modify: (
- f: (a: A) => Effect.Effect
- ) => ref.modifyEffect(f),
-})
-
-
/**
* Flattens an effectful `Lens`.
*/