Add JPropCodec variants of sum codecs
#81
+71
−92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@m-bock Right before I made the release as per #80 I ran into a case where I found myself wanting a
JPropCodecfor a sum type so I could combine it with another codec for a surrounding type:This gives us
Tuple "foo" (Str "BAR")⇔{ "name": "foo", "type": "str", "value": "BAR" }. The motivating case was a bit more involved, so this looks like a lot of work for something of questionable necessity, but hopefully it illustrates the idea still! Basically, without this, we can't deal with complex sums and would have to match our PS representation to the flat structure of the JSON object (aside from introducing further types and doing a conversion step or something like that).(Also, isn't it kinda cool the way
codecVarworked out? 😄)