MyNixOS website logo
Description

Lighweight pure data validation based on Applicative.

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

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

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

Metadata

Version

1.0.0.0

Platforms (75)

    Darwin
    FreeBSD 13
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd13
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows