Re: Fractional of DiffTime

DiffTimes need to be added and subtracted. Unfortunately to add or
subtract anything you must implement the Num class. By doing that you
now you either also support division and multiplication, or you throw
a runtime error. This also comes up with vectors and matrices which
don't follow the usual Num rules, and so must have their own operators
in libraries to support their operations.

It has been suggested in the past to separate all of the operations in
the Num class into their constituent parts, say Addable, Subtractable,
Multiplicative, Negatable, etc, but you can imagine the boilerplate of
implementing all those classes for your own types, and also the hairy
types that would be inferred by the compiler for very simple
arithmetic functions. But if you are going to go that far, you might
as well try to go all the way down into number theory.

So there are alternative numeric preludes that attempt to deal with
most of this stuff on hackage. For example numeric-prelude, although
that library does not include DiffTime specifically, it likely has the
classes necessary to make a reasonable go at it.

Re: Fractional of DiffTime

Hello, David.

Interesting... There is also library num-hask, but no DiffTime there.

> It has been suggested in the past to separate all of the operations in
> the Num class into their constituent parts, say Addable, Subtractable,
> Multiplicative, Negatable, etc, but you can imagine the boilerplate of
> implementing all those classes for your own types, and also the hairy
> types that would be inferred by the compiler for very simple
> arithmetic functions. But if you are going to go that far, you might
> as well try to go all the way down into number theory.