The numeric c types are (effectively) integral, too.
lemming at henning-thielemann.de
Wed Mar 27 16:30:24 CET 2013
On Wed, 27 Mar 2013, Jeff Shaw wrote:
> roundTo :: CTime -> CTime -> CTime
> roundTo a b = (a `div` b) * b
> This works right now, but requires a trivial Integral class be written for every program that wants to do
Writing orphan instances is generally a bad idea. Instead you could put
your roundTo function into a nice package and import it everywhere. 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.
More information about the Libraries