-
Notifications
You must be signed in to change notification settings - Fork 47
suggestion to replace "value"
with "contents"
in Either
decoder, encoder
#115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
"value"
with "contents"
in Either
decoder"value"
with "contents"
in Either
decoder, encoder
Hi @peterbecich and thanks for your continuing effort to merge IOHK's changes to Please take a look at this comment nearby: #113 (comment) — and the conversation preceding it. Note the following:
This is bad news for us. We can fork this package under a different name, say |
Thanks @kindaro , I have read all of #113 (comment) now; I incorrectly assumed Argonaut promised to match Aeson. I agree we should fork https://github.com/purescript-contrib/purescript-argonaut-codecs. However, now that we have identified this issue, I believe it will be an issue for both the The IOHK fork implemented better test coverage. Specifically, the |
Is your change request related to a problem? Please describe.
In Haskell's Aeson library, the default
contentsFieldName
is"contents"
:https://hackage.haskell.org/package/aeson-2.2.1.0/docs/Data-Aeson.html#v:defaultTaggedObject
In
argonaut-codecs
, it appears the default is"value"
:purescript-argonaut-codecs/src/Data/Argonaut/Decode/Decoders.purs
Line 69 in 50e79f6
Examples:
https://github.com/coot/purescript-argonaut-aeson-generic depends on
argonaut-codecs
and attempts to provide compatibility between PureScript's Argonaut and Haskell's Aeson. It uses"contents"
. For most data types, it works great. However, it cannot decode/encodeEither
to be compatible with Haskell's Aeson.I have provided an example in this issue: coot/purescript-argonaut-aeson-generic#22
I have attempted to fix this on the Haskell side by overriding the instances to use
"value"
, but haven't managed to make this work: https://github.com/peterbecich/purescript-bridge/blob/55e265b0d44c001357cd3aef3ac4a894128df12f/example/src/Types.hs#L96Describe the solution you'd like
My request is to change
"value"
to"contents"
here:purescript-argonaut-codecs/src/Data/Argonaut/Decode/Decoders.purs
Line 69 in 50e79f6
and in the encoder
I have tested this: eskimor/purescript-bridge@55e265b This change fixes
argonaut-aeson-generic
.Either
is encoded and decoded successfully.Additional context
I am attempting to update Purescript Bridge and encountered this issue: eskimor/purescript-bridge#89
Thank you
The text was updated successfully, but these errors were encountered: