justinwoo / purescript-simple-json

A simple Purescript JSON library that uses types automatically
http://purescript-simple-json.readthedocs.io
MIT License
133 stars 45 forks source link

Provide Generics-Rep functions for sum, product, and "enum" types #24

Closed justinwoo closed 6 years ago

justinwoo commented 6 years ago

Duplication of some effort from foreign-generics but it's worth not having to deal with the various different instances like trying to bring in IsForeign or whatnot.

justinwoo commented 6 years ago

Actually, depending on your beliefs, you may not want to provide anything for product types, because who needs product types when you have records?

justinwoo commented 6 years ago

This should also include untagged sum functions, like so: https://github.com/justinwoo/untagged-sum-decode-simple-json-example/blob/e92a8334f49f997a0991abc63056532ea3ef899b/src/Main.purs#L31

justinwoo commented 6 years ago

mmm, I looked at this today and it would be much better to put this off until 0.12 because we want to work with records as regular types instead of writing redundant and potentially diverging implementations in the instances for generics-rep Rec/Field.

justinwoo commented 6 years ago

Example of foreign-generics with current compiler: https://github.com/justinwoo/simple-json-generic-sums

justinwoo commented 6 years ago

Not much to be done here for now.