cdepillabout / cdepillabout/servant-checked-exceptions

Simplify the From/ToJSON instances for Envelope

Open
#5 11 comments 2 reactions 0 assignees View on GitHub
help wanted
Dominant language
Haskell
Stars
75
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Currently, `Envelope` wraps errors with `{ "err": ... }` and successes with `{ "data": ... }`. These cannot be customized by the user, and they prevent some structures I would like to be able to return. I think the `ToJSON` instance should simply defer to the underlying `ToJSON` instances without doing any wrapping to avoid imposing requirements on the user’s responses.

I also question whether or not the `FromJSON` instance is even a good idea at all. I’m not sure when I would want to construct an `Envelope` from JSON input, and as the documentation mentions, it’s problematic if the instances are ambiguous. My preference would simply be to eliminate the `FromJSON` instance entirely.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.