StevenWInfo / haskell-soda

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

Separate and distinguish the aggregate SODA functions #2

Open StevenWInfo opened 7 years ago

StevenWInfo commented 7 years ago

The aggregate SODA functions have some unique things about them that are currently not reflected in these bindings. For example, you can't use them in $where clauses. This means I'll have to separate out those functions from the other SODA functions and use them slightly differently throughout the code. It will probably involve separating them out into another type, as well as probably making some typeclasses.

There are also some more involved things with aggregates, such as requiring columns to be in the $group clause, however, those will be more involved and I'll probably create another issue for those later.

StevenWInfo commented 7 years ago

I've separated them out into a different type, but I can't figure out how to distinguish any compound type containing an aggregate Soda function from those that don't because it is represented by the last type in the compound GADT.

I think this will have to be a runtime check for now. This bug will track that and then to see if anyone can determine for sure whether this is practically feasible with Haskell.

StevenWInfo commented 7 years ago

If you created a whole duplicate set of GADTs related to something similar, but different from SodaExpr without the SodaAgg type, then I suppose it could work. However, then all of the functions and operators would have different names which seems very unpleasant and inconsistent. Unless there's some way to make the functions and operators more consistent between the two sets of GADTs, I doubt that, that is a very tenable solution.