data-interval 2.0.0 → 2.0.1
raw patch · 4 files changed
+46/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +0/−1
- data-interval.cabal +1/−1
- src/Data/IntegerInterval/Internal.hs +18/−5
- src/Data/Interval/Internal.hs +27/−3
CHANGELOG.markdown view
@@ -4,7 +4,6 @@ reduce memory footprint (#7, thanks Bodigrim) * introduce `Boundary` type (#10, thanks Bodigrim) * export `isSingleton` function for `Interval` and `IntegerInterval` (#13)-* add `Generic` instances for `Interval` and `IntegerInterval` * remove deprecated `EndPoint` data type (#14, thanks Bodigrim) 1.3.1
data-interval.cabal view
@@ -1,5 +1,5 @@ Name: data-interval-Version: 2.0.0+Version: 2.0.1 License: BSD3 License-File: COPYING Author: Masahiro Sakai (masahiro.sakai@gmail.com)
src/Data/IntegerInterval/Internal.hs view
@@ -1,5 +1,5 @@ {-# OPTIONS_GHC -Wall #-}-{-# LANGUAGE CPP, DeriveDataTypeable, DeriveGeneric, LambdaCase #-}+{-# LANGUAGE CPP, DeriveDataTypeable, LambdaCase #-} {-# LANGUAGE Safe #-} #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-}@@ -17,7 +17,6 @@ import Data.Data import Data.ExtendedReal import Data.Hashable-import GHC.Generics (Generic) infix 5 <=..<= @@ -29,7 +28,7 @@ | LessOrEqual !Integer | GreaterOrEqual !Integer | BothClosed !Integer !Integer- deriving (Eq, Generic, Typeable)+ deriving (Eq, Typeable) -- | Lower endpoint (/i.e./ greatest lower bound) of the interval. --@@ -80,9 +79,23 @@ intervalDataType :: DataType intervalDataType = mkDataType "Data.IntegerInterval.Internal.IntegerInterval" [intervalConstr] -instance NFData IntegerInterval+instance NFData IntegerInterval where+ rnf = \case+ Whole -> ()+ Empty -> ()+ Point r -> rnf r+ LessOrEqual r -> rnf r+ GreaterOrEqual r -> rnf r+ BothClosed p q -> rnf p `seq` rnf q -instance Hashable IntegerInterval+instance Hashable IntegerInterval where+ hashWithSalt s = \case+ Whole -> s `hashWithSalt` (1 :: Int)+ Empty -> s `hashWithSalt` (2 :: Int)+ Point r -> s `hashWithSalt` (3 :: Int) `hashWithSalt` r+ LessOrEqual r -> s `hashWithSalt` (4 :: Int) `hashWithSalt` r+ GreaterOrEqual r -> s `hashWithSalt` (5 :: Int) `hashWithSalt` r+ BothClosed p q -> s `hashWithSalt` (6 :: Int) `hashWithSalt` p `hashWithSalt` q -- | closed interval [@l@,@u@] (<=..<=)
src/Data/Interval/Internal.hs view
@@ -46,7 +46,7 @@ | LeftOpen !r !r | RightOpen !r !r | BothOpen !r !r- deriving (Eq, Generic, Typeable)+ deriving (Eq, Typeable) -- | Lower endpoint (/i.e./ greatest lower bound) of the interval, -- together with 'Boundary' information.@@ -101,9 +101,33 @@ intervalDataType :: DataType intervalDataType = mkDataType "Data.Interval.Internal.Interval" [intervalConstr] -instance NFData r => NFData (Interval r)+instance NFData r => NFData (Interval r) where+ rnf = \case+ Whole -> ()+ Empty -> ()+ Point r -> rnf r+ LessThan r -> rnf r+ LessOrEqual r -> rnf r+ GreaterThan r -> rnf r+ GreaterOrEqual r -> rnf r+ BothClosed p q -> rnf p `seq` rnf q+ LeftOpen p q -> rnf p `seq` rnf q+ RightOpen p q -> rnf p `seq` rnf q+ BothOpen p q -> rnf p `seq` rnf q -instance Hashable r => Hashable (Interval r)+instance Hashable r => Hashable (Interval r) where+ hashWithSalt s = \case+ Whole -> s `hashWithSalt` (1 :: Int)+ Empty -> s `hashWithSalt` (2 :: Int)+ Point r -> s `hashWithSalt` (3 :: Int) `hashWithSalt` r+ LessThan r -> s `hashWithSalt` (4 :: Int) `hashWithSalt` r+ LessOrEqual r -> s `hashWithSalt` (5 :: Int) `hashWithSalt` r+ GreaterThan r -> s `hashWithSalt` (6 :: Int) `hashWithSalt` r+ GreaterOrEqual r -> s `hashWithSalt` (7 :: Int) `hashWithSalt` r+ BothClosed p q -> s `hashWithSalt` (8 :: Int) `hashWithSalt` p `hashWithSalt` q+ LeftOpen p q -> s `hashWithSalt` (9 :: Int) `hashWithSalt` p `hashWithSalt` q+ RightOpen p q -> s `hashWithSalt` (10 :: Int) `hashWithSalt` p `hashWithSalt` q+ BothOpen p q -> s `hashWithSalt` (11 :: Int) `hashWithSalt` p `hashWithSalt` q -- | empty (contradicting) interval empty :: Ord r => Interval r