Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made Ref, SynchronizedRef,RcRef, and SubscriptionRef a subtype of Effect` #3511

Merged
merged 6 commits into from
Sep 8, 2024

Conversation

KhraksMamtsov
Copy link
Contributor

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Related

Copy link

changeset-bot bot commented Aug 28, 2024

🦋 Changeset detected

Latest commit: 47e9fa1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 31 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-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

@github-actions github-actions bot changed the base branch from main to next-minor August 28, 2024 11:51
@github-actions github-actions bot force-pushed the next-minor branch 2 times, most recently from 6f12b7a to 9ea0f4f Compare August 29, 2024 02:10
@tim-smart
Copy link
Contributor

I wonder if making Readable a sub-type of Effect is more appropriate.

@github-actions github-actions bot force-pushed the next-minor branch 2 times, most recently from 327cd82 to 6bf28f7 Compare August 30, 2024 09:25
@KhraksMamtsov
Copy link
Contributor Author

If I make Readable a subtype of Effect this error arise:
image
Readable looks more like mixin or trait - and only finalized types should be Effect's subtypes

Also where is problem with Unify - now it is designed to work with covariant types
But since *Ref has an invariant type parameter, this does not work

type Test = Unify<Ref<1> | Ref<"a">> // Ref<1> | Ref<"a"> | Ref<1 | "a">

because Unify uses ... | Exclude<X, Z> | ... and Exclude<Ref<in out 1> | Ref<in out 'a'>, Ref<in out 1 | 'a'> takes no effect

@KhraksMamtsov KhraksMamtsov changed the title Made Ref, SynchronizedRef and SubscriptionRef a subtype of Effect Made Ref, SynchronizedRef,RcRef, and SubscriptionRef a subtype of Effect` Aug 30, 2024
@KhraksMamtsov
Copy link
Contributor Author

I figured out with Unify module - all invariant types must remain as they are
add dtslint tests

@KhraksMamtsov
Copy link
Contributor Author

@tim-smart Could you please tell me if this is a move in the right direction? or is the correct implementation much more complicated than this approach? Thank you

@github-actions github-actions bot force-pushed the next-minor branch 2 times, most recently from 9c4ba21 to 5eb5ad7 Compare September 4, 2024 00:05
@tim-smart
Copy link
Contributor

I'm still not sure if I like having Ref's a subtype of Effect, it feels a bit strange. If others like it I'm happy to be veto'ed though.

@github-actions github-actions bot force-pushed the next-minor branch 4 times, most recently from 00583f3 to 89c3411 Compare September 4, 2024 07:52
@mikearnaldi
Copy link
Member

I'm still not sure if I like having Ref's a subtype of Effect, it feels a bit strange. If others like it I'm happy to be veto'ed though.

kind of goes in the same direction of having Option be an Effect

@mikearnaldi
Copy link
Member

I suppose we can accept for now and if we don't like it revise in 4.0

@KhraksMamtsov
Copy link
Contributor Author

kind of goes in the same direction of having Option be an Effect

yes, after turning Option and Either into an Effect, the other subtypes don't look so wild, but even more ergonomic. It seems to be the next logical step.

@mikearnaldi
Copy link
Member

kind of goes in the same direction of having Option be an Effect

yes, after turning Option and Either into an Effect, the other subtypes don't look so wild, but even more ergonomic. It seems to be the next logical step.

indeed, followed by Deferred and Fiber

@github-actions github-actions bot force-pushed the next-minor branch 7 times, most recently from f47a707 to 56df09d Compare September 7, 2024 14:22
@tim-smart tim-smart merged commit 96348a0 into Effect-TS:next-minor Sep 8, 2024
11 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 9, 2024
github-actions bot pushed a commit that referenced this pull request Sep 9, 2024
github-actions bot pushed a commit that referenced this pull request Sep 10, 2024
github-actions bot pushed a commit that referenced this pull request Sep 10, 2024
github-actions bot pushed a commit that referenced this pull request Sep 10, 2024
github-actions bot pushed a commit that referenced this pull request Sep 10, 2024
github-actions bot pushed a commit that referenced this pull request Sep 11, 2024
github-actions bot pushed a commit that referenced this pull request Sep 11, 2024
@github-actions github-actions bot mentioned this pull request Sep 11, 2024
github-actions bot pushed a commit that referenced this pull request Sep 12, 2024
github-actions bot pushed a commit that referenced this pull request Sep 12, 2024
github-actions bot pushed a commit that referenced this pull request Sep 13, 2024
github-actions bot pushed a commit that referenced this pull request Sep 13, 2024
github-actions bot pushed a commit that referenced this pull request Sep 13, 2024
github-actions bot pushed a commit that referenced this pull request Sep 13, 2024
github-actions bot pushed a commit that referenced this pull request Sep 13, 2024
github-actions bot pushed a commit that referenced this pull request Sep 13, 2024
github-actions bot pushed a commit that referenced this pull request Sep 15, 2024
tim-smart pushed a commit that referenced this pull request Sep 15, 2024
@KhraksMamtsov KhraksMamtsov deleted the ref-effect branch September 25, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants