StevenWInfo / haskell-soda

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

Make it clearer what the return type of most binary operators will be. #16

Closed StevenWInfo closed 7 years ago

StevenWInfo commented 7 years ago

Either make the parametric binary operator types simpler, have the operator hint which type it is using, or make it very clear in the documentation which it is. Ideally, a combination of all three.

StevenWInfo commented 7 years ago

I think I can make it a different type than both of the inputs to the constructors, but that would mean that you have to put type declarations on it whenever you use it, which would be annoying. However, I suppose it's possible that someone would want something like Double -> Number -> Money, which restricting the constructor would prevent.

Perhaps I could make the constructor like that, but make the infix operators have type a -> b -> b (or the other way around) so that if they really want that other way, they could use the non-infix operator. I'm fairly certain that this is possible, but I'll have to test it.

StevenWInfo commented 7 years ago

The equality operator will need some really good solution, because right now it requires both types to be the same. You can compare different numeric types together which this doesn't allow. If we really need to, I suppose we could have two different constructors, but that just adds another rule to keep track of.

StevenWInfo commented 7 years ago

I made a note in the documentation about this problem. Hopefully people will notice it. I'll close this issue, but I've opened up another issue #29 to try and improve this problem in general.