add TSubscriptionRef
Type
- [ ] Refactor
- [ X] Feature
- [ ] Bug Fix
- [ ] Optimization
- [ ] Documentation Update
Description
Add TSubscriptionRef for STM
Related
- Related Issue #
- Closes #
🦋 Changeset detected
Latest commit: 55dcb28e25e473eb172d20d43b817f4c0aa7d7f4
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 32 packages
| Name | Type |
|---|---|
| effect | Minor |
| @effect/cli | Major |
| @effect/cluster-browser | Major |
| @effect/cluster-node | Major |
| @effect/cluster-workflow | Major |
| @effect/cluster | Major |
| @effect/experimental | Major |
| @effect/opentelemetry | Major |
| @effect/platform-browser | Major |
| @effect/platform-bun | Major |
| @effect/platform-node-shared | Major |
| @effect/platform-node | Major |
| @effect/platform | Major |
| @effect/printer-ansi | Major |
| @effect/printer | Major |
| @effect/rpc-http | Major |
| @effect/rpc | Major |
| @effect/schema | Major |
| @effect/sql-d1 | Major |
| @effect/sql-drizzle | Major |
| @effect/sql-kysely | Major |
| @effect/sql-libsql | Major |
| @effect/sql-mssql | Major |
| @effect/sql-mysql2 | Major |
| @effect/sql-pg | Major |
| @effect/sql-sqlite-bun | Major |
| @effect/sql-sqlite-node | Major |
| @effect/sql-sqlite-react-native | Major |
| @effect/sql-sqlite-wasm | Major |
| @effect/sql | Major |
| @effect/typeclass | Major |
| @effect/vitest | Major |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@mikearnaldi would love to get your feedback on this when you've got a moment. I think it's good to go but this is my first stab at adding a new module and I may have missed things.
removed some comments and debug stuff I accidentally left in internal
Cc @tim-smart for a second review, I think I am fine with it albeit have some doubts about mixing stream with stm
I'm curious what doubts you have about mixing stream and stm? The use case leading me to implement this is when I need the synchronization capabilities of stm but also need the value-over-time for things like rendering UI.
I'm curious what doubts you have about mixing stream and stm? The use case leading me to implement this is when I need the synchronization capabilities of stm but also need the value-over-time for things like rendering UI.
Namely subscribing gives you back a non transactional primitive (Stream) I think I'd prefer if subscribing gave you a TDequeue like TPubSub does:
export const subscribe: <A>(self: TPubSub<A>) => STM.STM<TQueue.TDequeue<A>>
Hmm interesting. I'm not sure what benefit that would offer. I can't think of a use case right now when I'd want a TDequeue instead of a Stream. Did you have something in mind?
Hmm interesting. I'm not sure what benefit that would offer. I can't think of a use case right now when I'd want a TDequeue instead of a Stream. Did you have something in mind?
The TQueue interface has all methods returning STM so they can be used transactionally. It's strictly more powerful as you can derive a Stream from a TQueue but not the opposite
I'll update the PR with the requested changes later this week, thanks for the feedback!
@tim-smart I think this is now in a good state, pls have a final review, feel free to merge directly is all looks good
@mikearnaldi thanks for finishing this up!