garyb / purescript-codec-argonaut

Bi-directional JSON codecs for argonaut
MIT License
38 stars 16 forks source link

Duplicate `JsonDecodeError` type with Data.Argonaut.Decode #38

Closed wclr closed 3 years ago

wclr commented 3 years ago

This module has its own JsonDecodeError type (that is just a copy of the code from Data.Argonaut.Decode.Error), which makes modules incompatible. How this could be solved, with dependency on "argonaut-codes"?

garyb commented 3 years ago

It's the other way around, the error type was copied from here to -argonaut-codecs. The modules being incompatible isn't of great concern to me personally, as I don't use -argonaut-codecs and don't want to add a dependency on it - I think it's a bad library.

If we can figure out a decent resolution to the problem of wanting a slightly more open error type, talked about in https://github.com/purescript-contrib/purescript-argonaut-codecs/pull/85 (there is discussion scattered in a few places too I think) and then make a library with just that type I'd switch to it though.

wclr commented 3 years ago

The modules being incompatible isn't of great concern to me personally

It can be a concern for lib authors that would like to use Json/JsonDecodeError types and give users the freedom to choose a particular way they perform encoding/decoding (use codecs or codec).

It seems like PureScript lacks a standardized approach to handling JSON, which is kind of a basic type for the main PS application. I believe you wanted to fix this with https://github.com/garyb/purescript-json?

garyb commented 3 years ago

Yeah, exactly. I think most people do use argonaut-core but there's some inappropriately using foreign, etc. That -json library is intended to go in core, and will have absolutely minimal FFI so it can be used easily across different backends.

It's not going to contain any opinion on codecs though, so it won't really have an impact on this problem.

wclr commented 3 years ago

That -json library is intended to go in core

Just to clear things up, what is meant by "core" here? Is this Json type supposed to be standard like String and Array?

garyb commented 3 years ago

It means the library will move under the main purescript organisation.

JordanMartinez commented 3 years ago

@wclr See The Core Libraries

wclr commented 3 years ago

@garyb hah ok, to me "go to core" sounded like something deep. Why modules there come under Json namespace, not Data.Json? Does this refer to a more global issue of fattening namespaces?