| 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
- newtype Microseconds = Microseconds_ {}
- type Microsecond = Microseconds
- newtype Milliseconds = Milliseconds_ {}
- type Millisecond = Milliseconds
- newtype Seconds = Seconds_ {
- secondsInt :: Int
- type Second = Seconds
- newtype Minutes = Minutes_ {
- minutesInt :: Int
- type Minute = Minutes
- newtype Hours = Hours_ {}
- type Hour = Hours
- newtype Days = Days_ {}
- type Day = Days
- newtype Weeks = 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
newtype Microseconds Source #
Constructors
| Microseconds_ | |
Fields | |
type Microsecond = Microseconds Source #
newtype Milliseconds Source #
Constructors
| Milliseconds_ | |
Fields | |
type Millisecond = Milliseconds Source #
Constructors
| Seconds_ | |
Fields
| |
Constructors
| Minutes_ | |
Fields
| |
class ToDuration a where Source #
Minimal complete definition
Methods
toDuration :: a -> Duration Source #