packages feed

approximate 0.3.4 → 0.3.5

raw patch · 4 files changed

+37/−40 lines, 4 filesdep ~basedep ~deepseqdep ~hashablePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, deepseq, hashable, semigroupoids, vector

API changes (from Hackage documentation)

+ Data.Approximate.Mass: instance Data.Functor.Classes.Eq1 Data.Approximate.Mass.Mass
+ Data.Approximate.Type: instance Data.Functor.Classes.Eq1 Data.Approximate.Type.Approximate
- Data.Approximate.Type: approximate :: HasApproximate c_afHX a_afp2 => Lens' c_afHX (Approximate a_afp2)
+ Data.Approximate.Type: approximate :: HasApproximate c_afQW a_afy5 => Lens' c_afQW (Approximate a_afy5)
- Data.Approximate.Type: class HasApproximate c_afHX a_afp2 | c_afHX -> a_afp2
+ Data.Approximate.Type: class HasApproximate c_afQW a_afy5 | c_afQW -> a_afy5
- Data.Approximate.Type: confidence :: HasApproximate c_afHX a_afp2 => Lens' c_afHX (Log Double)
+ Data.Approximate.Type: confidence :: HasApproximate c_afQW a_afy5 => Lens' c_afQW (Log Double)
- Data.Approximate.Type: estimate :: HasApproximate c_afHX a_afp2 => Lens' c_afHX a_afp2
+ Data.Approximate.Type: estimate :: HasApproximate c_afQW a_afy5 => Lens' c_afQW a_afy5
- Data.Approximate.Type: hi :: HasApproximate c_afHX a_afp2 => Lens' c_afHX a_afp2
+ Data.Approximate.Type: hi :: HasApproximate c_afQW a_afy5 => Lens' c_afQW a_afy5
- Data.Approximate.Type: lo :: HasApproximate c_afHX a_afp2 => Lens' c_afHX a_afp2
+ Data.Approximate.Type: lo :: HasApproximate c_afQW a_afy5 => Lens' c_afQW a_afy5

Files

