interval-algebra 0.10.1 → 0.10.2
raw patch · 5 files changed
+26/−2 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ IntervalAlgebra: momentize :: (IntervalSizeable a b, Intervallic i a) => i a -> i a
Files
- ChangeLog.md +4/−0
- interval-algebra.cabal +1/−1
- src/IntervalAlgebra.hs +11/−0
- src/IntervalAlgebra/Arbitrary.hs +1/−0
- test/IntervalAlgebraSpec.hs +9/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for interval-algebra +## 0.10.2++* Adds the `momentize` function for changing the duration of some interval value to a moment.+ ## 0.10.1 * Replaces unnecessary `IntervalCombinable i0 a` constraint in `gapsWithin` with `Intervallic i0 a`.
interval-algebra.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: interval-algebra-version: 0.10.1+version: 0.10.2 synopsis: An implementation of Allen's interval algebra for temporal logic description: Please see the README on GitHub at <https://github.com/novisci/interval-algebra> category: Algebra,Time
src/IntervalAlgebra.hs view
@@ -159,6 +159,7 @@ , endervalFromBegin , diffFromBegin , diffFromEnd+ , momentize -- ** Algebraic operations , intervalRelations@@ -673,6 +674,16 @@ , Intervallic i0 a ) => i0 a -> i1 a -> i1 b diffFromEnd i = fmap (`diff` end i)++-- | Changes the duration of an 'Intervallic' value to a moment starting at the +-- 'begin' of the interval.+-- +-- >>> momentize (Interval (6, 10))+-- (6, 7)+--+momentize :: ( IntervalSizeable a b, Intervallic i a ) =>+ i a -> i a+momentize i = setInterval i (beginerval (moment' i) (begin i)) {- | The @'IntervalCombinable'@ typeclass provides methods for (possibly) combining
src/IntervalAlgebra/Arbitrary.hs view
@@ -9,6 +9,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE Safe #-}+{-# LANGUAGE TypeApplications #-} module IntervalAlgebra.Arbitrary() where
test/IntervalAlgebraSpec.hs view
@@ -68,7 +68,8 @@ , Interval , IntervalRelation (..) , intervalRelations- , notDisjoint )+ , notDisjoint+ , momentize ) mkIntrvl :: Int -> Int -> Interval Int mkIntrvl = beginerval@@ -656,6 +657,13 @@ (beginerval 2 (fromGregorian 2001 1 1)) (beginerval 2 (fromGregorian 2001 1 10)) `shouldBe` beginerval 2 7 -- (7, 9)++ it "momentize works" $+ momentize+ (beginerval 2 (fromGregorian 2001 1 1))+ `shouldBe`+ beginerval 1 (fromGregorian 2001 1 1)+ describe "Intervallic tests" $ modifyMaxSuccess (*10000) $