From ff72c83ef040e67dbe63e63a84d55a295cbca49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Tue, 24 Mar 2026 12:16:16 +0100 Subject: [PATCH] Update docs --- packages/effect-fc/src/Lens.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/effect-fc/src/Lens.ts b/packages/effect-fc/src/Lens.ts index 6f12cdc..4de43dd 100644 --- a/packages/effect-fc/src/Lens.ts +++ b/packages/effect-fc/src/Lens.ts @@ -41,6 +41,9 @@ export class LensImpl => Predicate.hasProperty(u, LensTypeId) @@ -294,6 +297,9 @@ export const focusChunkAt: { ) +/** + * Reads the current value from the Lens. + */ export const get = (self: Lens): Effect.Effect => self.get export const set: { @@ -303,6 +309,9 @@ export const set: { self.modify(() => Effect.succeed([void 0, value] as const)), ) +/** + * Sets the `Lens` to a new value and returns the previous value. + */ export const getAndSet: { (value: A): (self: Lens) => Effect.Effect (self: Lens, value: A): Effect.Effect @@ -310,6 +319,9 @@ export const getAndSet: { self.modify(a => Effect.succeed([a, value] as const)), ) +/** + * Applies a synchronous transformation to the focused value, discarding the previous value. + */ export const update: { (f: (a: A) => A): (self: Lens) => Effect.Effect (self: Lens, f: (a: A) => A): Effect.Effect @@ -317,6 +329,9 @@ export const update: { self.modify(a => Effect.succeed([void 0, f(a)] as const)), ) +/** + * Applies an effectful transformation to the focused value, discarding the previous value. + */ export const updateEffect: { (f: (a: A) => Effect.Effect): (self: Lens) => Effect.Effect (self: Lens, f: (a: A) => Effect.Effect): Effect.Effect @@ -327,6 +342,9 @@ export const updateEffect: { )), ) +/** + * Applies a synchronous transformation while returning the previous value. + */ export const getAndUpdate: { (f: (a: A) => A): (self: Lens) => Effect.Effect (self: Lens, f: (a: A) => A): Effect.Effect @@ -334,6 +352,9 @@ export const getAndUpdate: { self.modify(a => Effect.succeed([a, f(a)] as const)), ) +/** + * Applies an effectful transformation while returning the previous value. + */ export const getAndUpdateEffect: { (f: (a: A) => Effect.Effect): (self: Lens) => Effect.Effect (self: Lens, f: (a: A) => Effect.Effect): Effect.Effect @@ -344,6 +365,9 @@ export const getAndUpdateEffect: { )), ) +/** + * Sets the value and returns the new value. + */ export const setAndGet: { (value: A): (self: Lens) => Effect.Effect (self: Lens, value: A): Effect.Effect @@ -351,6 +375,9 @@ export const setAndGet: { self.modify(() => Effect.succeed([value, value] as const)), ) +/** + * Applies a synchronous update and returns the new value. + */ export const updateAndGet: { (f: (a: A) => A): (self: Lens) => Effect.Effect (self: Lens, f: (a: A) => A): Effect.Effect @@ -361,6 +388,9 @@ export const updateAndGet: { }), ) +/** + * Applies an effectful update and returns the new value. + */ export const updateAndGetEffect: { (f: (a: A) => Effect.Effect): (self: Lens) => Effect.Effect (self: Lens, f: (a: A) => Effect.Effect): Effect.Effect