Initial commit
Some checks failed
Lint / lint (push) Failing after 12s
Publish / publish (push) Failing after 11s

This commit is contained in:
Julien Valverdé
2026-03-25 00:44:50 +01:00
commit c77057a2c9
68 changed files with 5627 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { Array, Console, Effect, Stream, SubscriptionRef } from "effect"
import { Lens } from "effect-lens"
Effect.gen(function*() {
// The ref is the data source
const ref = yield* SubscriptionRef.make([12, 87, 69])
// The lens acts as a proxy that allows reading, subscribing from and writing to that
// data source with a similar API to Effect's SubscriptionRef
const lens = Lens.fromSubscriptionRef(ref)
// ^ Lens.Lens<number[], never, never, never, never>
const value = yield* Lens.get(lens)
yield* Effect.forkScoped(Stream.runForEach(lens.changes, Console.log))
yield* Lens.update(lens, Array.replace(1, 1664))
})
Effect.gen(function*() {
})