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

Replace DeserializationResult with Result from Returns #9

Open
drhagen opened this issue Jan 31, 2024 · 0 comments
Open

Replace DeserializationResult with Result from Returns #9

drhagen opened this issue Jan 31, 2024 · 0 comments

Comments

@drhagen
Copy link
Owner

drhagen commented Jan 31, 2024

Serialite currently uses it own implementation of DeserializationResult. We should replace this with Result defined in the popular Returns library. Parsita previously made this migration. This would integrate Serialite into the Returns ecosystem.

Any return types of DeserializationResult[Output] would be replaced with Result[Output, DeserializationError]. Just like Parsita, we should reexport serialite.Result = result.Result[Output, DeserializationError], Success = result.Success, and Failure = result.Failure[DeserializationError].

The biggest loss would be the or_die method. In Returns, the syntax for returning the success value or raising the failure is rather ugly: result.alt(raise_exception).unwrap().

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

No branches or pull requests

1 participant