packages feed

interval-algebra 0.3.0 → 0.3.1

raw patch · 3 files changed

+39/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ IntervalAlgebra: diff :: IntervalSizeable a b => a -> a -> b
+ IntervalAlgebra: filterDisjoint :: IntervalFilterable f a => Interval a -> f (Interval a) -> f (Interval a)
+ IntervalAlgebra: filterIn' :: IntervalFilterable f a => Interval a -> f (Interval a) -> f (Interval a)
+ IntervalAlgebra: filterNotDisjoint :: IntervalFilterable f a => Interval a -> f (Interval a) -> f (Interval a)
+ IntervalAlgebra: notDisjoint :: IntervalAlgebraic a => ComparativePredicateOf (Interval a)

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for interval-algebra +## 0.3.1++* Adds the `diff` function to the `IntervalSizeable` to make comparisons of endpoints easier.+* Adds the `notDisjoint` relation to determine if two intervals share any support.+* Adds `filterDisjoint`, `filterNotDisjoint`, and `filterIn'` to the `IntervalFilterable` class.+ ## 0.3.0  * Adds `beginerval` and `enderval` function to `IntervalSizeable` class for safely creating `Interval`s given a begin (or end) and a duration.
interval-algebra.cabal view
@@ -1,6 +1,6 @@ cabal-version:  2.2 name:           interval-algebra-version:        0.3.0+version:        0.3.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.hs view
@@ -280,6 +280,14 @@     disjoint               :: ComparativePredicateOf (Interval a)     disjoint = composeRelations [before, after, meets, metBy] +    -- | Are x and y not disjoint; i.e. do they share any support?+    notDisjoint            :: ComparativePredicateOf (Interval a)+    notDisjoint = composeRelations [ equals+                                   , starts, startedBy+                                   , finishes, finishedBy+                                   , overlaps, overlappedBy+                                   , during, contains]+     -- | Is x contained in y in any sense ('during', 'starts', 'finishes'      -- or 'equals'?     in'                    :: ComparativePredicateOf (Interval a)@@ -301,11 +309,15 @@      -- | Determine the duration of an 'Interval a'.     duration :: Interval a -> b+    duration x = diff (end x) (begin x)      -- | Shifts an @a@. Most often, the @b@ will be the same type as @a@.      --   But for example, if @a@ is 'Day' then @b@ could be 'Int'.     add :: b -> a -> a +    -- | Takes the difference between two @a@ to return a @b@.+    diff :: a -> a -> b+     -- | Resize an 'Interval a' to by expanding to "left" by @max l moment@      --   and to the "right" by @min r moment@.      expand :: b -> b -> Interval a -> Interval a@@ -416,11 +428,26 @@     filterDuring :: Interval a -> f (Interval a) -> f (Interval a)     filterDuring = filterMaker during -    -- | Filter a 'Witherable.Filterable' of Interval as to those that 'contains' the @Interval a@-    --   in the first argument.+    -- | Filter a 'Witherable.Filterable' of Interval as to those that 'contains'+    --   the @Interval a@ in the first argument.     filterContains :: Interval a -> f (Interval a) -> f (Interval a)     filterContains = filterMaker contains +    -- | Filter a 'Witherable.Filterable' of Interval as to those that are 'disjoint'+    --   from the @Interval a@ in the first argument.+    filterDisjoint :: Interval a -> f (Interval a) -> f (Interval a)+    filterDisjoint = filterMaker disjoint ++    -- | Filter a 'Witherable.Filterable' of Interval as to those that are 'notDisjoint'+    --   from the @Interval a@ in the first argument.+    filterNotDisjoint :: Interval a -> f (Interval a) -> f (Interval a)+    filterNotDisjoint = filterMaker disjoint +++    -- | Filter a 'Witherable.Filterable' of Interval as to those that are 'in''+    --   the @Interval a@ in the first argument.+    filterIn' :: Interval a -> f (Interval a) -> f (Interval a)+    filterIn' = filterMaker disjoint  {- Instances -}@@ -446,7 +473,7 @@ instance Moment Int Int instance IntervalSizeable Int Int where     add = (+)-    duration x = end x - begin x+    diff = (-) instance IntervalFilterable [] Int  instance Intervallic Integer@@ -455,7 +482,7 @@ instance Moment Integer Integer  instance IntervalSizeable Integer Integer where     add = (+)-    duration x = end x - begin x+    diff = (-) instance IntervalFilterable [] Integer  instance Intervallic DT.Day@@ -464,5 +491,5 @@ instance Moment DT.Day Integer instance IntervalSizeable DT.Day Integer where     add = addDays-    duration x = diffDays (end x) (begin x)+    diff = diffDays instance IntervalFilterable [] DT.Day