validity icon indicating copy to clipboard operation
validity copied to clipboard

Aeson tests don't validate toJSON and toEncoding agree

Open dustin opened this issue 3 years ago • 1 comments

It's recommended to implement toEncoding when instantiating ToJSON, but there's no validation ensuring it agrees with toJSON (which is a requirement since it doesn't go the other way).

A simple workaround might be to encode toJSON v and v both while testing round tripping. They don't need to end with identical representations, but the decoder needs to agree that they're equivalent.

dustin avatar Nov 05 '21 01:11 dustin

Sounds good!

NorfairKing avatar Nov 05 '21 10:11 NorfairKing

PR welcome

NorfairKing avatar Mar 06 '23 15:03 NorfairKing