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

Missing Exit.getOrUndefined, et al. #2705

Open
jessekelly881 opened this issue May 7, 2024 · 4 comments
Open

Missing Exit.getOrUndefined, et al. #2705

jessekelly881 opened this issue May 7, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jessekelly881
Copy link
Contributor

What is the problem this feature would solve?

The Exit module is missing getOrUndefined, getOrNull, etc. These should probably be updated to match the Either module.

What is the feature you are proposing to solve the problem?

^

What alternatives have you considered?

No response

@jessekelly881 jessekelly881 added the enhancement New feature or request label May 7, 2024
@jessekelly881 jessekelly881 changed the title Exit.getOrUndefined, et al. Missing Exit.getOrUndefined, et al. May 7, 2024
@datner
Copy link
Contributor

datner commented May 7, 2024

Should we really promote skipping handling an Exit like that when the alternative is to opt-into an Option / Either instead of an exit to begin with? 🤔

@jessekelly881
Copy link
Contributor Author

We probably shouldn't promote it but the api should probably be consistent with Either. I have a bit of an edge case where I have to run Effect.runExit() and then return undefined if the effect fails.

@datner
Copy link
Contributor

datner commented May 8, 2024

whats runExit?
@jessekelly881 I think this would cover your case fine tbh

const val = Effect.runSync(Effect.option(effect))
// const val = await Effect.runPromise(Effect.option(effect))
return Option.getOrUnderfined(val)

@jessekelly881
Copy link
Contributor Author

jessekelly881 commented May 8, 2024

Effect.runPromiseExit sorry. There are plenty of ways to achieve the same result. I just think that Exit should probably have a similarly complete set of getX fns as Either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants