StevenWInfo / haskell-soda

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

Account for the fact that all datatypes have a null value #14

Open StevenWInfo opened 7 years ago

StevenWInfo commented 7 years ago

Currently, only Checkbox typed columns are considered to be able to have null values, but any column of any type can actually have null values. This means our model is a bit off. Functionally it also means we can't currently filter a text field where it isn't (or is) null. Need to change all of the types to add that value. Possibly by making them maybe types, or by making them sum types with another value. I suppose both would be similar, although the latter might have one less constructor depending on the type.

StevenWInfo commented 7 years ago

To correct my previous comment, we can currently filter if a field is null with IS NOT NULL. However we can't do it with the actual value null, which may be fine. Another alternative to the solution in the previous comment is actually taking the null value out of the Checkbox instead, and just use IS NOT NULL or IS NULL when checking for null. I'm not sure if the actual null value is needed as part of all of the values besides filtering out where it is or is not null though. I may need to try and see if there are any possible use scenarios for not taking out an actual null value completely.

I suppose we could also use the "bottom" or "undefined" value as null, since they're a part of all of those types already anyways, but I'm not sure how accepted actually using those values is in Haskell code.