packages feed

error-or-utils 0.1.1 → 0.2.0

raw patch · 2 files changed

+10/−9 lines, 2 filesdep ~error-orPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: error-or

API changes (from Hackage documentation)

Files

error-or-utils.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack ----- hash: f0885d5941e462b134b8a0763a986916a5b00a0c4a030a1690c157a1bec1e67a+-- hash: 1eb2c68051554babc8c635e5c6e0761866133af4a0188ed03b6f006c46b5cbae  name:           error-or-utils-version:        0.1.1+version:        0.2.0 synopsis:       Utilities using ErrorOr datatype description:    Builds on the error type defined in the error-or package category:       data,library,testing@@ -17,7 +17,8 @@ copyright:      2020 Kamil Dworakowski license:        BSD3 license-file:   LICENSE-tested-with:    GHC==8.0.1, GHC==8.2.2, GHC==8.8.1, GHC==8.8.3, GHC==8.10.2+tested-with:+    GHC==8.0.1, GHC==8.2.2, GHC==8.8.1, GHC==8.8.3, GHC==8.10.2 build-type:     Simple extra-source-files:     README.md@@ -33,6 +34,6 @@   build-depends:       base >=4.7 && <5     , containers-    , error-or+    , error-or >=0.2.0.0     , text   default-language: Haskell2010
src/Data/ErrorOr/Validation.hs view
@@ -66,7 +66,7 @@ approxEqual ratio x y =   if abs (realToFrac x - realToFrac y) <= abs (ratio * avg)     then pure ()-    else err ("The numbers are too far apart: " <> T.pack (show x) <> " " <> T.pack (show y))+    else fail ("The numbers are too far apart: " ++ show x ++ " " ++ show y)   where     avg :: Double     avg = realToFrac (x + y) / 2@@ -76,10 +76,10 @@  ensureIsNothing :: Show a => Maybe a -> ErrorOr () ensureIsNothing Nothing = pure ()-ensureIsNothing x = err ("Expected Nothing, but got " <> T.pack (show x))+ensureIsNothing x = fail ("Expected Nothing, but got " <> show x)  ensureIsJust :: Maybe a -> ErrorOr ()-ensureIsJust Nothing = err ("Expected Just, but got Nothing")+ensureIsJust Nothing = fail "Expected Just, but got Nothing" ensureIsJust (Just _) = pure ()  -- | It annotates a failure with the element's show result.@@ -90,4 +90,4 @@                   else pure ()  ensure :: T.Text -> Bool -> ErrorOr ()-ensure label condition = if condition then pure () else err label+ensure label condition = if condition then pure () else failText label