On 19-Oct-1999, George Russell <[EMAIL PROTECTED]> wrote:
> The problem is that both behaviours are desirable.  Sometimes you want
> to say "1 month from now"; sometimes "30 days from now".  I think there
> is an obvious logical solution to this.  Make the two kinds of time difference
> have different types.  Thus
>    class TimeDiff a where
>       addToClockTime :: a -> ClockTime -> ClockTime
>       diffClockTimes :: ClockTime -> ClockTime -> a
> Have types all instances of TimeDiff
>    TimeDiff = TimeDiff Integer -- time in picoseconds
>    TimeDiffDays = TimeDiffDays Int -- time in days
>    TimeDiffMonths = TimeDiffMonths Int -- time in months
>    (We don't actually need any more, since a second is always 10^12 picoseconds,
>    a year is always -- in the Gregorian Calendar -- 12 months, and so on.  But
>    we could easily add them.)

A minute is always 60 seconds... except when there is a leap second.
So I think you need TimeDiffMinutes too.  You might as well include
all of them.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to