-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add instance for Ratio? #113
Comments
There was a bit of discussion on the discord about this, and the point was brought up that adding dependencies on js libraries is something that might want to be avoided for this library. My 2p: it's probably fine, since |
Hi @kindaro — I'm no longer a maintainer of this library, but you may be able to find someone in the #contrib channel on Discord who can look at this with an eye to merging. However, some thoughts. First in brief, then a bit longer: In brief, I'm OK with adding this dependency and a instance for
I recommend being careful here. Argonaut does not promise to match Aeson, though it borrows heavily from that library. I don't expect that all instances in this library are the same as the Aeson forms, and they may diverge in the future. If you need to have a JSON library that exactly matches Aeson for use with purescript-bridge, then I think you should fork this library or create a new one with that explicit goal (that would also let you write any additional instances you want).
Yes, this is a problem with type class codec libraries like The most common thing to do is write a new app-specific class in your codebase for dealing with JSON. The Decoders and Encoders modules exist to help you write your own classes by providing default implementations: You can copy/paste the Argonaut classes into your application: There are other, worse options: for example, you can newtype
That's a good point; with |
Thank you @garyb @thomashoneyman. I am going to be building my stuff from my own fork for now. Whether this feature gets merged or not, in the long term I shall need to talk to @eskimor (maintainer of |
I am no longer the maintainer of |
I want to encode and decode values of type
Ratio
. It is not supported yet. My offer is to encode and decode the same way as Aeson:My case specifically is related to
argonaut-aeson-generic
andpurescript-bridge
, so it is important to me that the encoding matches the Haskell side of my code. Since PureScript does not support orphan instances, I have no other way of making stuff work.I can write a patch in no time.
The text was updated successfully, but these errors were encountered: