Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype FromSeconds a = FromSeconds a
- class TimeUnit u where
- nanos :: NanoSeconds
- toNanos :: u -> NanoSeconds
- fromNanos :: NanoSeconds -> u
- newtype Years = Years {}
- newtype Months = Months {}
- newtype Weeks = Weeks {}
- newtype Days = Days {}
- newtype Hours = Hours {}
- newtype Minutes = Minutes {}
- newtype Seconds = Seconds {}
- newtype MilliSeconds = MilliSeconds {}
- newtype MicroSeconds = MicroSeconds {}
- newtype NanoSeconds = NanoSeconds {}
- convert :: TimeUnit a => TimeUnit b => a -> b
- type AddTimeUnit t u1 u2 = (TimeUnit u1, TimeUnit u2, Torsor t u2)
- addTimeUnit :: forall t u1 u2. AddTimeUnit t u1 u2 => u1 -> t -> t
Documentation
newtype FromSeconds a Source #
Instances
class TimeUnit u where Source #
Types that represent an amount of time that can be converted to each other.
The methods are internal, the API function is convert
.
nanos :: NanoSeconds Source #
toNanos :: u -> NanoSeconds Source #
default toNanos :: Integral u => u -> NanoSeconds Source #
fromNanos :: NanoSeconds -> u Source #
default fromNanos :: Integral u => NanoSeconds -> u Source #
Instances
Data types used to specify time spans, e.g. for sleeping.
Instances
Enum Years Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Eq Years Source # | |
Integral Years Source # | |
Num Years Source # | |
Ord Years Source # | |
Real Years Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Years -> Rational # | |
Show Years Source # | |
Generic Years Source # | |
FromJSON Years Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Years # parseJSONList :: Value -> Parser [Years] | |
ToJSON Years Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Additive Years Source # | |
type Rep Years Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
Instances
Enum Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Eq Months Source # | |
Integral Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Num Months Source # | |
Ord Months Source # | |
Real Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Months -> Rational # | |
Show Months Source # | |
Generic Months Source # | |
FromJSON Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Months # parseJSONList :: Value -> Parser [Months] | |
ToJSON Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit toEncoding :: Months -> Encoding toJSONList :: [Months] -> Value toEncodingList :: [Months] -> Encoding | |
Additive Months Source # | |
type Rep Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
Instances
Enum Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Eq Weeks Source # | |
Integral Weeks Source # | |
Num Weeks Source # | |
Ord Weeks Source # | |
Real Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Weeks -> Rational # | |
Show Weeks Source # | |
Generic Weeks Source # | |
FromJSON Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Weeks # parseJSONList :: Value -> Parser [Weeks] | |
ToJSON Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Additive Weeks Source # | |
TimeUnit Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit nanos :: NanoSeconds Source # toNanos :: Weeks -> NanoSeconds Source # fromNanos :: NanoSeconds -> Weeks Source # | |
type Rep Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
Instances
Enum Days Source # | |
Eq Days Source # | |
Integral Days Source # | |
Num Days Source # | |
Ord Days Source # | |
Real Days Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Days -> Rational # | |
Show Days Source # | |
Generic Days Source # | |
FromJSON Days Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Days # parseJSONList :: Value -> Parser [Days] | |
ToJSON Days Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Additive Days Source # | |
TimeUnit Days Source # | |
Defined in Polysemy.Time.Data.TimeUnit nanos :: NanoSeconds Source # toNanos :: Days -> NanoSeconds Source # fromNanos :: NanoSeconds -> Days Source # | |
type Rep Days Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
Instances
Enum Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Eq Hours Source # | |
Integral Hours Source # | |
Num Hours Source # | |
Ord Hours Source # | |
Real Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Hours -> Rational # | |
Show Hours Source # | |
Generic Hours Source # | |
FromJSON Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Hours # parseJSONList :: Value -> Parser [Hours] | |
ToJSON Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Additive Hours Source # | |
TimeUnit Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit nanos :: NanoSeconds Source # toNanos :: Hours -> NanoSeconds Source # fromNanos :: NanoSeconds -> Hours Source # | |
type Rep Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
Instances
Enum Minutes Source # | |
Eq Minutes Source # | |
Integral Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Num Minutes Source # | |
Ord Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Real Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Minutes -> Rational # | |
Show Minutes Source # | |
Generic Minutes Source # | |
FromJSON Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Minutes # parseJSONList :: Value -> Parser [Minutes] | |
ToJSON Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit toEncoding :: Minutes -> Encoding toJSONList :: [Minutes] -> Value toEncodingList :: [Minutes] -> Encoding | |
Additive Minutes Source # | |
TimeUnit Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit nanos :: NanoSeconds Source # toNanos :: Minutes -> NanoSeconds Source # fromNanos :: NanoSeconds -> Minutes Source # | |
type Rep Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
Instances
Enum Seconds Source # | |
Eq Seconds Source # | |
Integral Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Num Seconds Source # | |
Ord Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
Real Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit toRational :: Seconds -> Rational # | |
Show Seconds Source # | |
Generic Seconds Source # | |
FromJSON Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit parseJSON :: Value -> Parser Seconds # parseJSONList :: Value -> Parser [Seconds] | |
ToJSON Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit toEncoding :: Seconds -> Encoding toJSONList :: [Seconds] -> Value toEncodingList :: [Seconds] -> Encoding | |
Additive Seconds Source # | |
TimeUnit Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit nanos :: NanoSeconds Source # toNanos :: Seconds -> NanoSeconds Source # fromNanos :: NanoSeconds -> Seconds Source # | |
type Rep Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit |
newtype MilliSeconds Source #
Instances
newtype MicroSeconds Source #
Instances
newtype NanoSeconds Source #
Instances
convert :: TimeUnit a => TimeUnit b => a -> b Source #
Convert between different time spans.
>>>
convert (picosecondsToDiffTime 50000000) :: MicroSeconds
MicroSeconds {unMicroSeconds = 50}
>>>
convert (MilliSeconds 5) :: MicroSeconds
MicroSeconds 5000
type AddTimeUnit t u1 u2 = (TimeUnit u1, TimeUnit u2, Torsor t u2) Source #
addTimeUnit :: forall t u1 u2. AddTimeUnit t u1 u2 => u1 -> t -> t Source #