{-# options_ghc -fno-warn-orphans #-}
{-# options_haddock prune, hide #-}
module Polysemy.Time.Orphans where
import Data.Time (NominalDiffTime, UTCTime, addUTCTime, diffUTCTime)
import Torsor (Additive (..), Torsor (..))
instance Additive NominalDiffTime where
zero :: NominalDiffTime
zero =
NominalDiffTime
0
invert :: NominalDiffTime -> NominalDiffTime
invert =
forall a. Enum a => Int -> a
toEnum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => a -> a
negate forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> Int
fromEnum
plus :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime
plus =
forall a. Num a => a -> a -> a
(+)
minus :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime
minus =
(-)
instance Torsor UTCTime NominalDiffTime where
add :: NominalDiffTime -> UTCTime -> UTCTime
add NominalDiffTime
v UTCTime
p =
NominalDiffTime -> UTCTime -> UTCTime
addUTCTime NominalDiffTime
v UTCTime
p
difference :: UTCTime -> UTCTime -> NominalDiffTime
difference =
UTCTime -> UTCTime -> NominalDiffTime
diffUTCTime