System.Time.Clock Implementation - Clock.hs (1/1)

Ashley Yakeley ashley at
Thu Feb 24 18:22:50 EST 2005

In article <87bra9sqb6.fsf at qrnik.zagroda>,
 Marcin 'Qrczak' Kowalczyk <qrczak at> wrote:

> Wouldn't it be more convenient if they were interpreted as seconds
> (accurate to a picosecond)?

Pwrhaps. But this means making instances of Num as a fixed-point type:

  (MkDiffTime a) * (MkDiffTime b) = MkDiffTime (a * b / 10^12)

We'd probably want to make a separate numeric type:

  newtype Pico = MkPico Integer deriving (Eq,Ord)

  newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord,Num,...)

  newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord,Num,...)

Ashley Yakeley, Seattle WA

More information about the Libraries mailing list