-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Swap Either type params #2102
Swap Either type params #2102
Conversation
🦋 Changeset detectedLatest commit: e54a577 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
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 |
fdb21cb
to
fde0f40
Compare
I think this a good change to keep it in line with all of the other changed types But I am curious why the decision to only modify the type parameter order, and not the runtime semantics? Surely the function named const right: Either.Either<string, never> = Either.right("ok"); // right = left
const left: Either.Either<never, number> = Either.left(5); // left = right because making them match just feels nicer? of course it makes it a bit of a bigger migration, but its already a breaking change |
Users complained that "right" feels like "success" and "left" doesn't , also we couldn't write a codemod for that as it touches too many things that are contextual so the pain would probably be too big to migrate manually |
gj for swapping to more semantic L and R. Use Effect/Exit when you need to model Error and Success. |
2cadab4
to
2255d9b
Compare
6fb86a0
to
ab10640
Compare
fbdc28e
to
5e84f40
Compare
5e84f40
to
e2773c9
Compare
fde0f40
to
43c51fd
Compare
I think it should be noted in the docs, otherwise we will have fp devotees knocking at the door |
43c51fd
to
e54a577
Compare
e2773c9
to
f807d15
Compare
they can keep believing their cult and use fp-ts v2 :) jokes aside, yes everything needs to be documented |
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
I'm late to the party on this, but does this not make any prospective migration from fp-ts more difficult? If so, is it really worth it? |
We are not optimizing for fp-ts migration, we are optimizing for newcomers and effect users.o The migration from fp-ts is a much larger topic, in fp-ts Either was used as a Result, in Effect results are expressed as Exit and also 90% of the direct Either usages should probably instead be straight Effect usages. |
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Co-authored-by: Maxwell Brown <maxwellbrown1990@gmail.com>
Swap type params of Either from
Either<E, A>
toEither<R, L = never>
.Along the same line of the other changes this allows to shorten the most common types such as:
While it was confusing to use
Either<A, E>
I don't find it particularly confusing to useEither<R, L>
, the type reads like "it's either a right or a left"