packages feed

validity 0.4.0.2 → 0.4.0.3

raw patch · 3 files changed

+68/−65 lines, 3 files

Files

src/Data/RelativeValidity.hs view
@@ -19,7 +19,5 @@ class RelativeValidity a b where     isValidFor :: a -> b -> Bool -isInvalidFor-    :: RelativeValidity a b-    => a -> b -> Bool+isInvalidFor :: RelativeValidity a b => a -> b -> Bool isInvalidFor a b = not $ isValidFor a b
src/Data/Validity.hs view
@@ -64,7 +64,6 @@     , Monoid(..)     ) where - import Data.Either (isRight) import Data.Fixed (Fixed(MkFixed), HasResolution) import Data.List (intercalate)@@ -75,6 +74,7 @@ #if MIN_VERSION_base(4,8,0) #else import Data.Monoid+import Data.Ratio #endif import Data.Word (Word, Word16, Word32, Word64, Word8) import GHC.Generics@@ -377,11 +377,11 @@             (\(ix, e) ->                  e <?!>                  unwords-                 [ "The element at index"-                 , show (ix :: Integer)-                 , "in the list"]) .+                     [ "The element at index"+                     , show (ix :: Integer)+                     , "in the list"+                     ]) .         zip [0 ..]- #if MIN_VERSION_base(4,9,0) -- | A nonempty list is valid if all the elements are valid. --@@ -394,7 +394,6 @@             , es <?!> "The rest of the elements of the nonempty list"             ] #endif- -- | A Maybe thing is valid if the thing inside is valid or it's nothing -- It makes sense to assume that 'Nothing' is valid. -- If Nothing wasn't valid, you wouldn't have used a Maybe@@ -498,14 +497,14 @@     isValid = isValidNatural     validate = validateByChecking "Natural" #endif--- | Valid if the contained 'Integer's are valid and the denominator is+-- | Valid if the contained numbers are valid and the denominator is -- strictly positive.-instance Validity Rational where-    isValid (d :% n) = isValid n && isValid d && d > 0-    validate (d :% n) =+instance (Num a, Ord a, Validity a) => Validity (Ratio a) where+    isValid (n :% d) = isValid n && isValid d && d > 0+    validate (n :% d) =         mconcat-            [ d <?!> "The numerator"-            , n <?!> "The denominator"+            [ n <?!> "The numerator"+            , d <?!> "The denominator"             , (d > 0) <?@> "The denominator is strictly positive."             ] 
validity.cabal view
@@ -1,54 +1,60 @@-name: validity-version: 0.4.0.2-cabal-version: >=1.10-build-type: Simple-license: MIT-license-file: LICENSE-copyright: Copyright: (c) 2016 Tom Sydney Kerckhove-maintainer: syd.kerckhove@gmail.com-homepage: https://github.com/NorfairKing/validity#readme-synopsis: Validity typeclass-description:-    For more info, see <https://github.com/NorfairKing/validity the readme>.-    .-    Note: There are companion instance packages for this library:-    .-    * <https://hackage.haskell.org/package/validity-aeson validity-aeson>-    .-    * <https://hackage.haskell.org/package/validity-bytestring validity-bytestring>-    .-    * <https://hackage.haskell.org/package/validity-containers validity-containers>-    .-    * <https://hackage.haskell.org/package/validity-path validity-path>-    .-    * <https://hackage.haskell.org/package/validity-scientific validity-scientific>-    .-    * <https://hackage.haskell.org/package/validity-text validity-text>-    .-    * <https://hackage.haskell.org/package/validity-time validity-time>-    .-    * <https://hackage.haskell.org/package/validity-unordered-containers validity-unordered-containers>-    .-    * <https://hackage.haskell.org/package/validity-uuid validity-uuid>-    .-    * <https://hackage.haskell.org/package/validity-vector validity-vector>-    .-category: Validity-author: Tom Sydney Kerckhove+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 3d4c42c36ef5d4b468135318944bb8d8b697595fa09fe24c7207539b28f2d7ca +name:           validity+version:        0.4.0.3+synopsis:       Validity typeclass+description:    For more info, see <https://github.com/NorfairKing/validity the readme>.+                .+                Note: There are companion instance packages for this library:+                .+                * <https://hackage.haskell.org/package/validity-aeson validity-aeson>+                .+                * <https://hackage.haskell.org/package/validity-bytestring validity-bytestring>+                .+                * <https://hackage.haskell.org/package/validity-containers validity-containers>+                .+                * <https://hackage.haskell.org/package/validity-path validity-path>+                .+                * <https://hackage.haskell.org/package/validity-scientific validity-scientific>+                .+                * <https://hackage.haskell.org/package/validity-text validity-text>+                .+                * <https://hackage.haskell.org/package/validity-time validity-time>+                .+                * <https://hackage.haskell.org/package/validity-unordered-containers validity-unordered-containers>+                .+                * <https://hackage.haskell.org/package/validity-uuid validity-uuid>+                .+                * <https://hackage.haskell.org/package/validity-vector validity-vector>+category:       Validity+homepage:       https://github.com/NorfairKing/validity#readme+bug-reports:    https://github.com/NorfairKing/validity/issues+author:         Tom Sydney Kerckhove+maintainer:     syd.kerckhove@gmail.com+copyright:      Copyright: (c) 2016 Tom Sydney Kerckhove+license:        MIT+license-file:   LICENSE+build-type:     Simple+cabal-version:  >= 1.10+ source-repository head-    type: git-    location: https://github.com/NorfairKing/validity+  type: git+  location: https://github.com/NorfairKing/validity  library-    -    if impl(ghc >=8.0.0)-        ghc-options: -Wno-redundant-constraints-    exposed-modules:-        Data.RelativeValidity-        Data.Validity-    build-depends:-        base >=4.7 && <5-    default-language: Haskell2010-    hs-source-dirs: src-+  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