interval-algebra 1.0.1 → 1.1.0
raw patch · 4 files changed
+10/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- interval-algebra.cabal +1/−1
- src/IntervalAlgebra/Core.hs +2/−2
- test/IntervalAlgebraSpec.hs +3/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for interval-algebra +## 1.1.0++* Fixes bug in `parseInterval`. For example, `parseInterval 0 0` parsed to a `Right (Interval (0, 0))`. Oops, the inequality of the should have been `y <= x` not `y < x`. This was fixed and a test added catch this error.+ ## 1.0.1 * Adds `beginervalMoment` and `endervalMoment` functions to create intervals of moment duration from a begin or end.
interval-algebra.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: interval-algebra-version: 1.0.1+version: 1.1.0 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
@@ -237,8 +237,8 @@ -- parseInterval :: (Show a, Ord a) => a -> a -> Either ParseErrorInterval (Interval a) parseInterval x y- | y < x = Left $ ParseErrorInterval $ show y ++ "<" ++ show x- | otherwise = Right $ Interval (x, y)+ | x < y = Right $ Interval (x, y) + | otherwise = Left $ ParseErrorInterval $ show y ++ "<=" ++ show x intervalBegin :: (Ord a) => Interval a -> a intervalBegin (Interval x) = fst x
test/IntervalAlgebraSpec.hs view
@@ -90,7 +90,9 @@ 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")+ parseInterval 10 0 `shouldBe` Left (IA.ParseErrorInterval "0<=10")+ it "parsing fails on bad inputs" $ + parseInterval 0 0 `shouldBe` Left (IA.ParseErrorInterval "0<=0") it "parsing works on good inputs" $ parseInterval 0 10 `shouldBe` Right (beginerval 10 (0::Int))