validation-micro: Lighweight pure data validation based on Applicative

[ bsd3, library, validation ] [ Propose Tags ]

Lighweight pure data validation based on Applicative. The library provides the following Either-like data type with suitable instances like Semigroup to accumulate validation errors in the Failure branch :

data Validation e a
    = Failure e
    | Success a

[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 1.0.0.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), deepseq [details]
License BSD-3-Clause
Copyright 2014 Edward Kmett, 2020-2023 Kowainik, 2023 Marco Zocca
Author Edward Kmett, Kowainik, Marco Zocca
Maintainer ocramz
Revised Revision 1 made by ocramz at 2023-06-18T22:12:55Z
Category Validation
Home page https://github.com/ocramz/validation-micro
Source repo head: git clone https://github.com/ocramz/validation-micro
Uploaded by ocramz at 2023-06-18T11:53:31Z
Distributions NixOS:1.0.0.0
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 97 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-06-18 [all 1 reports]

Readme for validation-micro-1.0.0.0

[back to package description]

validation-micro

GitHub CI

Lightweight pure data validation based on Applicative .

validation-micro is built around the following data type:

data Validation e a
    = Failure e
    | Success a

This data type is similar to Either but allows accumulating all errors instead of short-circuiting on the first one.

Comparison with other packages

validation-micro is not the only package that provides the Validation data type. Here are some differences and commonalities to other validation packages:

  • Lightweight. validation-micro depends only on base and deepseq, which make it fast to build. So adding validation capabilities to your library or application doesn't contribute much to your dependency footprint.
  • Future-proof. Both base and deepseq are GHC boot packages, which means that validation-micro can be imported as long as GHC can run.
  • No Selective instance. This means you cannot choose which validation to use based on the value. On the other hand, we don't need to depend on selective which is a somewhat experimental package.
  • No Monad instance - but there is a bindValidation utility function which behaves like (>>=).

Copyright: (c) 2014 Chris Allen, Edward Kmett (c) 2018-2023 Kowainik (c) 2023 Marco Zocca License: BSD3 Maintainer: oss@unfoldml.com