packages feed

mixed-types-num 0.5.5.0 → 0.5.6.0

raw patch · 4 files changed

+47/−20 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Numeric.MixedTypes.MinMaxAbs: instance Numeric.MixedTypes.MinMaxAbs.CanMinMaxAsymmetric GHC.Integer.Type.Integer GHC.Types.Double
+ Numeric.MixedTypes.MinMaxAbs: instance Numeric.MixedTypes.MinMaxAbs.CanMinMaxAsymmetric GHC.Real.Rational GHC.Types.Double
+ Numeric.MixedTypes.MinMaxAbs: instance Numeric.MixedTypes.MinMaxAbs.CanMinMaxAsymmetric GHC.Types.Double GHC.Integer.Type.Integer
+ Numeric.MixedTypes.MinMaxAbs: instance Numeric.MixedTypes.MinMaxAbs.CanMinMaxAsymmetric GHC.Types.Double GHC.Real.Rational
+ Numeric.MixedTypes.MinMaxAbs: instance Numeric.MixedTypes.MinMaxAbs.CanMinMaxAsymmetric GHC.Types.Double GHC.Types.Int
+ Numeric.MixedTypes.MinMaxAbs: instance Numeric.MixedTypes.MinMaxAbs.CanMinMaxAsymmetric GHC.Types.Int GHC.Types.Double
+ Numeric.MixedTypes.Reduce: instance Numeric.MixedTypes.Reduce.CanGiveUpIfVeryInaccurate GHC.Types.Double

Files

changelog.md view
@@ -1,5 +1,8 @@ # mixed-types-num change log +* v 0.5.6 2021-05-27+  * add instances: mixed min/max Double $t+  * add instance: CanGiveUpIfVeryInaccurate Double * v 0.5.5 2021-05-26   * powUsingMulRecip etc with custom multiply and recip operations * v 0.5.4 2021-05-21
mixed-types-num.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: c613a879e0e3fe6ca50f14dc60091f6ac942b46a43b05cca7e39e7461f3cf2a4+-- hash: bc01675c922b24362d3d11045237c87495398281a43b390a54a1d6fbb710a4cc  name:           mixed-types-num-version:        0.5.5.0+version:        0.5.6.0 synopsis:       Alternative Prelude with numeric and logic expressions typed bottom-up description:    Please see the README on GitHub at <https://github.com/michalkonecny/mixed-types-num#readme> category:       Math
src/Numeric/MixedTypes/MinMaxAbs.hs view
@@ -1,7 +1,7 @@+{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-orphans #-}-{-# OPTIONS_GHC -Wno-partial-type-signatures #-} {-# LANGUAGE PartialTypeSignatures #-}-{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -Wno-partial-type-signatures #-} {-|     Module      :  Numeric.MixedType.MinMaxAbs     Description :  Bottom-up typed min, max and abs@@ -156,23 +156,39 @@   min = convertSecond min   max = convertSecond max -instance CanMinMaxAsymmetric Int Rational where-  type MinMaxType Int Rational = Rational-  min = convertFirst min-  max = convertFirst max-instance CanMinMaxAsymmetric Rational Int where-  type MinMaxType Rational Int = Rational-  min = convertSecond min-  max = convertSecond max+$(declForTypes+  [[t| Integer |], [t| Int |]]+  (\ t -> [d| -instance CanMinMaxAsymmetric Integer Rational where-  type MinMaxType Integer Rational = Rational-  min = convertFirst min-  max = convertFirst max-instance CanMinMaxAsymmetric Rational Integer where-  type MinMaxType Rational Integer = Rational-  min = convertSecond min-  max = convertSecond max+  instance CanMinMaxAsymmetric $t Rational where+    type MinMaxType $t Rational = Rational+    min = convertFirst min+    max = convertFirst max+  instance CanMinMaxAsymmetric Rational $t where+    type MinMaxType Rational $t = Rational+    min = convertSecond min+    max = convertSecond max+  |]))++$(declForTypes+  [[t| Integer |], [t| Int |], [t| Rational |]]+  (\ t -> [d|++  instance+    CanMinMaxAsymmetric $t Double+    where+    type MinMaxType $t Double = Double+    min a b = min (double a) b+    max a b = max (double a) b++  instance+    CanMinMaxAsymmetric Double $t+    where+    type MinMaxType Double $t = Double+    min a b = min a (double b)+    max a b = max a (double b)++  |]))  instance (CanMinMaxAsymmetric a b) => CanMinMaxAsymmetric [a] [b] where   type MinMaxType [a] [b] = [MinMaxType a b]
src/Numeric/MixedTypes/Reduce.hs view
@@ -21,7 +21,10 @@ -- import qualified Prelude as P  import Numeric.CollectErrors ( CN, NumError (NumError) )+import qualified Numeric.CollectErrors as CN +import Numeric.MixedTypes.Eq+ class CanGiveUpIfVeryInaccurate t where   {-| If the value contains so little information that it is seen as useless,       drop the value and add an error indicating what happened.@@ -42,3 +45,8 @@ instance CanGiveUpIfVeryInaccurate Int instance CanGiveUpIfVeryInaccurate Integer instance CanGiveUpIfVeryInaccurate Rational+instance CanGiveUpIfVeryInaccurate Double where+  giveUpIfVeryInaccurate d+    | isFinite d = d+    | isNaN d = CN.prependErrorCertain (CN.NumError "NaN") d+    | otherwise = CN.prependErrorCertain (CN.NumError "Inifinity") d