haskus-utils-1.5: Haskus utility modules

Safe HaskellSafe
LanguageHaskell2010

Haskus.Utils.TimedValue

Description

Mutable value with associated last write time

Synopsis

Documentation

data TimedValue t a Source #

Value with Eq/Ord instances uniquely based on time field indicating the time the value was last written.

This can be used with IOVar/IOTree which use Eq instances to detect value changes. It can be useful for values that we don't want to structurally compare (because it is too costly or because we can't)

t should be SystemTime (fast to query monotonic clock)

Constructors

TimedValue t a 
Instances
Eq t => Eq (TimedValue t a) Source # 
Instance details

Defined in Haskus.Utils.TimedValue

Methods

(==) :: TimedValue t a -> TimedValue t a -> Bool #

(/=) :: TimedValue t a -> TimedValue t a -> Bool #

Ord t => Ord (TimedValue t a) Source # 
Instance details

Defined in Haskus.Utils.TimedValue

Methods

compare :: TimedValue t a -> TimedValue t a -> Ordering #

(<) :: TimedValue t a -> TimedValue t a -> Bool #

(<=) :: TimedValue t a -> TimedValue t a -> Bool #

(>) :: TimedValue t a -> TimedValue t a -> Bool #

(>=) :: TimedValue t a -> TimedValue t a -> Bool #

max :: TimedValue t a -> TimedValue t a -> TimedValue t a #

min :: TimedValue t a -> TimedValue t a -> TimedValue t a #