0.2.1 + 2.0.0-beta.0 #6

Merged
Thilawyn merged 20 commits from next into master 2026-06-22 01:35:08 +02:00
Showing only changes of commit 85b398f8cd - Show all commits
+6 -16
View File
@@ -1,15 +1,4 @@
import {
Array,
type Cause,
Chunk,
Effect,
Function,
Iterable,
Option,
Pipeable,
Predicate,
Stream,
} from "effect"
import { Array, type Cause, Chunk, Effect, Function, Iterable, Option, Pipeable, Predicate, Stream } from "effect"
export const SubscribableTypeId: unique symbol = Symbol.for("@effect-fc/Lens/v4/Subscribable")
@@ -75,8 +64,8 @@ export const map: {
<A, B>(f: (a: NoInfer<A>) => B): <E, R>(self: Subscribable<A, E, R>) => Subscribable<B, E, R>
<A, E, R, B>(self: Subscribable<A, E, R>, f: (a: NoInfer<A>) => B): Subscribable<B, E, R>
} = Function.dual(2, <A, E, R, B>(self: Subscribable<A, E, R>, f: (a: NoInfer<A>) => B) => make({
get: Effect.map(self.get, f),
changes: Stream.map(self.changes, f),
get get() { return Effect.map(self.get, f) },
get changes() { return Stream.map(self.changes, f) },
}))
export const mapEffect: {
@@ -86,8 +75,8 @@ export const mapEffect: {
self: Subscribable<A, E, R>,
f: (a: NoInfer<A>) => Effect.Effect<B, E2, R2>,
) => make({
get: Effect.flatMap(self.get, f),
changes: Stream.mapEffect(self.changes, f),
get get() { return Effect.flatMap(self.get, f) },
get changes() { return Stream.mapEffect(self.changes, f) },
}))
/** Maps over an `Option` value in the `Subscribable`. */
@@ -110,6 +99,7 @@ export const mapOptionEffect: {
onNone: () => Effect.succeed(Option.none()),
})))
/** Narrows the focus to a field of an object. */
export const focusObjectOn: {
<A extends object, K extends keyof A>(key: K): <E, R>(self: Subscribable<A, E, R>) => Subscribable<A[K], E, R>