
27 Mar
2013
27 Mar
'13
3:30 p.m.
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 it.
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.