0.2.5 #43

Merged
Thilawyn merged 94 commits from next into master 2026-03-31 21:01:13 +02:00
Showing only changes of commit 8c86c1ce76 - Show all commits

View File

@@ -155,10 +155,17 @@ export const mapStructAt: {
)) ))
export const mapArrayAt: { export const mapArrayAt: {
<A, ER, EW, RR, RW>(
self: Lens<A[], ER, EW, RR, RW>,
index: number,
): Lens<A, ER | NoSuchElementException, EW | NoSuchElementException, RR, RW>
<A, ER, EW, RR, RW>( <A, ER, EW, RR, RW>(
self: Lens<readonly A[], ER, EW, RR, RW>, self: Lens<readonly A[], ER, EW, RR, RW>,
index: number, index: number,
): Lens<A, ER | NoSuchElementException, EW | NoSuchElementException, RR, RW> ): Lens<A, ER | NoSuchElementException, EW | NoSuchElementException, RR, RW>
<A, ER, EW, RR, RW>(
index: number
): (self: Lens<A[], ER, EW, RR, RW>) => Lens<A, ER | NoSuchElementException, EW | NoSuchElementException, RR, RW>
<A, ER, EW, RR, RW>( <A, ER, EW, RR, RW>(
index: number index: number
): (self: Lens<readonly A[], ER, EW, RR, RW>) => Lens<A, ER | NoSuchElementException, EW | NoSuchElementException, RR, RW> ): (self: Lens<readonly A[], ER, EW, RR, RW>) => Lens<A, ER | NoSuchElementException, EW | NoSuchElementException, RR, RW>
@@ -289,8 +296,8 @@ export const updateAndGetEffect: {
Effect.gen(function*() { Effect.gen(function*() {
const ref = yield* SubscriptionRef.make({ const ref = yield* SubscriptionRef.make({
values: [13, 69, 1488] values: [13, 69, 1488] as readonly number[]
}) } as const)
const myValueLens = ref.pipe( const myValueLens = ref.pipe(
fromSubscriptionRef, fromSubscriptionRef,
@@ -298,6 +305,8 @@ Effect.gen(function*() {
mapArrayAt(1), mapArrayAt(1),
) )
const myValueLens2 = mapArrayAt(mapStructAt(fromSubscriptionRef(ref), "values"), 1)
console.log(yield* ref.get, yield* myValueLens.get) console.log(yield* ref.get, yield* myValueLens.get)
yield* set(myValueLens, 22) yield* set(myValueLens, 22)
console.log(yield* ref.get, yield* myValueLens.get) console.log(yield* ref.get, yield* myValueLens.get)