data-interval 0.1.0 → 0.2.0
raw patch · 2 files changed
+11/−4 lines, 2 filesdep +deepseqPVP ok
version bump matches the API change (PVP)
Dependencies added: deepseq
API changes (from Hackage documentation)
+ Data.Interval: instance NFData r => NFData (EndPoint r)
+ Data.Interval: instance NFData r => NFData (Interval r)
Files
- data-interval.cabal +2/−3
- src/Data/Interval.hs +9/−1
data-interval.cabal view
@@ -1,5 +1,5 @@ Name: data-interval-Version: 0.1.0+Version: 0.2.0 License: BSD3 License-File: COPYING Author: Masahiro Sakai (masahiro.sakai@gmail.com)@@ -23,10 +23,9 @@ location: git://github.com/msakai/data-interval.git Library- Exposed: False Hs-source-dirs: src Build-Depends:- base >=4 && <5, lattices >=1.2.1.1+ base >=4 && <5, lattices >=1.2.1.1, deepseq Extensions: ScopedTypeVariables FlexibleInstances
src/Data/Interval.hs view
@@ -57,6 +57,7 @@ ) where import Algebra.Lattice+import Control.DeepSeq import Control.Exception (assert) import Control.Monad hiding (join) import Data.List hiding (null)@@ -85,11 +86,14 @@ upperBound' :: Num r => Interval r -> (EndPoint r, Bool) upperBound' (Interval _ ub) = ub +instance NFData r => NFData (Interval r) where+ rnf (Interval lb ub) = rnf lb `seq` rnf ub+ instance (Num r, Ord r) => JoinSemiLattice (Interval r) where join = hull instance (Num r, Ord r) => MeetSemiLattice (Interval r) where- meet = hull+ meet = intersection instance (Num r, Ord r) => Lattice (Interval r) @@ -426,6 +430,10 @@ fmap f NegInf = NegInf fmap f (Finite x) = Finite (f x) fmap f PosInf = PosInf++instance NFData r => NFData (EndPoint r) where+ rnf (Finite x) = rnf x+ rnf _ = () isFinite :: EndPoint r -> Bool isFinite (Finite _) = True