diff --git a/.vscode/settings.json b/.vscode/settings.json index 723e209..97defb2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "typescript.tsdk": "node_modules/typescript/lib", + "js/ts.tsdk.path": "node_modules/typescript/lib", "editor.codeActionsOnSave": { "source.fixAll.biome": "explicit" } diff --git a/packages/effect-lens/src/Lens.ts b/packages/effect-lens/src/Lens.ts index 10371df..ca97fd6 100644 --- a/packages/effect-lens/src/Lens.ts +++ b/packages/effect-lens/src/Lens.ts @@ -1,5 +1,4 @@ -import { Array, Chunk, Effect, Function, Option, Pipeable, Predicate, Readable, Stream, type SubscriptionRef, type SynchronizedRef } from "effect" -import * as Cause from "effect/Cause" +import { Array, Chunk, Effect, Function, identity, Option, Pipeable, Predicate, Readable, Stream, type SubscriptionRef, type SynchronizedRef } from "effect" import type { NoSuchElementException } from "effect/Cause" import * as Subscribable from "./Subscribable.js" @@ -437,14 +436,8 @@ export const focusOption: { self: Lens, ER, EW, RR, RW>, ): Lens => mapEffect( self, - option => Option.match(option, { - onSome: value => Effect.succeed(value), - onNone: () => Effect.fail(new Cause.NoSuchElementException()), - }), - (option, value) => Option.match(option, { - onSome: () => Effect.succeed(Option.some(value)), - onNone: () => Effect.fail(new Cause.NoSuchElementException()), - }), + identity, + (a, b) => Effect.map(a, () => Option.some(b)), )