| > And once you have that, maybe they could all return the
| > same type (TimeDiff) and then the need for the class goes away.
| >        diffMinutes :: ClockTime -> ClockTime -> TimeDiff
| I suppose TimeDiff is then a disjunction (Minutes of Int | 
| Days of Int | etc.)
| But I don't really see the point.  The type is now 
| considerably less efficient
| and the compiler has to worry about an entirely bogus 
| matching failure in
|    cass (diffMinutes t1 t2) of
|       Minutes N -> [blah]
| What is so bad about having another class anyway?

It's not terrible. But all the types are isomorphic to Int,
so there'd be a case for making them Ints.

        diffDays :: Time -> Time -> Int
        addDays :: Time -> Int -> Time

        diffMonths :: Time -> Time -> Int
        addMonths :: Time -> Int -> Time

Then it's easy to do things like

        date `addDays` 3

whereas in your formulation you'd have to say

        date `addToClockTime` Days 3

Not a big difference, I grant you, but my own taste
is to keep overloading for where it makes a real difference,
and it just doesn't seem to here.

Simon

Reply via email to