-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A tiny compile-time time utility library inspired by zeit/ms -- -- A tiny compile-time time utility library inspired by zeit/ms @package duration @version 0.1.0.0 -- | This module exports internally used type classes and data types. You -- can extend this package's functionality by utilizing them. module Data.Time.Clock.Duration.Types -- | 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 |] :: DiffTime -- 42s ---- -- 42 seconds in CUSeconds (microseconds): -- --
-- >>> [t| 42s |] :: CUSeconds -- 42000000 --class AbsoluteDuration a toAbsoluteDuration :: AbsoluteDuration a => Time -> a -- | 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 |] :: Int -- 2520 ---- -- 3 seconds in microseconds: -- --
-- >>> [µs| 3s |] :: Int -- 3000000 --class RelativeDuration a toRelativeDuration :: (RelativeDuration a, HasResolution r) => Proxy r -> Time -> a -- | The parsing result of a string inside a quasiquoter. data Time Picosec :: Rational -> Time Nanosec :: Rational -> Time Microsec :: Rational -> Time -- | Denoted by ms, msec, msecs, -- millisecond, or milliseconds Millisec :: Rational -> Time -- | Denoted by s, sec, secs, second, -- or seconds Second :: Rational -> Time -- | Denoted by m, min, mins, minute, -- or minutes Minute :: Rational -> Time -- | Denoted by h, hr, hrs, hour, or -- hours Hour :: Rational -> Time -- | Denoted by d, day, or days Day :: Rational -> Time -- | Denoted by w, week, or weeks Week :: Rational -> Time -- | Denoted by y, yr, yrs, year, or -- years Year :: Rational -> Time instance Language.Haskell.TH.Syntax.Lift Data.Time.Clock.Duration.Types.Time instance Data.Time.Clock.Duration.Types.AbsoluteDuration Data.Time.Clock.Internal.DiffTime.DiffTime instance Data.Time.Clock.Duration.Types.AbsoluteDuration Data.Time.Clock.Internal.NominalDiffTime.NominalDiffTime instance Data.Time.Clock.Duration.Types.AbsoluteDuration Foreign.C.Types.CUSeconds instance Data.Time.Clock.Duration.Types.AbsoluteDuration Foreign.C.Types.CSUSeconds instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Types.Int instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Int.Int8 instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Int.Int16 instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Int.Int32 instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Int.Int64 instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Integer.Type.Integer instance Data.Fixed.HasResolution a => Data.Time.Clock.Duration.Types.RelativeDuration (Data.Fixed.Fixed a) instance GHC.Real.Integral a => Data.Time.Clock.Duration.Types.RelativeDuration (GHC.Real.Ratio a) instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Types.Float instance Data.Time.Clock.Duration.Types.RelativeDuration GHC.Types.Double -- | All quasiquoters defined in this module are re-exported from -- Data.Time.Clock.Duration. module Data.Time.Clock.Duration.QQ -- | A quasiquoter to denote a duration. -- --
-- >>> [t| 42s |] :: DiffTime -- 42s ---- --
-- >>> [t| 1day |] :: DiffTime -- 86400s ---- -- The expression has the type of AbsoluteDuration a => -- a. -- --
-- >>> [t| 1ms |] :: NominalDiffTime -- 0.001s ---- --
-- >>> [t| 1ms |] :: CSUSeconds -- 1000 ---- --
-- >>> [t| 1ms |] :: CUSeconds -- 1000 ---- -- You can use various expressions inside the quasiquoter. (See -- Time for details.) -- --
-- >>> [t| 1ms |] :: DiffTime -- 0.001s ---- --
-- >>> [t| 1s |] :: DiffTime -- 1s ---- --
-- >>> [t| 1m |] :: DiffTime -- 60s ---- --
-- >>> [t| 1h |] :: DiffTime -- 3600s ---- --
-- >>> [t| 1d |] :: DiffTime -- 86400s ---- --
-- >>> [t| 1w |] :: DiffTime -- 604800s ---- --
-- >>> [t| 1y |] :: DiffTime -- 31536000s --t :: QuasiQuoter -- | A quasiquoter to denote a duration in seconds. Its behavior varies -- according to what you give to the quasiquoter. -- -- When a unitless number (like 42) is supplied to s, the -- expression has the type of AbsoluteDuration a => a. -- --
-- >>> [s| 42 |] :: DiffTime -- 42s ---- -- When you pass a string with a number and a valid unit (like -- 42s), the expression has the type of -- RelativeDuration a => a, and it represents how long -- the given duration is in seconds. -- -- For example, how long is 42 minutes in seconds? -- --
-- >>> [s| 42m |] :: Int -- 2520 ---- -- Note that short durations can be rounded to zero when treated as an -- integer. -- --
-- >>> [s| 1ms |] :: Int -- 0 -- -- >>> [s| 1ms |] :: Integer -- 0 ---- -- To avoid this, use Ratio or Float instead. -- --
-- >>> [s| 1ms |] :: Rational -- 1 % 1000 -- -- >>> [s| 1ms |] :: Float -- 1.0e-3 --s :: QuasiQuoter -- | A quasiquoter to denote a duration in milliseconds. See s for -- detailed usage. -- --
-- >>> [ms| 42 |] :: DiffTime -- 0.042s ---- --
-- >>> [ms| 42s |] :: Integer -- 42000 --ms :: QuasiQuoter -- | A quasiquoter to denote a duration in microseconds. See s for -- detailed usage. -- --
-- >>> [µs| 42 |] :: DiffTime -- 0.000042s ---- --
-- >>> [µs| 42s |] :: Integer -- 42000000 --µs :: QuasiQuoter -- | A quasiquoter to denote a duration in nanoseconds. See s for -- detailed usage. -- --
-- >>> [ns| 42 |] :: DiffTime -- 0.000000042s ---- --
-- >>> [ns| 42s |] :: Integer -- 42000000000 --ns :: QuasiQuoter -- | A quasiquoter to denote a duration in picoseconds. See s for -- detailed usage. -- --
-- >>> [ps| 42 |] :: DiffTime -- 0.000000000042s ---- --
-- >>> [ps| 42s |] :: Integer -- 42000000000000 --ps :: QuasiQuoter -- | A tiny compile-time time utility library, inspired by zeit/ms. module Data.Time.Clock.Duration -- | A quasiquoter to denote a duration. -- --
-- >>> [t| 42s |] :: DiffTime -- 42s ---- --
-- >>> [t| 1day |] :: DiffTime -- 86400s ---- -- The expression has the type of AbsoluteDuration a => -- a. -- --
-- >>> [t| 1ms |] :: NominalDiffTime -- 0.001s ---- --
-- >>> [t| 1ms |] :: CSUSeconds -- 1000 ---- --
-- >>> [t| 1ms |] :: CUSeconds -- 1000 ---- -- You can use various expressions inside the quasiquoter. (See -- Time for details.) -- --
-- >>> [t| 1ms |] :: DiffTime -- 0.001s ---- --
-- >>> [t| 1s |] :: DiffTime -- 1s ---- --
-- >>> [t| 1m |] :: DiffTime -- 60s ---- --
-- >>> [t| 1h |] :: DiffTime -- 3600s ---- --
-- >>> [t| 1d |] :: DiffTime -- 86400s ---- --
-- >>> [t| 1w |] :: DiffTime -- 604800s ---- --
-- >>> [t| 1y |] :: DiffTime -- 31536000s --t :: QuasiQuoter -- | A quasiquoter to denote a duration in seconds. Its behavior varies -- according to what you give to the quasiquoter. -- -- When a unitless number (like 42) is supplied to s, the -- expression has the type of AbsoluteDuration a => a. -- --
-- >>> [s| 42 |] :: DiffTime -- 42s ---- -- When you pass a string with a number and a valid unit (like -- 42s), the expression has the type of -- RelativeDuration a => a, and it represents how long -- the given duration is in seconds. -- -- For example, how long is 42 minutes in seconds? -- --
-- >>> [s| 42m |] :: Int -- 2520 ---- -- Note that short durations can be rounded to zero when treated as an -- integer. -- --
-- >>> [s| 1ms |] :: Int -- 0 -- -- >>> [s| 1ms |] :: Integer -- 0 ---- -- To avoid this, use Ratio or Float instead. -- --
-- >>> [s| 1ms |] :: Rational -- 1 % 1000 -- -- >>> [s| 1ms |] :: Float -- 1.0e-3 --s :: QuasiQuoter -- | A quasiquoter to denote a duration in milliseconds. See s for -- detailed usage. -- --
-- >>> [ms| 42 |] :: DiffTime -- 0.042s ---- --
-- >>> [ms| 42s |] :: Integer -- 42000 --ms :: QuasiQuoter -- | A quasiquoter to denote a duration in microseconds. See s for -- detailed usage. -- --
-- >>> [µs| 42 |] :: DiffTime -- 0.000042s ---- --
-- >>> [µs| 42s |] :: Integer -- 42000000 --µs :: QuasiQuoter -- | A quasiquoter to denote a duration in nanoseconds. See s for -- detailed usage. -- --
-- >>> [ns| 42 |] :: DiffTime -- 0.000000042s ---- --
-- >>> [ns| 42s |] :: Integer -- 42000000000 --ns :: QuasiQuoter -- | A quasiquoter to denote a duration in picoseconds. See s for -- detailed usage. -- --
-- >>> [ps| 42 |] :: DiffTime -- 0.000000000042s ---- --
-- >>> [ps| 42s |] :: Integer -- 42000000000000 --ps :: QuasiQuoter