4 ms·
There's Template Haskell support to auto-generate FromJSON/ToJSON instances, so if you don't care exactly how the JSON looks like, you can get type-safe JSON se
by Peaker 13y ago
There's Template Haskell support to auto-generate FromJSON/ToJSON instances, so if you don't care exactly how the JSON looks like, you can get type-safe JSON serialization/schema validation for free.
- tel 13y agoI personally find those wonderful in prototyping but it's rare that I control both ends of a JSON pipeline so it's important for me to write custom schema. One thing I've found really useful is generating ADTs which have structure that's driven by the exact format to make the TH derive a correct To/FromJSON instance and then exporting it abstractly and having lots of Lenses which specify a more Haskell-friendly access pattern.