interval-algebra 0.7.0 → 0.7.1
raw patch · 6 files changed
+27/−14 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ IntervalAlgebra.PairedInterval: data Empty
Files
- ChangeLog.md +4/−0
- interval-algebra.cabal +1/−1
- src/IntervalAlgebra.hs +2/−1
- src/IntervalAlgebra/Arbitrary.hs +12/−8
- src/IntervalAlgebra/IntervalUtilities.hs +4/−2
- src/IntervalAlgebra/PairedInterval.hs +4/−2
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for interval-algebra +## 0.7.1++* Adds `Safe` language extension to all library modules.+ ## 0.7.0 * Adds a `Bifunctor` instance for `PairedInterval`s.
interval-algebra.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: interval-algebra-version: 0.7.0+version: 0.7.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
@@ -40,6 +40,7 @@ This module is under development and the API may change in the future. -} +{-# LANGUAGE Safe #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}@@ -85,7 +86,7 @@ import Data.Semigroup ( Semigroup((<>)) ) import Data.Set(Set, fromList, difference, intersection, union, map, toList) import Data.Ord( Ord(..), Ordering(..))-import GHC.Base (Applicative(pure))+import Control.Applicative (Applicative(pure)) {- | An @'Interval' a@ is a pair of @a@s \( (x, y) \text{ where } x < y\). The @'parseInterval'@ function that returns @'Left'@ error if \(y < x\) and
src/IntervalAlgebra/Arbitrary.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE FlexibleInstances #-} {-| Module : Generate arbitrary Intervals Description : Functions for generating arbitrary intervals@@ -8,14 +6,20 @@ Maintainer : bsaul@novisci.com Stability : experimental -}+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE Safe #-}+ module IntervalAlgebra.Arbitrary() where -import Test.QuickCheck ( Arbitrary(arbitrary, shrink) )-import GHC.Base(Int, (.), liftM2 )-import Control.Applicative((<$>))-import GHC.Num ( Num((+), negate) )-import IntervalAlgebra (Interval, beginerval)-import Data.Time as DT ( Day(ModifiedJulianDay), toModifiedJulianDay)+import Test.QuickCheck ( Arbitrary(arbitrary, shrink) )+import GHC.Int ( Int )+import GHC.Num ( Num((+), negate) )+import Control.Applicative ( (<$>) )+import Control.Monad ( liftM2 )+import IntervalAlgebra (Interval, beginerval)+import Data.Function ( (.) )+import Data.Time as DT ( Day(ModifiedJulianDay), toModifiedJulianDay) instance Arbitrary (Interval Int) where arbitrary = liftM2 beginerval arbitrary arbitrary
src/IntervalAlgebra/IntervalUtilities.hs view
@@ -9,6 +9,7 @@ In the examples below, @iv@ is a synonym for 'beginerval' used to save space. -} +{-# LANGUAGE Safe #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-}@@ -58,7 +59,7 @@ ) where -import GHC.Base ( (<*>), seq)+import Prelude ( (<*>), seq) import GHC.Show ( Show ) import GHC.Num ( ) import GHC.Int ( Int ) @@ -523,7 +524,8 @@ -- invalid and contains any sequential pairs of intervals with an @IntervalRelation@, -- other than 'Meets', then the function returns an empty list. foldMeetingSafe :: ( IntervalAlgebraic (PairedInterval b) a, Eq b) =>- [ PairedInterval b a ] -- ^ Be sure this only contains intervals that sequentially 'meet'.+ [ PairedInterval b a ] -- ^ Be sure this only contains intervals + -- that sequentially 'meets'. -> [ PairedInterval b a ] foldMeetingSafe l = maybe [] (getMeeting . foldMeeting) (parseMeeting l)
src/IntervalAlgebra/PairedInterval.hs view
@@ -6,13 +6,15 @@ Maintainer : bsaul@novisci.com Stability : experimental -}-+{-# OPTIONS_HADDOCK prune #-}+{-# LANGUAGE Safe #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts #-} module IntervalAlgebra.PairedInterval ( PairedInterval+ , Empty , mkPairedInterval , getPairData , intervals@@ -79,7 +81,7 @@ intervals :: (Ord a, Show a) => [PairedInterval b a] -> [Interval a] intervals = map getInterval --- Empty is used to trivially lift an @Interval a@ into a @PairedInterval@+-- | Empty is used to trivially lift an @Interval a@ into a @PairedInterval@. data Empty = Empty deriving (Eq, Ord, Show) instance Semigroup Empty where x <> y = Empty