validation 1.1 → 1.1.1
raw patch · 3 files changed
+26/−15 lines, 3 filesdep +assocdep ~lensnew-uploader
Dependencies added: assoc
Dependency ranges changed: lens
Files
- changelog +5/−1
- src/Data/Validation.hs +15/−9
- validation.cabal +6/−5
changelog view
@@ -1,3 +1,8 @@+1.1.1++* Add `Data.Bifunctor.Swap.Swap` instance from `swap`+* Support `lens ^>= 5`+ 1.1 * Generalise types of `validate` and `ensure` functions to use `Maybe` instead of `Bool`@@ -98,4 +103,3 @@ 0.3.4 Loosen the type of the Isos for polymorphic update.-
src/Data/Validation.hs view
@@ -44,11 +44,15 @@ import Control.DeepSeq (NFData (rnf)) import Control.Lens (over, under) import Control.Lens.Getter((^.))-import Control.Lens.Iso(Swapped(..), Iso, iso, from)+import Control.Lens.Iso(Iso, iso, from)+#if !MIN_VERSION_lens(4,20,0)+import Control.Lens.Iso(Swapped(..))+#endif import Control.Lens.Prism(Prism, prism) import Control.Lens.Review(( # )) import Data.Bifoldable(Bifoldable(bifoldr)) import Data.Bifunctor(Bifunctor(bimap))+import Data.Bifunctor.Swap(Swap(..)) import Data.Bitraversable(Bitraversable(bitraverse)) import Data.Data(Data) import Data.Either(Either(Left, Right), either)@@ -185,16 +189,18 @@ Failure mempty {-# INLINE mempty #-} +#if !MIN_VERSION_lens(4,20,0) instance Swapped Validation where- swapped =- iso- (\v -> case v of- Failure e -> Success e- Success a -> Failure a)- (\v -> case v of- Failure a -> Success a- Success e -> Failure e)+ swapped = iso swap swap {-# INLINE swapped #-}+#endif++instance Swap Validation where+ swap v =+ case v of+ Failure e -> Success e+ Success a -> Failure a+ {-# INLINE swap #-} instance (NFData e, NFData a) => NFData (Validation e a) where rnf v =
validation.cabal view
@@ -1,5 +1,5 @@ name: validation-version: 1.1+version: 1.1.1 license: BSD3 license-file: LICENCE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>, Nick Partridge <nkpart>@@ -10,7 +10,7 @@ synopsis: A data-type like Either but with an accumulating Applicative category: Data description:- <<http://i.imgur.com/uZnp9ke.png>>+ <<https://raw.githubusercontent.com/qfpl/assets/master/data61-transparent-bg.png>> . A data-type like Either but with differing properties and type-class instances.@@ -47,11 +47,12 @@ build-depends: base >= 4.5 && < 5+ , assoc >= 1 && < 1.1 , deepseq >= 1.2 && < 1.5 , semigroups >= 0.8 && < 1 , semigroupoids >= 5 && < 6 , bifunctors >= 5.1 && < 6- , lens >= 4 && < 5+ , lens >= 4 && < 5.1 if impl(ghc>=7.2) && impl(ghc<7.5) build-depends: ghc-prim == 0.2.0.0 @@ -76,7 +77,7 @@ build-depends: base >= 3 && < 5- , hedgehog >= 0.5 && < 0.7+ , hedgehog >= 0.5 && < 1.1 , semigroups >= 0.8 && < 1 , validation @@ -100,7 +101,7 @@ build-depends: base >= 3 && < 5 , HUnit >= 1.5 && < 1.7- , lens >= 4 && < 5+ , lens , semigroups >= 0.8 && < 1 , validation