-
-
Notifications
You must be signed in to change notification settings - Fork 316
Add Effect.transposeFlatMapOption
#4904
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
Add Effect.transposeFlatMapOption
#4904
Conversation
🦋 Changeset detectedLatest commit: d0fba6d The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 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 |
6cb2e94
to
ca6c582
Compare
Not sure about this, we are trying to get away from auto flattening now. |
336cc43
to
aba8571
Compare
Yeah, automatic flattening is almost always an unexpected behavior and should be avoided. |
Ok. I get the point. |
1d3e3be
to
9c3f578
Compare
c06437a
to
67530c3
Compare
Effect.transposeMapOption
Effect.transposeFlatMapOption
@tim-smart and @gcanti I did the change to |
aa2ec73
to
c051853
Compare
9b92093
to
bf30ec1
Compare
c6bd1f8
to
07444af
Compare
bf30ec1
to
7379442
Compare
59ef614
to
7d8c110
Compare
7379442
to
e317b2f
Compare
e317b2f
to
b13285d
Compare
bbba077
to
6c5dc32
Compare
b13285d
to
d0fba6d
Compare
@vinassefranche I'm not sure this is a common enough use case to justify a dedicated API import { Effect, Option, pipe } from "effect"
// ┌─── Effect<Option<number>, never, never>>
// ▼
const res = pipe(
Option.some(2),
Effect.transposeMapOption((n) => Effect.succeedSome(n * 3)),
Effect.map(Option.flatten)
) |
Alright. We have this helper in our code base anyway. This is something we do pretty often so it's worth for us but I know you want to limit the api surface so I won't push it :-) |
Type
Description
This adds
Effect.transposeFlatMapOption
:Related