The numeric c types are (effectively) integral, too.
gtener at gmail.com
Wed Mar 27 21:35:12 CET 2013
I second this. The fact that time_t is sometimes uint or anything else is
simply implementation detail (unless one can point to relevant standards
that say otherwise). If one wishes to bet on this being true then simple
private newtype with proper instances seems like the way to go. But it
feels insecure to do otherwise.
On Wed, Mar 27, 2013 at 5:16 PM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:
> On Wed, 27 Mar 2013, Jeff Shaw wrote:
> On Wednesday, March 27, 2013 11:30:24 AM, Henning Thielemann wrote:
>> I don't think that an Integral instance is the right way
>>> to go, since it would imply the signature:
>>> div :: CTime -> CTime -> CTime
>>> and the quotient of two time values is not a time.
>> That is irrelevant.
> It is highly relevant and certainly a major difference between Haskell and
> C. A time can be represented with any unit and with either integer or
> floating or fixed-point numbers. Actually, the integer can always be read
> as fixed-point number, since the unit is somehow arbitrary. The quotient of
> two time values is not a time value but a scalar value and it is good if
> Haskell alerts you when you mix them up.
> Libraries mailing list
> Libraries at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries