purescript-contrib/purescript-argonaut-core

Unify `JsonDecodeError` types into this library

JordanMartinez opened this issue · 2 comments

JsonDecodeError is defined in two separate places:

purescript-argonaut-codecs defines parsJson, but codec-argonaut does not.

Can we define both the JsonDecodeError type and parseJson in this library so that the two other libraries can be used interchangeably?

garyb commented

I don't think it quite belongs in this library, since decode errors are not a core part of "json".

I'd like to figure this out: purescript-contrib/purescript-argonaut-codecs#85 before committing to a shared representation too.

I've also been working on reviving/finalising my purescript-json library a bit recently (which is intended to finally be an official core library for JSON), so I'll probably take a look at errors again as part of a codec-json library I'm making for it. codec-json may end up much the same as codec-argonaut, but there's a few things I'm experimenting with to try and simplify or improve aspects of it.

I don't think it quite belongs in this library, since decode errors are not a core part of "json".

Mm... Good point. I guess a workaround would be to define a function that can convert from one to the other then.

I'd like to figure this out: purescript-contrib/purescript-argonaut-codecs#85 before committing to a shared representation too.

I'll respond to that comment in that thread rather than here.