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 (k1 :: k) where
- type DurationUnit (k1 :: k)
- durationVal :: DurationUnit k1
- durationMicroseconds :: forall {k} (d :: k). (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 (k1 :: k) where Source #
A class of types which can be reified as value-level descriptions of time periods.
Associated Types
type DurationUnit (k1 :: k) Source #
The type representing value-level descriptions of the time period
corresponding to k
.
Methods
durationVal :: DurationUnit k1 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 {k} (d :: k). (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 |
Instances
KnownNat n => KnownDuration ('Attosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Attosecond n) Source # | |||||
KnownNat n => KnownDuration ('Day n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Day n) Source # | |||||
KnownNat n => KnownDuration ('Femtosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Femtosecond n) Source # | |||||
KnownNat n => KnownDuration ('Fortnight n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Fortnight n) Source # | |||||
KnownNat n => KnownDuration ('Hour n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Hour n) Source # | |||||
KnownNat n => KnownDuration ('Microsecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Microsecond n) Source # | |||||
KnownNat n => KnownDuration ('Millisecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Millisecond n) Source # | |||||
KnownNat n => KnownDuration ('Minute n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Minute n) Source # | |||||
KnownNat n => KnownDuration ('Nanosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Nanosecond n) Source # | |||||
KnownNat n => KnownDuration ('Picosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Picosecond n) Source # | |||||
KnownNat n => KnownDuration ('Second n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Second n) Source # | |||||
KnownNat n => KnownDuration ('Week n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel Associated Types
Methods durationVal :: DurationUnit ('Week n) Source # | |||||
type DurationUnit ('Attosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Day n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Femtosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Fortnight n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Hour n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Microsecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Millisecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Minute n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Nanosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Picosecond n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Second n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel | |||||
type DurationUnit ('Week n :: TimePeriod) Source # | |||||
Defined in Data.Time.TypeLevel |