| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Duration
Contents
Description
- newtype Duration = Duration {
- durationUs :: Int
- data DurationUnit
- = Microsecond
- | Millisecond
- | Second
- | Minute
- | Hour
- | Day
- | Week
- (#) :: Int -> DurationUnit -> Duration
- pattern Microseconds :: DurationUnit
- pattern Milliseconds :: DurationUnit
- pattern Seconds :: DurationUnit
- pattern Minutes :: DurationUnit
- pattern Hours :: DurationUnit
- pattern Days :: DurationUnit
- pattern Weeks :: DurationUnit
- microseconds :: Int -> Duration
- milliseconds :: Int -> Duration
- seconds :: Int -> Duration
- minutes :: Int -> Duration
- hours :: Int -> Duration
- days :: Int -> Duration
- weeks :: Int -> Duration
- data Microseconds
- type Microsecond = Microseconds
- data Milliseconds
- type Millisecond = Milliseconds
- data Seconds
- type Second = Seconds
- data Minutes
- type Minute = Minutes
- data Hours
- type Hour = Hours
- data Days
- type Day = Days
- data Weeks
- type Week = Weeks
- class ToDuration a where
Duration type
A microsecond precision duration, represented as an integer.
Constructors
| Duration | |
Fields
| |
data DurationUnit Source #
Constructors
| Microsecond | Max bound: 9223372036854775807 |
| Millisecond | Max bound: 9223372036854775 |
| Second | Max bound: 9223372036854 |
| Minute | Max bound: 153722867280 |
| Hour | Max bound: 2562047788 |
| Day | Max bound: 106751991 |
| Week | Max bound: 15250284 |
Instances
(#) :: Int -> DurationUnit -> Duration Source #
Make a duration from a value + unit. Note that this function does not check
overflows. See DurationUnit for max bounds for units.
pattern Microseconds :: DurationUnit Source #
pattern Milliseconds :: DurationUnit Source #
pattern Seconds :: DurationUnit Source #
pattern Minutes :: DurationUnit Source #
pattern Hours :: DurationUnit Source #
pattern Days :: DurationUnit Source #
pattern Weeks :: DurationUnit Source #
Non-operators for building durations
microseconds :: Int -> Duration Source #
milliseconds :: Int -> Duration Source #
Num types for building durations from integer literals
data Microseconds Source #
type Microsecond = Microseconds Source #
data Milliseconds Source #
type Millisecond = Milliseconds Source #
class ToDuration a where Source #
Minimal complete definition
Methods
toDuration :: a -> Duration Source #