Skip to content

ocramz/validation-micro

Repository files navigation

validation-micro

CI

Hackage License

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

Copyright: (c) 2014 Chris Allen, Edward Kmett (c) 2018-2023 Kowainik (c) 2023 Marco Zocca License: BSD3 Maintainer: [email protected]

About

Small validation library based on Applicative

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published