Proposal: add conversion functions to Data.Fixed.
ashley at semantic.org
Sat Dec 8 06:49:04 CET 2012
On 07/12/12 09:15, Ian Lynagh wrote:
> On Sat, Dec 01, 2012 at 09:14:28PM -0500, Edward Kmett wrote:
>> To be frank, I would just rather have access to the constructor to Fixed.
> I would prefer this, in Data.Fixed.Internal[s], to the original
Is another module really necessary? Note that fromEnum and toEnum
already expose the internal Integer, badly, as an Int.
These are the changes I think we should make to Fixed:
1. Make the internal type generic, similar to Ratio/Rational.
2. Make access to the internal type easy and fast. Ratio has
numerator/denominator/(%), but Ratio needs to canonicalise its values to
lowest terms. Fixed doesn't need that, so exposing the constructor
3. Move Data.Fixed into a new package, possibly with Data.Ratio and
perhaps other numerics stuff that can be moved out of base.
4. Move div', mod' and divmod' to a more sensible module and maybe
rename them, or have them replace div, mod and divmod.
I am somewhat motivated to 1 by calls to make certain time types
generic, although that's a separate discussion with its own issues.
More information about the Libraries