Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 Attosecond (n :: Nat)
- data Femtosecond (n :: Nat)
- data Picosecond (n :: Nat)
- data Nanosecond (n :: Nat)
- data Microsecond (n :: Nat)
- data Millisecond (n :: Nat)
- data Second (n :: Nat)
- data Minute (n :: Nat)
- data Hour (n :: Nat)
- data Day (n :: Nat)
- data Week (n :: Nat)
- data Fortnight (n :: Nat)
Documentation
class KnownDuration k where Source #
A class of types which can be reified as value-level descriptions of time periods.
type DurationUnit k :: Type Source #
The type representing value-level descriptions of the time period
corresponding to k
.
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 Attosecond (n :: Nat) Source #
Represents n
-many attoseconds.
Instances
KnownNat n => KnownDuration (Attosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Attosecond n) Source # durationVal :: DurationUnit (Attosecond n) Source # | |
type DurationUnit (Attosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Femtosecond (n :: Nat) Source #
Represents n
-many femtoseconds.
Instances
KnownNat n => KnownDuration (Femtosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Femtosecond n) Source # durationVal :: DurationUnit (Femtosecond n) Source # | |
type DurationUnit (Femtosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Picosecond (n :: Nat) Source #
Represents n
-many picoseconds.
Instances
KnownNat n => KnownDuration (Picosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Picosecond n) Source # durationVal :: DurationUnit (Picosecond n) Source # | |
type DurationUnit (Picosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Nanosecond (n :: Nat) Source #
Represents n
-many nanoseconds.
Instances
KnownNat n => KnownDuration (Nanosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Nanosecond n) Source # durationVal :: DurationUnit (Nanosecond n) Source # | |
type DurationUnit (Nanosecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Microsecond (n :: Nat) Source #
Represents n
-many microseconds.
Instances
KnownNat n => KnownDuration (Microsecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Microsecond n) Source # durationVal :: DurationUnit (Microsecond n) Source # | |
type DurationUnit (Microsecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Millisecond (n :: Nat) Source #
Represents n
-many milliseconds.
Instances
KnownNat n => KnownDuration (Millisecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Millisecond n) Source # durationVal :: DurationUnit (Millisecond n) Source # | |
type DurationUnit (Millisecond n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Second (n :: Nat) Source #
Represents n
-many seconds.
Instances
KnownNat n => KnownDuration (Second n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Second n) Source # durationVal :: DurationUnit (Second n) Source # | |
type DurationUnit (Second n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Minute (n :: Nat) Source #
Represents n
-many minutes.
Instances
KnownNat n => KnownDuration (Minute n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Minute n) Source # durationVal :: DurationUnit (Minute n) Source # | |
type DurationUnit (Minute n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
Represents n
-many hours.
Instances
KnownNat n => KnownDuration (Hour n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Hour n) Source # durationVal :: DurationUnit (Hour n) Source # | |
type DurationUnit (Hour n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
Represents n
-many days.
Instances
KnownNat n => KnownDuration (Day n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Day n) Source # durationVal :: DurationUnit (Day n) Source # | |
type DurationUnit (Day n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
Represents n
-many weeks.
Instances
KnownNat n => KnownDuration (Week n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Week n) Source # durationVal :: DurationUnit (Week n) Source # | |
type DurationUnit (Week n :: Type) Source # | |
Defined in Data.Time.TypeLevel |
data Fortnight (n :: Nat) Source #
Represents n
-many fortnights.
Instances
KnownNat n => KnownDuration (Fortnight n :: Type) Source # | |
Defined in Data.Time.TypeLevel type DurationUnit (Fortnight n) Source # durationVal :: DurationUnit (Fortnight n) Source # | |
type DurationUnit (Fortnight n :: Type) Source # | |
Defined in Data.Time.TypeLevel |