packages feed

validity 0.7.0.0 → 0.8.0.0

raw patch · 2 files changed

+21/−24 lines, 2 files

Files

src/Data/Validity.hs view
@@ -48,6 +48,7 @@     , annotate     , delve     , decorate+    , decorateList     , invalid     , valid     -- * Utilities@@ -249,6 +250,13 @@ decorate :: String -> Validation -> Validation decorate = flip annotateValidation +-- | Decorate a piecewise validation of a list with their location in the list+decorateList :: [a] -> (a -> Validation) -> Validation+decorateList as func = mconcat $+  flip map (zip [0..] as) $ \(i, a) ->+  decorate (unwords ["The element at index", show (i :: Integer), "in the list"]) $+  func a+ -- | Construct a trivially invalid 'Validation' -- -- Example:@@ -339,17 +347,8 @@ -- If the empty list should not be considered valid as part of your custom data -- type, make sure to write a custom @Validity instance@ instance Validity a => Validity [a] where-    validate =-        mconcat .-        map-            (\(ix, e) ->-                 annotate e $-                 unwords-                     [ "The element at index"-                     , show (ix :: Integer)-                     , "in the list"-                     ]) .-        zip [0 ..]+    validate = flip decorateList validate+ #if MIN_VERSION_base(4,9,0) -- | A nonempty list is valid if all the elements are valid. --@@ -432,9 +431,8 @@ instance Validity Float where     validate f =         mconcat-            [ declare "The Float is not Nan." $ not (isNaN f)+            [ declare "The Float is not NaN." $ not (isNaN f)             , declare "The Float is not infinite." $ not (isInfinite f)-            , declare "The Float is not zegative zero." $ not (isNegativeZero f)             ]  -- | NOT trivially valid:@@ -446,7 +444,6 @@         mconcat             [ declare "The Double is not NaN." $ not (isNaN d)             , declare "The Double is not infinite." $ not (isInfinite d)-            , declare "The Double is not zegative zero." $ not (isNegativeZero d)             ]  -- | Trivially valid
validity.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: bf53a19ba2c00de66db95f83937a6950f4b805b648cadb0e7f4a224b954970f6+-- hash: 2d73ea367f1418980c464539a285c39b7ca5b03e5c820533c8f375b156eb9f27  name:           validity-version:        0.7.0.0+version:        0.8.0.0 synopsis:       Validity typeclass description:    For more info, see <https://github.com/NorfairKing/validity the readme>.                 .@@ -47,22 +47,25 @@   location: https://github.com/NorfairKing/validity  library+  exposed-modules:+      Data.RelativeValidity+      Data.Validity+  other-modules:+      Paths_validity   hs-source-dirs:       src   build-depends:       base >=4.7 && <5   if impl(ghc >=8.0.0)     ghc-options: -Wno-redundant-constraints-  exposed-modules:-      Data.RelativeValidity-      Data.Validity-  other-modules:-      Paths_validity   default-language: Haskell2010  test-suite validity-test   type: exitcode-stdio-1.0   main-is: Spec.hs+  other-modules:+      Data.ValiditySpec+      Paths_validity   hs-source-dirs:       test   ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall@@ -70,7 +73,4 @@       base     , hspec     , validity-  other-modules:-      Data.ValiditySpec-      Paths_validity   default-language: Haskell2010