3 ms·
Ok, so use a parser then? Not sure what this has to do with comparison to dynlang/js. OP was complaining that it's hard to type some kinds of payloads. Sure y
by platz 7y ago
Ok, so use a parser then? Not sure what this has to do with comparison to dynlang/js.
OP was complaining that it's hard to type some kinds of payloads.
Sure you could write a custom parser for it.
With fromJSON in fact this is what you write. Maybe if you've only been driving Json instances generically, you never actually written a fromJSON instance in Aeson? I only use generic deriving in the simplest cases.. otherwise just write the fromJSON instance parser
My point was that you can defer parsing up front and just return a map of you don't want deal with the shape.
But sure you could write a custom parser as well, that falls more into the typed philosophy though than what js folks are used to