ttuegel / alsa-mixer

Haskell bindings to the ALSA mixer API
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Don't use Integer in bindings #6

Closed vmchale closed 5 years ago

vmchale commented 5 years ago

Is there any reason the Integer type is used? I'd like type signatures downstream to use Ints instead of Integers. Or really anything efficient (I assume ALSA doesn't bind GMP?)

ttuegel commented 5 years ago

The ALSA API uses the C int type (Haskell CInt type), which has a wider range than Int. GHC represents small Integer values as Int without using GMP, so I would be surprised if this was a bottleneck. Still, I agree it would be ideal if the Haskell interface used a type with the same representation as the C API; would it be awkward if the Haskell interface used CInt?

vmchale commented 5 years ago

I'd be satisfied with CInt, yes. I think Int is probably the same thing barring some odd platform, but it is easy to convert either way.