[Haskell-beginners] Fractional of DiffTime

Baa aquagnu at gmail.com
Fri Aug 18 13:04:16 UTC 2017


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.

It makes sense. OK. Thank you!


> 
> 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.
> 
> On Fri, Aug 18, 2017 at 5:35 AM, Baa <aquagnu at gmail.com> wrote:
> > Hello, List!
> >
> > DiffTime type has "closed" on itself operation "/". So,
> >
> >   (/) :: DiffTime -> DiffTime -> DiffTime
> >
> > But from a physics point of view, it doesn't make sense. When you
> > divide hours by hours you get "dimensionless" value, not units
> > (hours) but simple number (I'm not sure how it's named in English).
> >
> > And it's true for any physical values:
> >
> >    [m/s]  :  [m/s]  =  [Int]    (not [m/s] sure)
> >
> > Is it right to define CLOSED "/" for such set like DiffTime?
> >
> > ===
> > Best regards, Paul
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners  
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



More information about the Beginners mailing list