time-domain 0.1.0.5 → 1.6
raw patch · 2 files changed
+54/−58 lines, 2 filesdep ~basedep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, time
API changes (from Hackage documentation)
+ Data.TimeDomain: type family Diff time
- Data.TimeDomain: class TimeDifference (Diff time) => TimeDomain time where {
+ Data.TimeDomain: class TimeDifference Diff time => TimeDomain time where {
- Data.TimeDomain: data () => UTCTime
+ Data.TimeDomain: data UTCTime
Files
- src/Data/TimeDomain.hs +22/−25
- time-domain.cabal +32/−33
src/Data/TimeDomain.hs view
@@ -1,23 +1,22 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE TypeFamilies #-}+ {- | This module defines the 'TimeDomain' class. Its instances model time, simulated and realtime. Several instances such as 'UTCTime', 'Double' and 'Integer' are supplied here. -}--{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE TypeFamilies #-}--module Data.TimeDomain- ( module Data.TimeDomain- , UTCTime- )- where+module Data.TimeDomain (+ module Data.TimeDomain,+ UTCTime,+)+where -- time-import Data.Time.Clock (UTCTime, diffUTCTime, addUTCTime)+import Data.Time.Clock (UTCTime, addUTCTime, diffUTCTime) {- | A time domain is an affine space representing a notion of time,@@ -29,20 +28,18 @@ * @(t `addTime` dt) `diffTime` t = dt@ * @(t `addTime` dt1) `addTime` dt2 = t `addTime` (dt1 `add` dt2)@ -}-class TimeDifference (Diff time) => TimeDomain time where+class (TimeDifference (Diff time)) => TimeDomain time where -- | The type of differences or durations between two timestamps type Diff time - {- | Compute the difference between two timestamps.-- Mnemonic: 'diffTime' behaves like the '(-)' operator:-- @'diffTime' earlier later = later `'diffTime'` earlier@ is the duration it takes from @earlier@ to @later@.- -}+ -- | Compute the difference between two timestamps.+ --+ -- Mnemonic: 'diffTime' behaves like the '(-)' operator:+ --+ -- @'diffTime' earlier later = later `'diffTime'` earlier@ is the duration it takes from @earlier@ to @later@. diffTime :: time -> time -> Diff time - {- | Add a time difference to a timestamp.- -}+ -- | Add a time difference to a timestamp. addTime :: time -> Diff time -> time {- | A type of durations, or differences betweens time stamps.@@ -103,14 +100,14 @@ addTime _ _ = () -- | Any 'Num' can be wrapped to form a 'TimeDomain'.-newtype NumTimeDomain a = NumTimeDomain { fromNumTimeDomain :: a }- deriving Num+newtype NumTimeDomain a = NumTimeDomain {fromNumTimeDomain :: a}+ deriving (Num) -instance Num a => TimeDifference (NumTimeDomain a) where+instance (Num a) => TimeDifference (NumTimeDomain a) where difference = (-) add = (+) -instance Num a => TimeDomain (NumTimeDomain a) where+instance (Num a) => TimeDomain (NumTimeDomain a) where type Diff (NumTimeDomain a) = NumTimeDomain a diffTime = (-) addTime = (+)
time-domain.cabal view
@@ -1,44 +1,43 @@-cabal-version: 2.4-name: time-domain-version: 0.1.0.5-license: MIT-license-file: LICENSE-author: Manuel Bärenz-maintainer: programming@manuelbaerenz.de-synopsis: A library for time domains and durations-description: This library mainly provides a type class, 'TimeDomain',- which can be used to specify times and durations.- There are some instances for standard types from @base@ and @time@.-extra-source-files: CHANGELOG.md-category: FRP-homepage: https://github.com/turion/time-domain/+cabal-version: 2.4+name: time-domain+version: 1.6+license: MIT+license-file: LICENSE+author: Manuel Bärenz+maintainer: programming@manuelbaerenz.de+synopsis: A library for time domains and durations+description:+ This library mainly provides a type class, 'TimeDomain',+ which can be used to specify times and durations.+ There are some instances for standard types from @base@ and @time@. +extra-source-files: CHANGELOG.md+category: FRP tested-with:- ghc ==8.8.4- ghc ==8.10.7- ghc ==9.0.2- ghc ==9.2.8- ghc ==9.4.8- ghc ==9.6.3- ghc ==9.8.1- ghc ==9.10.1+ ghc ==8.8+ ghc ==8.10+ ghc ==9.0+ ghc ==9.2+ ghc ==9.4+ ghc ==9.6+ ghc ==9.8+ ghc ==9.10+ ghc ==9.12 source-repository head- type: git- location: https://github.com/turion/time-domain.git-source-repository this- type: git- location: https://github.com/turion/time-domain.git- tag: v0.1.0.4+ type: git+ location: https://github.com/turion/rhine library- exposed-modules: Data.TimeDomain+ exposed-modules: Data.TimeDomain build-depends:- base >= 4.13.0 && < 4.21- , time >= 1.12 && < 1.15- hs-source-dirs: src+ base >=4.13.0 && <4.22,+ time >=1.11 && <1.16,++ hs-source-dirs: src default-language: Haskell2010- ghc-options: -W+ ghc-options: -W+ if flag(dev) ghc-options: -Werror