data-check: Library for checking and normalization of data (e.g. from web forms)

[ bsd3, data, deprecated, library, web ] [ Propose Tags ] [ Report a vulnerability ]
Deprecated

Library for checking and normalization of data (e.g. from web forms).


[Skip to Readme]

Modules

[Index]

Flags

Manual Flags

NameDescriptionDefault
dev

Turn on development settings.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1
Change log CHANGELOG.md
Dependencies base (>=4.8 && <5.0), containers (>=0.5 && <0.6), semigroups (>=0.18 && <0.19) [details]
License BSD-3-Clause
Author Mark Karpov <markkarpov@openmailbox.org>
Maintainer Mark Karpov <markkarpov@openmailbox.org>
Category Data, Web
Home page https://github.com/mrkkrp/data-check
Bug tracker https://github.com/mrkkrp/data-check/issues
Source repo head: git clone https://github.com/mrkkrp/data-check.git
Uploaded by mrkkrp at 2016-07-23T11:09:33Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1848 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-07-23 [all 1 reports]

Readme for data-check-0.1.0

[back to package description]

Data Check

License BSD3 Hackage Stackage Nightly Stackage LTS Build Status Coverage Status

This is a library that implements generalized approach to checking and verification of data, it's useful, for example, for validation of fields on web forms.

Typically, there are a number of transformations and checks you may want to perform on a particular type of data, such as text. Thus, it makes sense to create all those transformations and checks once and then combine them to get more complex validators that may vary on per-field basis.

Certainly, if we can normalize and validate, we should normalize first. However, if we have many normalizing operations, we need a way to specify in which order they should be performed, or result can be unpredictable.

To specify order in which transformations are performed, normalizer and normalizerM functions take a “priority” argument, which is just a Natural number. The bigger the number, the later the function will be applied, so the transformation with priority 0 will always run first.

This method applies to validators just as well. It's possible to create a vocabulary of validators that can be mixed together and the result will be always deterministic.

To support more real-world use cases, every check can be performed inside of a monad, allowing to query a database for example.

One last thing to note is that every normalizer and every validator should have a unique priority number. Normalizers (and validators) with the same priority will overwrite each other. This is by design. Note that normalizer won't override validator with the same priority though, their priority-spaces are separate.

License

Copyright © 2016 Mark Karpov

Distributed under BSD 3 clause license.