validation: A data-type like Either but with an accumulating Applicative

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 ofmakeClassyandmakeClassyPrismsfromlens.Polymorphic prisms (
__Failure,__Success) for type-changing operations.Isomorphisms to
Eitherand(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, accumulatingApplicativeValidatorProfunctor err x a—Profunctor, accumulatingApplicativeValidatorMonadT x err f a—Monad,MonadTrans,BindTransValidatorMonadProfunctorT err f x a—Profunctor,Monad,Category,Arrow
All four are isomorphic and have cross-type optics instances.
Modules
[Index] [Quick Jump]
Downloads
- validation-1.3.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 1, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.3.0 |
|---|---|
| Change log | changelog |
| Dependencies | assoc (>=1 && <2), base (>=4.11 && <5), bifunctors (>=5.5 && <6), deepseq (>=1.4.3 && <2), lens (>=4.20 && <6), mtl (>=2.1 && <2.4), profunctors (>=5 && <6), selective (>=0.6 && <1), semigroupoids (>=5.2.2 && <7), transformers (>=0.5 && <0.7) [details] |
| Tested with | ghc ==9.10.3, ghc ==9.8.4, ghc ==9.6.7 |
| License | BSD-3-Clause |
| 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 |
| Author | Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>, Nick Partridge <nkpart> |
| Maintainer | Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>, Nick Partridge <nkpart> |
| Uploaded | by TonyMorris at 2026-09-16T10:48:59Z |
| Category | Data |
| Home page | https://github.com/system-f/validation |
| Bug tracker | https://github.com/system-f/validation/issues |
| Source repo | head: git clone git@github.com:system-f/validation.git |
| Distributions | LTSHaskell:1.1.5, Stackage:1.2.2 |
| Reverse Dependencies | 24 direct, 28 indirect [details] |
| Downloads | 27528 total (79 in the last 30 days) |
| Rating | 2.5 (votes: 3) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs available [build log] Last success reported on 2026-09-16 [all 1 reports] |