json
json copied to clipboard
Add a function to create a Decoder from an Error value
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.