packages feed

validation-1.3.0: validation.cabal

name:               validation
version:            1.3.0
license:            BSD3
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>
copyright:          Copyright (C) 2010-2013 Tony Morris, Nick Partridge
                    Copyright (C) 2014,2015 NICTA Limited
                    Copyright (c) 2016-2019 Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230
                    Copyright (c) 2019-2026 Tony Morris
synopsis:           A data-type like Either but with an accumulating Applicative
category:           Data
description:
  <<https://logo.systemf.com.au/systemf-450x450.png>>
  .
  A data type like @Either@ but with an accumulating @Applicative@ instance.
  .
  == @Validation@
  .
  The @Validation@ data type is isomorphic to @Either@, but has an instance
  of @Applicative@ that accumulates on the error side. That is to say, if two
  (or more) errors are encountered, they are appended using a @Semigroup@
  operation.
  .
  As a consequence of this @Applicative@ instance, there is no corresponding
  @Bind@ or @Monad@ instance. @Validation@ is an example of, "An applicative
  functor that is not a monad."
  .
  The library provides:
  .
  * Classy optics (@GetValidation@, @HasValidation@, @ReviewValidation@,
    @AsValidation@) following the conventions of @makeClassy@ and
    @makeClassyPrisms@ from @lens@.
  * Polymorphic prisms (@__Failure@, @__Success@) for type-changing operations.
  * Isomorphisms to @Either@ and @(Bool, a)@.
  .
  == @ValidationMonadT@
  .
  @ValidationMonadT err m a@ is a monad transformer wrapping @m (Validation err a)@.
  Unlike @Validation@, it has short-circuiting @Applicative@, @Bind@, @Monad@,
  and @MonadError@ instances.
  .
  == Validators
  .
  Four validator newtypes wrap a validation function with different type
  parameter orders, enabling different class instances:
  .
  * @Validator x err a@ — @Bifunctor@, accumulating @Applicative@
  * @ValidatorProfunctor err x a@ — @Profunctor@, accumulating @Applicative@
  * @ValidatorMonadT x err f a@ — @Monad@, @MonadTrans@, @BindTrans@
  * @ValidatorMonadProfunctorT err f x a@ — @Profunctor@, @Monad@, @Category@, @Arrow@
  .
  All four are isomorphic and have cross-type optics instances.

homepage:           https://github.com/system-f/validation
bug-reports:        https://github.com/system-f/validation/issues
cabal-version:      >= 1.10
build-type:         Simple
extra-source-files: changelog
tested-with:        GHC == 9.10.3, GHC == 9.8.4, GHC == 9.6.7

source-repository   head
  type:             git
  location:         git@github.com:system-f/validation.git

library
  default-language:
                    Haskell2010

  build-depends:
                      base          >= 4.11   && < 5
                    , assoc         >= 1      && < 2
                    , deepseq       >= 1.4.3  && < 2
                    , selective     >= 0.6    && < 1
                    , semigroupoids >= 5.2.2  && < 7
                    , bifunctors    >= 5.5    && < 6
                    , lens          >= 4.20   && < 6
                    , mtl           >= 2.1    && < 2.4
                    , profunctors   >= 5      && < 6
                    , transformers  >= 0.5    && < 0.7

  ghc-options:
                    -Wall

  hs-source-dirs:
                    src

  exposed-modules:
                    Data.Validation
                    Data.Validation.Validation
                    Data.Validation.ValidationMonad
                    Data.Validation.Validator

test-suite hedgehog
  type:
                    exitcode-stdio-1.0

  main-is:
                    hedgehog_tests.hs

  default-language:
                    Haskell2010

  build-depends:
                      base         >= 4.11   && < 5
                    , assoc        >= 1      && < 2
                    , bifunctors   >= 5.5    && < 6
                    , hedgehog     >= 0.5    && < 2
                    , lens         >= 4.20   && < 6
                    , semigroupoids >= 5.2.2 && < 7
                    , validation

  ghc-options:
                    -Wall
                    -threaded

  hs-source-dirs:
                    test

test-suite doctest
  type:
                    exitcode-stdio-1.0

  main-is:
                    doctest_tests.hs

  default-language:
                    Haskell2010

  build-depends:
                      base       >= 4.11   && < 5
                    , process    >= 1.6    && < 2
                    , validation

  ghc-options:
                    -Wall
                    -threaded

  hs-source-dirs:
                    test