| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Time.TypeLevel
Description
Exports types which can be used to describe time periods at
the type-level. Use the durationVal function to reify them as the
corresponding value-level descriptions from Data.Time.Units or the
durationMicroseconds function to reify them as microseconds straight away.
Synopsis
- class KnownDuration k where
- type DurationUnit k :: Type
- durationVal :: DurationUnit k
- durationMicroseconds :: forall d. (KnownDuration d, TimeUnit (DurationUnit d)) => Integer
- data TimePeriod where
- Attosecond :: Nat -> TimePeriod
- Femtosecond :: Nat -> TimePeriod
- Picosecond :: Nat -> TimePeriod
- Nanosecond :: Nat -> TimePeriod
- Microsecond :: Nat -> TimePeriod
- Millisecond :: Nat -> TimePeriod
- Second :: Nat -> TimePeriod
- Minute :: Nat -> TimePeriod
- Hour :: Nat -> TimePeriod
- Day :: Nat -> TimePeriod
- Week :: Nat -> TimePeriod
- Fortnight :: Nat -> TimePeriod
Documentation
class KnownDuration k where Source #
A class of types which can be reified as value-level descriptions of time periods.
Associated Types
type DurationUnit k :: Type Source #
The type representing value-level descriptions of the time period
corresponding to k.
Methods
durationVal :: DurationUnit k Source #
durationVal reifies the duration as the corresponding value-level
type. Intended to be used with TypeApplications.
>>>durationVal @('Second 10)10s :: Data.Time.Units.Second
Instances
durationMicroseconds :: forall d. (KnownDuration d, TimeUnit (DurationUnit d)) => Integer Source #
durationMicroseconds is a convenience function which reifies a
type-level duration as microseconds on the value level. Intended to be
used with TypeApplications.
>>>durationMicroseconds @('Second 10)10000000 :: Integer
data TimePeriod where Source #
Constructors
| Attosecond :: Nat -> TimePeriod | Represents |
| Femtosecond :: Nat -> TimePeriod | Represents |
| Picosecond :: Nat -> TimePeriod | Represents |
| Nanosecond :: Nat -> TimePeriod | Represents |
| Microsecond :: Nat -> TimePeriod | Represents |
| Millisecond :: Nat -> TimePeriod | Represents |
| Second :: Nat -> TimePeriod | Represents |
| Minute :: Nat -> TimePeriod | Represents |
| Hour :: Nat -> TimePeriod | Represents |
| Day :: Nat -> TimePeriod | Represents |
| Week :: Nat -> TimePeriod | Represents |
| Fortnight :: Nat -> TimePeriod | Represents |