mixed-types-num 0.5.10 → 0.5.11
raw patch · 5 files changed
+21/−10 lines, 5 files
Files
- changelog.md +2/−0
- mixed-types-num.cabal +1/−1
- src/Numeric/MixedTypes/Bool.hs +12/−3
- src/Numeric/MixedTypes/Eq.hs +3/−3
- src/Numeric/MixedTypes/Ord.hs +3/−3
changelog.md view
@@ -1,5 +1,7 @@ # mixed-types-num change log +* v 0.5.11 2022-08-25+ * left-first and/or for CE/CN monad * v 0.5.10 2022-07-13 * isValid and spec helpers for validity of operations * v 0.5.9 2021-08-04
mixed-types-num.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: mixed-types-num-version: 0.5.10+version: 0.5.11 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/Bool.hs view
@@ -250,13 +250,22 @@ or2 = (P.||) instance- (CanAndOrAsymmetric t1 t2, CanBeErrors es)+ (CanAndOrAsymmetric t1 t2, CanBeErrors es,+ HasBools t2, CanTestCertainly t1) => CanAndOrAsymmetric (CollectErrors es t1) (CollectErrors es t2) where type AndOrType (CollectErrors es t1) (CollectErrors es t2) = CollectErrors es (AndOrType t1 t2)- and2 = CE.lift2 and2- or2 = CE.lift2 or2+ and2 b1CE (b2CE::b2T) = + case b1CE of+ CE.CollectErrors (Just b1) _ | isCertainlyFalse b1 -> + CE.lift2 and2 b1CE (convertExactly False :: b2T) -- avoid evaluating b2CE+ _ -> CE.lift2 and2 b1CE b2CE+ or2 b1CE (b2CE::b2T) = + case b1CE of+ CE.CollectErrors (Just b1) _ | isCertainlyTrue b1 -> + CE.lift2 or2 b1CE (convertExactly True :: b2T) -- avoid evaluating b2CE+ _ -> CE.lift2 or2 b1CE b2CE instance (CanAndOrAsymmetric t1 Bool, CanBeErrors es)
src/Numeric/MixedTypes/Eq.hs view
@@ -222,7 +222,7 @@ equalTo _ _ = convertExactly False instance- (HasEqAsymmetric a b, CanBeErrors es)+ (HasEqAsymmetric a b, CanBeErrors es, CanTestCertainly (EqCompareType a b)) => HasEqAsymmetric (CollectErrors es a) (CollectErrors es b) where@@ -235,7 +235,7 @@ (\ t -> [d| instance- (HasEqAsymmetric $t b, CanBeErrors es)+ (HasEqAsymmetric $t b, CanBeErrors es, CanTestCertainly (EqCompareType $t b)) => HasEqAsymmetric $t (CollectErrors es b) where@@ -244,7 +244,7 @@ equalTo = CE.liftT1 equalTo instance- (HasEqAsymmetric a $t, CanBeErrors es)+ (HasEqAsymmetric a $t, CanBeErrors es, CanTestCertainly (EqCompareType a $t)) => HasEqAsymmetric (CollectErrors es a) $t where
src/Numeric/MixedTypes/Ord.hs view
@@ -193,7 +193,7 @@ leq d n = leq d (integer n) instance- (HasOrderAsymmetric a b, CanBeErrors es)+ (HasOrderAsymmetric a b, CanBeErrors es, CanTestCertainly (OrderCompareType a b)) => HasOrderAsymmetric (CollectErrors es a) (CollectErrors es b) where@@ -209,7 +209,7 @@ (\ t -> [d| instance- (HasOrderAsymmetric $t b, CanBeErrors es)+ (HasOrderAsymmetric $t b, CanBeErrors es, CanTestCertainly (OrderCompareType $t b)) => HasOrderAsymmetric $t (CollectErrors es b) where@@ -221,7 +221,7 @@ geq = CE.liftT1 geq instance- (HasOrderAsymmetric a $t, CanBeErrors es)+ (HasOrderAsymmetric a $t, CanBeErrors es, CanTestCertainly (OrderCompareType a $t)) => HasOrderAsymmetric (CollectErrors es a) $t where