CHANGELOG.markdown view
@@ -1,3 +1,9 @@+0.3.5 [2021.11.16]+------------------+* Add `Eq1` instances for `Approximate` and `Mass`.+* Allow building with `hashable-1.4.*`.+* Drop support for pre-8.0 versions of GHC.+ 0.3.4 [2021.02.21] ------------------ * Fix the build with `safecopy-0.10.4` or later.
approximate.cabal view
@@ -1,6 +1,6 @@ name:          approximate category:      Numeric-version:       0.3.4+version:       0.3.5 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE@@ -11,16 +11,14 @@ bug-reports:   http://github.com/analytics/approximate/issues copyright:     Copyright (C) 2013 Edward A. Kmett build-type:    Simple-tested-with:   GHC == 7.4.2-             , GHC == 7.6.3-             , GHC == 7.8.4-             , GHC == 7.10.3-             , GHC == 8.0.2+tested-with:   GHC == 8.0.2              , GHC == 8.2.2              , GHC == 8.4.4              , GHC == 8.6.5-             , GHC == 8.8.3-             , GHC == 8.10.1+             , GHC == 8.8.4+             , GHC == 8.10.7+             , GHC == 9.0.1+             , GHC == 9.2.1 synopsis:      Approximate discrete values and numbers description:   This package provides approximate discrete values and numbers. @@ -43,21 +41,21 @@  library   build-depends:-    base                      >= 4.3      && < 5,+    base                      >= 4.9      && < 5,     binary                    >= 0.5      && < 0.9,     bytes                     >= 0.7      && < 1,     cereal                    >= 0.3.5    && < 0.6,     comonad                   >= 3        && < 6,     deepseq                   >= 1.3      && < 1.5,     ghc-prim,-    hashable                  >= 1.2.5    && < 1.4,+    hashable                  >= 1.2.5    && < 1.5,     lens                      >= 3.9      && < 6,     log-domain,     pointed                   >= 3        && < 6,     semigroupoids             >= 3.0.2    && < 6,     semigroups                >= 0.8.4    && < 1,     safecopy                  >= 0.8.1    && < 0.11,-    vector                    >= 0.9      && < 0.13+    vector                    >= 0.12.1.2 && < 0.13    if flag(herbie)     build-depends: HerbiePlugin >= 0.1 && < 0.2@@ -70,10 +68,7 @@     Data.Approximate.Mass     Data.Approximate.Numerics -  if impl(ghc >= 7.4 && < 7.6)-    build-depends: ghc-prim-   c-sources: cbits/fast.c-  ghc-options: -Wall -fwarn-tabs -O2+  ghc-options: -Wall -Wtabs -O2   hs-source-dirs: src   default-language: Haskell2010
src/Data/Approximate/Mass.hs view
@@ -17,9 +17,6 @@   , (|?), (&?), (^?)   ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.DeepSeq import Control.Monad@@ -27,10 +24,8 @@ import Data.Bytes.Serial as Bytes import Data.Copointed import Data.Data-#if __GLASGOW_HASKELL__ < 710-import Data.Foldable-#endif import Data.Functor.Bind+import Data.Functor.Classes import Data.Functor.Extend import Data.Hashable (Hashable(..)) import Data.Hashable.Lifted (Hashable1(..))@@ -40,12 +35,10 @@ import Data.Semigroup #endif import Data.Serialize as Serialize-#if __GLASGOW_HASKELL__ < 710-import Data.Traversable-#endif-import Data.Vector.Generic as G-import Data.Vector.Generic.Mutable as M-import Data.Vector.Unboxed as U+import qualified Data.Vector.Generic as G+import qualified Data.Vector.Generic.Mutable as M+import qualified Data.Vector.Unboxed as U+import Data.Vector.Unboxed (Unbox) import GHC.Generics import Numeric.Log @@ -74,7 +67,7 @@ -- Mass 0.669921875 "zzz" -- data Mass a = Mass {-# UNPACK #-} !(Log Double) a-  deriving (Eq,Ord,Show,Read,Typeable,Data,Generic)+  deriving (Eq,Ord,Show,Read,Data,Generic)  instance Binary a => Binary (Mass a) where   put (Mass p a) = Binary.put p >> Binary.put a@@ -91,6 +84,9 @@   getCopy = contain Serialize.get   putCopy = contain . Serialize.put +instance Eq1 Mass where+    liftEq eq (Mass p a) (Mass q b) = p == q && eq a b+ instance Hashable a => Hashable (Mass a) instance Hashable1 Mass where     liftHashWithSalt h s (Mass m x) = hashWithSalt s m `h` x@@ -139,10 +135,8 @@   {-# INLINE basicUnsafeMove #-}   basicUnsafeGrow (MV_Mass v) n = MV_Mass `liftM` M.basicUnsafeGrow v n   {-# INLINE basicUnsafeGrow #-}-#if MIN_VERSION_vector(0,11,0)   basicInitialize (MV_Mass v) = M.basicInitialize v   {-# INLINE basicInitialize #-}-#endif  instance Unbox a => G.Vector U.Vector (Mass a) where   basicUnsafeFreeze (MV_Mass v) = V_Mass `liftM` G.basicUnsafeFreeze v@@ -192,8 +186,10 @@ instance Monoid a => Monoid (Mass a) where   mempty = Mass 1 mempty   {-# INLINE mempty #-}+#if !(MIN_VERSION_base(4,11,0))   mappend (Mass p a) (Mass q b) = Mass (p * q) (mappend a b)   {-# INLINE mappend #-}+#endif  instance Semigroup a => Semigroup (Mass a) where   Mass p a <> Mass q b = Mass (p * q) (a <> b)
src/Data/Approximate/Type.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TemplateHaskell #-}@@ -31,19 +30,18 @@ import Data.Bytes.Serial as Bytes import Data.Copointed import Data.Data-#if __GLASGOW_HASKELL__ < 710-import Data.Foldable-#endif import Data.Functor.Apply+import Data.Functor.Classes import Data.Hashable (Hashable(..)) import Data.Hashable.Lifted (Hashable1(..)) import Data.Monoid import Data.Pointed import Data.SafeCopy import Data.Serialize as Serialize-import Data.Vector.Generic as G-import Data.Vector.Generic.Mutable as M-import Data.Vector.Unboxed as U+import qualified Data.Vector.Generic as G+import qualified Data.Vector.Generic.Mutable as M+import qualified Data.Vector.Unboxed as U+import Data.Vector.Unboxed (Unbox) import GHC.Generics import Numeric.Log @@ -53,7 +51,7 @@ data Approximate a = Approximate   { _confidence :: {-# UNPACK #-} !(Log Double)   , _lo, _estimate, _hi :: a-  } deriving (Eq,Show,Read,Typeable,Data,Generic)+  } deriving (Eq,Show,Read,Data,Generic)  makeClassy ''Approximate @@ -72,6 +70,10 @@   getCopy = contain Serialize.get   putCopy = contain . Serialize.put +instance Eq1 Approximate where+    liftEq eq (Approximate p la ma ha) (Approximate q lb mb hb) =+      p == q && eq la lb && eq ma mb && eq ha hb+ instance Hashable a => Hashable (Approximate a) instance Hashable1 Approximate where     liftHashWithSalt h s (Approximate c low est high) =@@ -116,10 +118,8 @@   {-# INLINE basicUnsafeMove #-}   basicUnsafeGrow (MV_Approximate v) n = MV_Approximate `liftM` M.basicUnsafeGrow v n   {-# INLINE basicUnsafeGrow #-}-#if MIN_VERSION_vector(0,11,0)   basicInitialize (MV_Approximate v) = M.basicInitialize v   {-# INLINE basicInitialize #-}-#endif  instance Unbox a => G.Vector U.Vector (Approximate a) where   basicUnsafeFreeze (MV_Approximate v) = V_Approximate `liftM` G.basicUnsafeFreeze v