packages feed

validation 0.5.5 → 0.6.0

raw patch · 7 files changed

+83/−692 lines, 7 filesdep +cabal-doctestsetup-changed

Dependencies added: cabal-doctest

Files

+ LICENCE view
@@ -0,0 +1,29 @@+Copyright 2010-2013 Tony Morris, Nick Partridge+Copyright 2014,2015 NICTA Limited+Copyright 2016,2017, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230.++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the distribution.+3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.
− LICENSE
@@ -1,29 +0,0 @@-Copyright 2010-2013 Tony Morris, Nick Partridge-Copyright 2014,2015 NICTA Limited-Copyright 2016,2017, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230.--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions-are met:-1. Redistributions of source code must retain the above copyright-   notice, this list of conditions and the following disclaimer.-2. Redistributions in binary form must reproduce the above copyright-   notice, this list of conditions and the following disclaimer in the-   documentation and/or other materials provided with the distribution.-3. Neither the name of the author nor the names of his contributors-   may be used to endorse or promote products derived from this software-   without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF-SUCH DAMAGE.
Setup.hs view
@@ -1,2 +1,25 @@+{-# LANGUAGE CPP #-}++module Main where++#ifndef MIN_VERSION_cabal_doctest+#define MIN_VERSION_cabal_doctest(x,y,z) 0+#endif+++#if MIN_VERSION_cabal_doctest(1,0,0)++import Distribution.Extra.Doctest (defaultMainWithDoctests)++main :: IO ()+main = defaultMainWithDoctests "doctests"++#else+ import Distribution.Simple++main :: IO () main = defaultMain++#endif+
changelog view
@@ -1,3 +1,8 @@+0.6.0++* Delete `Validation`, `ValidationB`, `ValidationT`, `Validation'`+* Remove `_Validation` member from `Validate` class+ 0.5.5  * Raise upper bounds on base.
src/Data/Validation.hs view
@@ -7,10 +7,6 @@ (   -- * Data types   AccValidation(..)-, Validation(..)-, ValidationT(..)-, ValidationB(..)-, Validation'   -- * Prisms , _Failure , _Success@@ -18,13 +14,11 @@ , Validate(..) ) where -import Control.Applicative(Applicative((<*>), pure), liftA2, (<$>))+import Control.Applicative(Applicative((<*>), pure), (<$>)) import Control.Lens.Getter((^.)) import Control.Lens.Iso(Swapped(..), Iso, iso) import Control.Lens.Prism(Prism, prism) import Control.Lens.Review(( # ))-import Control.Monad(Monad((>>=), return), liftM)-import Control.Monad.Trans.Class(MonadTrans, lift) import Data.Bifoldable(Bifoldable(bifoldr)) import Data.Bifunctor(Bifunctor(bimap)) import Data.Bitraversable(Bitraversable(bitraverse))@@ -32,12 +26,10 @@ import Data.Either(Either(Left, Right)) import Data.Eq(Eq) import Data.Foldable(Foldable(foldr))-import Data.Function((.), id, flip)+import Data.Function(id) import Data.Functor(Functor(fmap)) import Data.Functor.Alt(Alt((<!>))) import Data.Functor.Apply(Apply((<.>)))-import Data.Functor.Bind(Bind((>>-)), liftF2)-import Data.Functor.Identity(Identity(Identity, runIdentity)) import Data.Monoid(Monoid(mappend, mempty)) import Data.Ord(Ord) import Data.Semigroup(Semigroup((<>)))@@ -53,9 +45,6 @@ -- >>> import Test.QuickCheck -- >>> import Data.Either(either) -- >>> instance (Arbitrary err, Arbitrary a) => Arbitrary (AccValidation err a) where arbitrary = fmap (either (_Failure #) (_Success #)) arbitrary--- >>> instance (Arbitrary err, Arbitrary a) => Arbitrary (Validation err a) where arbitrary = fmap (either (_Failure #) (_Success #)) arbitrary--- >>> instance (Applicative m, Arbitrary err, Arbitrary a) => Arbitrary (ValidationT err m a) where arbitrary = fmap (ValidationT . pure) arbitrary--- >>> instance (Applicative m, Arbitrary err, Arbitrary a) => Arbitrary (ValidationB m err a) where arbitrary = fmap (ValidationB . pure) arbitrary  -- | A value of the type @err@ or @a@, however, the @Applicative@ instance -- accumulates values. This is witnessed by the @Semigroup@ context on the instance.@@ -263,558 +252,28 @@   mempty =     emptyAccValidation --- | A value of the type @err@ or @a@ and isomorphic to @Data.Either@.------ >>> _Success # (+1) <*> _Success # 7 :: Validation String Int--- Success 8------ >>> _Failure # ["f1"] <*> _Success # 7 :: Validation [String] Int--- Failure ["f1"]------ >>> _Success # (+1) <*> _Failure # ["f2"] :: Validation [String] Int--- Failure ["f2"]------ >>> _Failure # ["f1"] <*> _Failure # ["f2"] :: Validation [String] Int--- Failure ["f1"]-data Validation err a =-  Failure err-  | Success a-  deriving (Eq, Ord, Show, Data, Typeable)--fmapValidation ::-  (a -> b)-  -> Validation err a-  -> Validation err b-fmapValidation _ (Failure e) =-  Failure e-fmapValidation f (Success a) =-  Success (f a)-{-# INLINE fmapValidation #-}--instance Functor (Validation err) where-  fmap =-    fmapValidation--apValidation ::-  Validation err (a -> b)-  -> Validation err a-  -> Validation err b-Failure e1 `apValidation` Failure _  =-  Failure e1-Failure e1 `apValidation` Success _  =-  Failure e1-Success _  `apValidation` Failure e2 =-  Failure e2-Success f  `apValidation` Success a  =-  Success (f a)-{-# INLINE apValidation #-}--instance Apply (Validation err) where-  (<.>) =-    apValidation--instance Applicative (Validation err) where-  pure =-    Success-  (<*>) =-    apValidation--altValidation ::-  Validation err a-  -> Validation err a-  -> Validation err a-Failure _ `altValidation` x =-  x-Success a `altValidation` _ =-  Success a-{-# INLINE altValidation #-}--instance Alt (Validation err) where-  (<!>) =-    altValidation--foldrValidation ::-  (a -> b -> b)-  -> b-  -> Validation err a-  -> b-foldrValidation f x (Success a) =-  f a x-foldrValidation _ x (Failure _) =-  x-{-# INLINE foldrValidation #-}--instance Foldable (Validation err) where-  foldr =-    foldrValidation--traverseValidation ::-  Applicative f =>-  (a -> f b)-  -> Validation err a-  -> f (Validation err b)-traverseValidation f (Success a) =-  Success <$> f a-traverseValidation _ (Failure e) =-  pure (Failure e)-{-# INLINE traverseValidation #-}--instance Traversable (Validation err) where-  traverse =-    traverseValidation--bimapValidation ::-  (err -> f)-  -> (a -> b)-  -> Validation err a-  -> Validation f b-bimapValidation f _ (Failure e) =-  Failure (f e)-bimapValidation _ g (Success a) =-  Success (g a)-{-# INLINE bimapValidation #-}--instance Bifunctor Validation where-  bimap =-    bimapValidation--bifoldrValidation ::-  (x -> a -> b)-  -> (y -> a -> b)-  -> a-  -> Validation x y-  -> b-bifoldrValidation _ g x (Success a) =-  g a x-bifoldrValidation f _ x (Failure e) =-  f e x-{-# INLINE bifoldrValidation #-}--instance Bifoldable Validation where-  bifoldr =-    bifoldrValidation--bitraverseValidation ::-  Functor f =>-  (x -> f err)-  -> (y -> f a)-  -> Validation x y-  -> f (Validation err a)-bitraverseValidation _ g (Success a) =-  Success <$> g a-bitraverseValidation f _ (Failure e) =-  Failure <$> f e-{-# INLINE bitraverseValidation #-}--instance Bitraversable Validation where-  bitraverse =-    bitraverseValidation--bindValidation ::-  Validation err a-  -> (a -> Validation err b)-  -> Validation err b-Failure e `bindValidation` _ =-  Failure e-Success a `bindValidation` f =-  f a-{-# INLINE bindValidation #-}--instance Bind (Validation err) where-  (>>-) =-    bindValidation--instance Monad (Validation err) where-  return =-    Success-  (>>=) =-    bindValidation---- | The transformer version of @Validation@.-data ValidationT err m a =-  ValidationT {-    runValidationT :: m (Validation err a)-  }--type Validation' err a =-  ValidationT err Identity a--fmapValidationT ::-  Functor f =>-  (a -> b)-  -> ValidationT err f a-  -> ValidationT err f b-fmapValidationT f (ValidationT k) =-  ValidationT (fmap (fmap f) k)-{-# INLINE fmapValidationT #-}--instance Functor m => Functor (ValidationT err m) where-  fmap =-    fmapValidationT--apValidationT ::-  Apply f =>-  ValidationT err f (a -> b)-  -> ValidationT err f a-  -> ValidationT err f b-ValidationT f `apValidationT` ValidationT a =-    ValidationT (liftF2 (<.>) f a)-{-# INLINE apValidationT #-}--instance Apply m => Apply (ValidationT err m) where-  (<.>) =-    apValidationT--pureValidationT ::-  Applicative f =>-  a-  -> ValidationT err f a-pureValidationT =-  ValidationT . pure . pure-{-# INLINE pureValidationT #-}--aplValidationT ::-  Applicative f =>-  ValidationT err f (a -> b)-  -> ValidationT err f a-  -> ValidationT err f b-ValidationT f `aplValidationT` ValidationT a =-    ValidationT (liftA2 (<*>) f a)-{-# INLINE aplValidationT #-}--instance Applicative m => Applicative (ValidationT err m) where-  pure =-    pureValidationT-  (<*>) =-    aplValidationT--altValidationT ::-  Monad m =>-  ValidationT err m a-  -> ValidationT err m a-  -> ValidationT err m a-ValidationT x `altValidationT` ValidationT y =-  ValidationT (x >>= \q -> case q of-    Failure _ -> y-    Success a -> return (Success a))-{-# INLINE altValidationT #-}--instance (Functor m, Monad m) => Alt (ValidationT err m) where-  (<!>) =-    altValidationT--foldrValidationT ::-  Foldable f =>-  (a -> b -> b)-  -> b-  -> ValidationT err f a-  -> b-foldrValidationT f z (ValidationT x) =-  foldr (flip (foldr f)) z x-{-# INLINE foldrValidationT #-}--instance Foldable m => Foldable (ValidationT err m) where-  foldr =-    foldrValidationT--traverseValidationT ::-  (Traversable g, Applicative f) =>-  (a -> f b)-  -> ValidationT err g a-  -> f (ValidationT err g b)-traverseValidationT f (ValidationT x) =-  ValidationT <$> traverse (traverse f) x-{-# INLINE traverseValidationT #-}--instance Traversable m => Traversable (ValidationT err m) where-  traverse =-    traverseValidationT--bindValidationT ::-  Monad f =>-  ValidationT err f a-  -> (a -> ValidationT err f b)-  -> ValidationT err f b-ValidationT v `bindValidationT` f =-  ValidationT (v >>= \w -> case w of-                             Failure e -> return (Failure e)-                             Success a -> runValidationT (f a))-{-# INLINE bindValidationT #-}--instance (Apply m, Monad m) => Bind (ValidationT err m) where-  (>>-) =-    bindValidationT--returnValidationT ::-  Monad f =>-  a-  -> ValidationT err f a-returnValidationT =-  ValidationT . return . pure-{-# INLINE returnValidationT #-}--instance Monad m => Monad (ValidationT err m) where-  return =-    returnValidationT-  (>>=) =-    bindValidationT--instance MonadTrans (ValidationT err) where-  lift = liftValidationT--liftValidationT ::-  Monad m =>-  m a-  -> ValidationT e m a-liftValidationT =-  ValidationT . liftM Success-{-# INLINE liftValidationT #-}---- | The bifunctor version of ValidationT-data ValidationB m err a =-  ValidationB {-    runValidationB :: m (Validation err a)-  }--fmapValidationB ::-  Functor f =>-  (a -> b)-  -> ValidationB f err a-  -> ValidationB f err b-fmapValidationB f (ValidationB k) =-  ValidationB (fmap (fmap f) k)-{-# INLINE fmapValidationB #-}--instance Functor m => Functor (ValidationB m err) where-  fmap =-    fmapValidationB--apValidationB ::-  Apply f =>-  ValidationB f err (a -> b)-  -> ValidationB f err a-  -> ValidationB f err b-ValidationB f `apValidationB` ValidationB a =-    ValidationB (liftF2 (<.>) f a)-{-# INLINE apValidationB #-}--instance Apply m => Apply (ValidationB m err) where-  (<.>) =-    apValidationB--pureValidationB ::-  Applicative f =>-  a-  -> ValidationB f err a-pureValidationB =-  ValidationB . pure . pure-{-# INLINE pureValidationB #-}--aplValidationB ::-  Applicative f =>-  ValidationB f err (a -> b)-  -> ValidationB f err a-  -> ValidationB f err b-ValidationB f `aplValidationB` ValidationB a =-    ValidationB (liftA2 (<*>) f a)-{-# INLINE aplValidationB #-}--instance Applicative m => Applicative (ValidationB m err) where-  pure =-    pureValidationB-  (<*>) =-    aplValidationB--altValidationB ::-  Monad m =>-  ValidationB m err a-  -> ValidationB m err a-  -> ValidationB m err a-ValidationB x `altValidationB` ValidationB y =-  ValidationB (x >>= \q -> case q of-    Failure _ -> y-    Success a -> return (Success a))-{-# INLINE altValidationB #-}--instance (Functor m, Monad m) => Alt (ValidationB m err) where-  (<!>) =-    altValidationB--foldrValidationB ::-  Foldable f =>-  (a -> b -> b)-  -> b-  -> ValidationB f err a-  -> b-foldrValidationB f z (ValidationB x) =-  foldr (flip (foldr f)) z x-{-# INLINE foldrValidationB #-}--instance Foldable m => Foldable (ValidationB m err) where-  foldr =-    foldrValidationB--traverseValidationB ::-  (Traversable g, Applicative f) =>-  (a -> f b)-  -> ValidationB g err a-  -> f (ValidationB g err b)-traverseValidationB f (ValidationB x) =-  ValidationB <$> traverse (traverse f) x-{-# INLINE traverseValidationB #-}--instance Traversable m => Traversable (ValidationB m err) where-  traverse =-    traverseValidationB--bimapValidationB ::-  Functor f =>-  (err -> frr)-  -> (a -> b)-  -> ValidationB f err a-  -> ValidationB f frr b-bimapValidationB f g (ValidationB x) =-  ValidationB (fmap (bimap f g) x)-{-# INLINE bimapValidationB #-}--instance Functor m => Bifunctor (ValidationB m) where-  bimap =-    bimapValidationB--bifoldrValidationB ::-  Foldable f =>-  (err -> b -> b)-  -> (a -> b -> b)-  -> b-  -> ValidationB f err a-  -> b-bifoldrValidationB f g z (ValidationB x) =-  foldr (flip (bifoldr f g)) z x-{-# INLINE bifoldrValidationB #-}--instance Foldable m => Bifoldable (ValidationB m) where-  bifoldr =-    bifoldrValidationB--bitraverseValidationB ::-  (Traversable g, Applicative f) =>-  (err -> f frr)-  -> (a -> f b)-  -> ValidationB g err a-  -> f (ValidationB g frr b)-bitraverseValidationB f g (ValidationB x) =-  ValidationB <$> traverse (bitraverse f g) x-{-# INLINE bitraverseValidationB #-}--instance Traversable m => Bitraversable (ValidationB m) where-  bitraverse =-    bitraverseValidationB--bindValidationB ::-  Monad f =>-  ValidationB f err a-  -> (a -> ValidationB f err b)-  -> ValidationB f err b-ValidationB v `bindValidationB` f =-  ValidationB (v >>= \w -> case w of-                             Failure e -> return (Failure e)-                             Success a -> runValidationB (f a))-{-# INLINE bindValidationB #-}-instance (Apply m, Monad m) => Bind (ValidationB m err) where-  (>>-) =-    bindValidationB--returnValidationB ::-  Monad f =>-  a-  -> ValidationB f err a-returnValidationB =-  ValidationB . return . pure-{-# INLINE returnValidationB #-}--instance Monad m => Monad (ValidationB m err) where-  return =-    returnValidationB-  (>>=) =-    bindValidationB--_ValidationV' ::-  Validate f =>-  Iso (f e a) (f g b) (Validation' e a) (Validation' g b)-_ValidationV' =-  iso-    (\x -> ValidationT (Identity (x ^. _Validation)))-    (\(ValidationT (Identity x)) -> _Validation # x)-{-# INLINE _ValidationV' #-}--_ValidationTx ::-  Iso (ValidationT e m a) (ValidationT e' m' a') (ValidationB m e a) (ValidationB m' e' a')-_ValidationTx =-  iso-    (\(ValidationT x) -> ValidationB x)-    (\(ValidationB x) -> ValidationT x)--_AccValidationV ::-  Validate f =>-  Iso (f e a) (f g b) (AccValidation e a) (AccValidation g b)-_AccValidationV =-  iso-    (\x -> case x ^. _Validation of-             Failure e -> AccFailure e-             Success a -> AccSuccess a)-    (\x -> _Validation # case x of-                           AccFailure e -> Failure e-                           AccSuccess a -> Success a)-{-# INLINE _AccValidationV #-}- _EitherV ::   Validate f =>   Iso (f e a) (f g b) (Either e a) (Either g b) _EitherV =   iso-    (\x -> case x ^. _Validation of-             Failure e -> Left e-             Success a -> Right a)-    (\x -> _Validation # case x of-                           Left e -> Failure e-                           Right a -> Success a)+    (\x -> case x ^. _AccValidation of+             AccFailure e -> Left e+             AccSuccess a -> Right a)+    (\x -> _AccValidation # case x of+                           Left e -> AccFailure e+                           Right a -> AccSuccess a) {-# INLINE _EitherV #-}  class Validate f where-  _Validation ::-    Iso (f e a) (f g b) (Validation e a) (Validation g b)--  _Validation' ::-    Iso (f e a) (f g b) (Validation' e a) (Validation' g b)-  _Validation' =-    _ValidationV'-   _AccValidation ::     Iso (f e a) (f g b) (AccValidation e a) (AccValidation g b)-  _AccValidation =-    _AccValidationV    _Either ::     Iso (f e a) (f g b) (Either e a) (Either g b)   _Either =     _EitherV -instance Validate Validation where-  _Validation =-    id--_AccValidationValidationIso ::-  Iso (AccValidation e a) (AccValidation g b) (Validation e a) (Validation g b)-_AccValidationValidationIso =-  iso-    (\x -> case x of-             AccFailure e -> Failure e-             AccSuccess a -> Success a)-    (\x -> case x of-             Failure e -> AccFailure e-             Success a -> AccSuccess a)-{-# INLINE _AccValidationValidationIso #-}- _AccValidationEitherIso ::   Iso (AccValidation e a) (AccValidation g b) (Either e a) (Either g b) _AccValidationEitherIso =@@ -828,25 +287,11 @@ {-# INLINE _AccValidationEitherIso #-}  instance Validate AccValidation where-  _Validation =-    _AccValidationValidationIso   _AccValidation =     id   _Either =     _AccValidationEitherIso -_EitherValidationIso ::-  Iso (Either e a) (Either g b) (Validation e a) (Validation g b)-_EitherValidationIso =-  iso-    (\x -> case x of-             Left e -> Failure e-             Right a -> Success a)-    (\x -> case x of-             Failure e -> Left e-             Success a -> Right a)-{-# INLINE _EitherValidationIso #-}- _EitherAccValidationIso ::   Iso (Either e a) (Either g b) (AccValidation e a) (AccValidation g b) _EitherAccValidationIso =@@ -860,19 +305,11 @@ {-# INLINE _EitherAccValidationIso #-}  instance Validate Either where-  _Validation =-    _EitherValidationIso   _AccValidation =     _EitherAccValidationIso   _Either =     id -instance (m ~ Identity) => Validate (ValidationB m) where-  _Validation =-    iso-      (\(ValidationB x) -> runIdentity x)-      (ValidationB . Identity)- _Failure ::   Validate f =>   Prism (f e1 a) (f e2 a) e1 e2@@ -907,35 +344,7 @@              AccSuccess e -> AccFailure e) {-# INLINE swappedAccValidation #-} -swappedValidation ::-  Iso (Validation e a) (Validation f b) (Validation a e) (Validation b f)-swappedValidation =-  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)-{-# INLINE swappedValidation #-}--swappedValidationB ::-  Functor k =>-  Iso (ValidationB k e a) (ValidationB k f b) (ValidationB k a e) (ValidationB k b f)-swappedValidationB =-  iso-    (\(ValidationB x) -> ValidationB (fmap (swapped # ) x))-    (\(ValidationB x) -> ValidationB (fmap (swapped # ) x))-{-# INLINE swappedValidationB #-}- instance Swapped AccValidation where   swapped =     swappedAccValidation -instance Swapped Validation where-  swapped =-    swappedValidation--instance Functor f => Swapped (ValidationB f) where-  swapped =-    swappedValidationB
test/doctests.hs view
@@ -1,32 +1,11 @@ module Main where -import Build_doctests (deps)-import Control.Applicative-import Control.Monad-import Data.List-import System.Directory-import System.FilePath-import Test.DocTest+import Build_doctests (flags, pkgs, module_sources)+import Test.DocTest (doctest) -main ::-  IO ()+main :: IO () main =-  getSources >>= \sources -> doctest $-      "-isrc"-    : "-idist/build/autogen"-    : "-optP-include"-    : "-optPdist/build/autogen/cabal_macros.h"-    : "-hide-all-packages"-    : map ("-package="++) deps ++ sources--getSources :: IO [FilePath]-getSources = filter (isSuffixOf ".hs") <$> go "src"+  doctest args   where-    go dir = do-      (dirs, files) <- getFilesAndDirectories dir-      (files ++) . concat <$> mapM go dirs+    args = flags ++ pkgs ++ module_sources -getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])-getFilesAndDirectories dir = do-  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir-  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c
validation.cabal view
@@ -1,7 +1,7 @@ name:               validation-version:            0.5.5+version:            0.6.0 license:            BSD3-license-file:       LICENSE+license-file:       LICENCE author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>, Nick Partridge <nkpart> maintainer:         Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>, Nick Partridge <nkpart>, Queensland Functional Programming Lab <oᴉ˙ldɟb@llǝʞsɐɥ> copyright:          Copyright (C) 2010-2013 Tony Morris, Nick Partridge@@ -12,10 +12,10 @@ description:   <<http://i.imgur.com/uZnp9ke.png>>   .-  Several data-types like Either but with differing properties and type-class+  A data-type like Either but with differing properties and type-class   instances.   .-  Library support is provided for those different representations, include+  Library support is provided for this different representation, include   `lens`-related functions for converting between each and abstracting over their   similarities.   .@@ -29,46 +29,13 @@   As a consequence of this `Applicative` instance, there is no corresponding   `Bind` or `Monad` instance. `AccValidation` is an example of, "An applicative   functor that is not a monad."-  .-  * `Validation`-  .-  The `Validation` data type is isomorphic to `Either` and has a `Monad`-  instance that does the same as `Either`. The only difference to `Either` is-  the constructor names and surrounding library support.-  .-  * `ValidationT`-  .-  The `ValidationT` data type is the monad transformer for `Validation`. An-  instance of `MonadTrans` is provided for `(ValidationT err)`. Due to the-  arrangement of the `ValidationT` type constructor, which permits a `MonadTrans-  instance, there is no possible `Bifunctor` instance. Consequently, the-  `ValidationB` data type provides a `Bifunctor` instance (but not a-  `MonadTrans` instance). Library support is provided to exploit the isomorphism-  to `ValidationB`.-  .-  Note that since `AccValidation` is not a monad, there is also no corresponding-  monad transformer for this data type.-  .-  * `ValidationB`-  .-  The `ValidationB` data type is similar to the monad transformer for-  `Validation` (`ValidationT`), however, due to the arrangement of the-  `ValidationB` type constructor, which permits a `Bifunctor` instance, there is-  no possible `MonadTrans` instance. Consequently, the `ValidationT` data type-  provides a `MonadTrans` instance (but not a `Bifunctor` instance). Library-  support is provided to exploit the isomorphism to `ValidationT`.-  .-  * `Validation'`-  .-  The `Validation' err a` type-alias is equivalent to-  `ValidationT err Identity a` and so is isomorphic to `Either` and others.-  Libraries are supplied accordingly.  homepage:           https://github.com/qfpl/validation bug-reports:        https://github.com/qfpl/validation/issues cabal-version:      >= 1.10 build-type:         Custom extra-source-files: changelog+tested-with:        GHC==8.2.1, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4  source-repository   head   type:             git@@ -77,6 +44,12 @@ flag                small_base   description:      Choose the new, split-up base package. +custom-setup+  setup-depends:+    base          >= 4     && <5,+    Cabal         >= 1.10,+    cabal-doctest >= 1.0.1 && <1.1+ library   default-language:                     Haskell2010@@ -114,6 +87,8 @@    build-depends:                       base < 5 && >= 3+                    -- https://github.com/phadej/cabal-doctest/issues/19+                    , cabal-doctest >= 1.0.1 && <1.1                     , doctest >= 0.9.7                     , filepath >= 1.3                     , directory >= 1.1