| Copyright | (c) Ryota Kameoka 2018 |
|---|---|
| License | BSD-3 |
| Maintainer | kameoka.ryota@gmail.com |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.Time.Clock.Duration.Types
Contents
Description
This module exports internally used type classes and data types. You can extend this package's functionality by utilizing them.
Synopsis
- class AbsoluteDuration a where
- toAbsoluteDuration :: Time -> a
- class RelativeDuration a where
- toRelativeDuration :: HasResolution r => Proxy r -> Time -> a
- data Time
Type classes
class AbsoluteDuration a where Source #
The AbsoluteDuration class provides how to convert the given Time into a specific unit of time.
An instance should represent a quantity with
the dimension of T.
42 seconds in DiffTime (seconds):
>>>[t| 42s |] :: DiffTime42s
42 seconds in CUSeconds (microseconds):
>>>[t| 42s |] :: CUSeconds42000000
Methods
toAbsoluteDuration :: Time -> a Source #
Instances
| AbsoluteDuration CUSeconds Source # | Caution: the fractional part will be rounded. |
Defined in Data.Time.Clock.Duration.Types Methods toAbsoluteDuration :: Time -> CUSeconds Source # | |
| AbsoluteDuration CSUSeconds Source # | Caution: the fractional part will be rounded. |
Defined in Data.Time.Clock.Duration.Types Methods toAbsoluteDuration :: Time -> CSUSeconds Source # | |
| AbsoluteDuration NominalDiffTime Source # | |
Defined in Data.Time.Clock.Duration.Types Methods | |
| AbsoluteDuration DiffTime Source # | |
Defined in Data.Time.Clock.Duration.Types Methods toAbsoluteDuration :: Time -> DiffTime Source # | |
class RelativeDuration a where Source #
The RelativeDuration class represents how to calculate how long the given Time is when
measured in a specific unit of time.
An instance should represent a quantity with
the dimension of 1.
42 minutes in seconds:
>>>[s| 42m |] :: Int2520
3 seconds in microseconds:
>>>[µs| 3s |] :: Int3000000
Methods
toRelativeDuration :: HasResolution r => Proxy r -> Time -> a Source #
Instances
Data types
The parsing result of a string inside a quasiquoter.
Constructors
| Picosec Rational | |
| Nanosec Rational | |
| Microsec Rational | |
| Millisec Rational | Denoted by |
| Second Rational | Denoted by |
| Minute Rational | Denoted by |
| Hour Rational | Denoted by |
| Day Rational | Denoted by |
| Week Rational | Denoted by |
| Year Rational | Denoted by |