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 # | |
ToJSON Years Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Years Source # | |
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 # | |
ToJSON Months Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Months Source # | |
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 # | |
ToJSON Weeks Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Weeks Source # | |
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 # | |
ToJSON Days Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Days Source # | |
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 # | |
ToJSON Hours Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Hours Source # | |
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 # | |
ToJSON Minutes Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Minutes Source # | |
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 # | |
ToJSON Seconds Source # | |
Defined in Polysemy.Time.Data.TimeUnit | |
FromJSON Seconds Source # | |
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
addTimeUnit :: forall t u1 u2. AddTimeUnit t u1 u2 => u1 -> t -> t Source #