packages feed

iter-stats 0.1.0.2 → 0.1.0.3

raw patch · 2 files changed

+20/−4 lines, 2 filesdep ~mtl

Dependency ranges changed: mtl

Files

iter-stats.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                iter-stats-version:             0.1.0.2+version:             0.1.0.3 synopsis:            iteratees for statistical processing description:         efficient statistical values of data streams homepage:            https://github.com/JohnLato/iter-stats@@ -25,7 +25,7 @@                        heap == 1.*,                        iteratee >=0.8,                        ListLike >=3,-                       mtl ==2.1.*+                       mtl >=2.1 && < 2.3   hs-source-dirs:      src  Test-suite iter-stats-tests
tests/Statistics/Iteratee/Tests.hs view
@@ -15,13 +15,29 @@   [ testGroup "Sample" $ map mkUnProp uns   ] -unsProp :: (Eq a)+-- Don't want to drag in more dependencies for just this.+class ApproxEq a where+    approxEq :: Double -> a -> a -> Bool++instance ApproxEq Double where+    approxEq tol d1 d2 = m == 0.0 || d/m < tol where+      m = max (abs d1) (abs d2)+      d = abs (d1 - d2)++instance (ApproxEq a, ApproxEq b) => ApproxEq (a,b) where+    approxEq tol (l1,r1) (l2,r2) = approxEq tol l1 l2 && approxEq tol r1 r2++infix 4 ===+(===) :: (ApproxEq a) => a -> a -> Bool+(===) = approxEq {-pretty equal-}1.0e-10++unsProp :: (ApproxEq a)         => (V.Vector Double -> a)         -> (Iteratee [Double] Identity a)         -> [Double]         -> Bool unsProp vec iter xs = if null xs then True-    else vec (V.fromList xs) == (runIdentity $ run =<< enumPure1Chunk xs iter)+    else vec (V.fromList xs) === (runIdentity $ run =<< enumPure1Chunk xs iter)     -- we're using Eq for doubles, which is always a bad idea...      -- also not checking empty vectors, because in some cases (range,