Simple tools for validation. See also Richard Feldman's elm-validate
Chain valiadators together.
(Hat tip to CircuitHub, who inspired the syntax and guided the code with their elm-json-extra library.)
Convenient synonym for apply.
A field that might be Nothing, but is only valid if it is Just a.
A field that might be Nothing, but is only valid if it is a non-empty String.
A field that must match the given regex.
A basic email regex. This is incredibly simplistic, but is included for convenience.
Remember that the only real way to validate an email address is to send something to it and get a reply.
A validator is a function that takes a possibly-invalid form, and either returns an error message, or a form that is definitely valid. For example:
An error message is typically a
String, but may be any type you choose.