Cahu / krpc-hs

A Haskell client for kRPC
GNU General Public License v3.0
12 stars 2 forks source link

Replace all Floats in API with Doubles #2

Open Shimuuar opened 7 years ago

Shimuuar commented 7 years ago

Since haskell don't have automatic promotion/demotion of numeric types it's awfully inconvenient to work with both. Finding out which value is Float and slamming realToFrac on it is time consuming, distracting and makes code ugly.

I think best solution is to use Double everywhere

Cahu commented 7 years ago

KRPC uses both Doubles and Floats in its api and, afaik, both types are encoded differently by protocol buffers. Maybe it's best to use doubles everywhere at the server level so that all clients need not implement their own conversion. However @djungelorm might in turn face a similar problem with KSP's API.

In any case, I don't think it would be hard to modify the code generator for KRPC services to insert automatic realToFrac conversions where Floats are used.

Shimuuar commented 7 years ago

Yes. I too think that inserting realToFrac in library code is best way to go. Changing wire protocol is a lot of work and creates a lot of compatibility problems