packages feed

collect-errors 0.1.4.1 → 0.1.5.0

raw patch · 4 files changed

+26/−13 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Numeric.CollectErrors: class CanClearPotentialErrors cnt
+ Numeric.CollectErrors.Type: class CanClearPotentialErrors cnt
+ Numeric.CollectErrors.Type: instance (Numeric.CollectErrors.Type.CanClearPotentialErrors t1, Numeric.CollectErrors.Type.CanClearPotentialErrors t2) => Numeric.CollectErrors.Type.CanClearPotentialErrors (t1, t2)
+ Numeric.CollectErrors.Type: instance Numeric.CollectErrors.Type.CanClearPotentialErrors (Numeric.CollectErrors.Type.CN t)
+ Numeric.CollectErrors.Type: instance Numeric.CollectErrors.Type.CanClearPotentialErrors t => Numeric.CollectErrors.Type.CanClearPotentialErrors [t]
- Numeric.CollectErrors: clearPotentialErrors :: CN t -> CN t
+ Numeric.CollectErrors: clearPotentialErrors :: CanClearPotentialErrors cnt => cnt -> cnt
- Numeric.CollectErrors.Type: clearPotentialErrors :: CN t -> CN t
+ Numeric.CollectErrors.Type: clearPotentialErrors :: CanClearPotentialErrors cnt => cnt -> cnt

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for collect-errors +## v0.1.5++* Make clearPotentialErrors generic, with instances for CN, pairs and lists+ ## v0.1.4  * Add clearPotentialErrors for removing harmless errors
collect-errors.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 08277c279263dce2bad0694059098e8f02e2271dd9c718b7f76f9ab3bddbd18a+-- hash: 8eba751f00934a634ce2f4c449b32d985bc3bc82cd2c36b0b83929848a47cb0a  name:           collect-errors-version:        0.1.4.1+version:        0.1.5.0 synopsis:       Error monad with a Float instance description:    Please see the README on GitHub at <https://github.com/michalkonecny/collect-errors#readme> category:       Math
src/Numeric/CollectErrors.hs view
@@ -6,7 +6,7 @@ , noValueNumErrorCertain, noValueNumErrorPotential , removeValueErrorCertain, removeValueErrorPotential , prependErrorCertain, prependErrorPotential-, clearPotentialErrors+, CanClearPotentialErrors(..) , CanTakeCNErrors   -- ** Applicable general collect-error utilities , noValue
src/Numeric/CollectErrors/Type.hs view
@@ -80,16 +80,25 @@ prependErrorPotential :: NumError -> CN t -> CN t prependErrorPotential e = prependErrors $ NumErrors $ Set.singleton (e, ErrorPotential) -{-|-  If there is a value, remove any potential errors that are associated with it.--}-clearPotentialErrors :: CN t -> CN t-clearPotentialErrors (CollectErrors (Just v) (NumErrors es)) =-  CollectErrors (Just v) (NumErrors $ Set.filter notPotential es)-  where-  notPotential (_, ErrorPotential) = False-  notPotential _ = True-clearPotentialErrors ce = ce+class CanClearPotentialErrors cnt where+  {-|+    If there is a value, remove any potential errors that are associated with it.+  -}+  clearPotentialErrors :: cnt -> cnt++instance CanClearPotentialErrors (CN t) where+  clearPotentialErrors (CollectErrors (Just v) (NumErrors es)) =+    CollectErrors (Just v) (NumErrors $ Set.filter notPotential es)+    where+    notPotential (_, ErrorPotential) = False+    notPotential _ = True+  clearPotentialErrors ce = ce++instance (CanClearPotentialErrors t1, CanClearPotentialErrors t2) => CanClearPotentialErrors (t1,t2) where+  clearPotentialErrors (v1,v2) = (clearPotentialErrors v1, clearPotentialErrors v2)++instance (CanClearPotentialErrors t) => CanClearPotentialErrors [t] where+  clearPotentialErrors = map clearPotentialErrors  liftCN  :: (a -> (CN c)) -> (CN a) -> (CN c) liftCN = liftCE