Skip to content

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

@joshuakb2

Description

@joshuakb2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions