SimpleH-1.2: A light, clean and powerful Haskell utility library

Safe HaskellNone




Unambiguous times

data Time t Source

A type wrappers for timestamps that can be compared unambiguously


Unit Time 
Bounded (Time t) 
Ord t => Eq (Time t) 
Ord t => Ord (Time t) 
(Eq t, Show t) => Show (Time t) 
Ord t => Orderable (Time t) 
Ord t => Ring (Time t)

The Time ring where (*) == min and one == maxBound

Ord t => Monoid (Time t)

The Time monoid where zero == minBound

Ord t => Semigroup (Time t)

The Time semigroup where ta + tb == max ta tb

timeVal :: Time t -> TimeVal tSource

A Time's pure value. May not be defined immediately.

Time utilities

timeIO :: IO a -> IO (Time Seconds)Source

Constructs a Time representing the time by which the argument terminates.

Warning: This function executes its argument, ignoring its value. Thus, it would be wise to use it on idempotent blocking actions, such as readMVar.

timeOrigin :: ([birthTime :: Seconds] => IO a) -> IO aSource