packages feed

interval-algebra 1.0.0 → 1.0.1

raw patch · 4 files changed

+29/−2 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ IntervalAlgebra.Core: beginervalMoment :: IntervalSizeable a b => a -> Interval a
+ IntervalAlgebra.Core: endervalMoment :: IntervalSizeable a b => a -> Interval a

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for interval-algebra +## 1.0.1++* Adds `beginervalMoment` and `endervalMoment` functions to create intervals of moment duration from a begin or end.+ ## 1.0.0  * Moves the main `IntervalAlgebra` module to `IntervalAlgebra.Core` and `IntervalAlgebra` now reexports `IntervalAlgebra.Core`, `IntervalAlgebra.IntervalUtilites`, and `IntervalAlgebra.PairedInterval`.
interval-algebra.cabal view
@@ -1,6 +1,6 @@ cabal-version:  2.2 name:           interval-algebra-version:        1.0.0+version:        1.0.1 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/Core.hs view
@@ -158,6 +158,8 @@     , ComparativePredicateOf2     , beginervalFromEnd     , endervalFromBegin+    , beginervalMoment+    , endervalMoment     , diffFromBegin     , diffFromEnd     , momentize@@ -652,6 +654,24 @@     -> i a -- ^ the @i a@ from which to get the 'begin'      -> Interval a endervalFromBegin d i = enderval d (begin i)++-- | Safely creates a new @Interval@ with 'moment' length with 'begin' at @x@+--+-- >>> beginervalMoment (10 :: Int)+-- (10, 11)+-- +beginervalMoment :: (IntervalSizeable a b) => a -> Interval a+beginervalMoment x = beginerval (moment' i) x+    where i = Interval (x, x)++-- | Safely creates a new @Interval@ with 'moment' length with 'end' at @x@+--+-- >>> endervalMoment (10 :: Int)+-- (9, 10)+-- +endervalMoment :: (IntervalSizeable a b) => a -> Interval a+endervalMoment x = enderval (moment' i) x+    where i = Interval (x, x)  -- | Creates a new @Interval@ spanning the extent x and y. --
test/IntervalAlgebraSpec.hs view
@@ -86,7 +86,10 @@       it "equality works" $ enderval 1 (2::Int) == beginerval 1 1 `shouldBe` True       it "not equality works" $ enderval 5 (2::Int) /= beginerval 1 1 `shouldBe` True -      it "parsing fails on bad inputs" $+      it "beginervalMoment duration is moment" $ moment' (beginervalMoment (-13::Int)) `shouldBe` (1 :: Int)+      it "endervalMoment duration is moment" $ moment' (endervalMoment (26::Int)) `shouldBe` (1 :: Int)++      it "parsing fails on bad inputs" $           parseInterval 10 0 `shouldBe` Left (IA.ParseErrorInterval "0<10")       it "parsing works on good inputs" $          parseInterval 0 10 `shouldBe` Right (beginerval 10 (0::Int))