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

Add a function to create a Decoder from an Error value #25

Open
joshuakb2 opened this issue Oct 16, 2020 · 1 comment
Open

Add a function to create a Decoder from an Error value #25

joshuakb2 opened this issue Oct 16, 2020 · 1 comment

Comments

@joshuakb2
Copy link

Suggestion: Add a function (perhaps called error) that is like fail, except it receives an Error value instead of a String as its argument.

This would be useful in functions that have to call decodeValue inside an andThen continuation.

Here's an example of a case where such a function would be nice (I defined a sub-optimal version of error so it would compile):
https://ellie-app.com/bgcTCxqmSKWa1

Given that the Error type constructors are already exposed from this module, I don't see a good reason not to allow this sort of thing, but maybe there's a downside to this that I haven't considered.

@kintrix007
Copy link

I don't see the downside either. To me it seems it would simply allow nicer error propagation. However, even if this does not become part of the public API (I see no reason against it) there could be benefits even within the module.

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

2 participants