StevenWInfo / haskell-soda

Haskell bindings for the Socrata Open Data API
MIT License
4 stars 0 forks source link

Double isn't interpreted in the response #28

Open StevenWInfo opened 7 years ago

StevenWInfo commented 7 years ago

Because SODA returns SODA Doubles as JSON strings, the FromJSON parsing of those fields into Haskell's Doubles breaks and returns nothing. You also can't override an already declared instance for a specific type, which means we can't write a new instance FromJSON instance for Double to be like SodaNum's instance. This means that right now, the interpreted responses just don't contain Double values (it's been a while since I tested, so I can't remember if that's exactly what happens).

I actually haven't seen too many datasets with the Double type, but this is still a pretty big issue. The only solution that I can think of right now would be to change the Double type into a newtype like SodaNum and Money. Having to deal with the newtype for those types is already pretty annoying though, and it seems like you should be able to use a basic datatype in an easier way. If there's no other way though, then I guess we'll have to do it to make responses work correctly.