StevenWInfo / haskell-soda

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

Improve the return types of some of the binary operators #29

Open StevenWInfo opened 7 years ago

StevenWInfo commented 7 years ago

Some of the binary operators can have different types on the left and right of the operator. This makes it difficult to decide what the resulting type of the operator should be. Right now it just arbitrarily picks the one on the right.

I think that maybe the Constructors should be exported with type a -> b -> c where they can put a type annotation to explicitly say what type they want, and then the infix operator will have type a -> b -> b. Possibly also give a hint in the operator that it is the one on the right, like changing $+ to $+> or something.

StevenWInfo commented 7 years ago

As I mentioned in another issue, restricting the operators to two type variables prevents something like Double -> Number -> Money which should be possible. I also mentioned that the equality operator is also problematic because it can't compare different numeric types.