elm-form-validations icon indicating copy to clipboard operation
elm-form-validations copied to clipboard

Adding type safety to validation.

Open nhenezi opened this issue 7 years ago • 0 comments

Problem with ValidationError = Maybe String is that amongs other things it does not handle customization well; how can I provide my own error messages if API describes validations errror as Maybe String?

This commit introduces this abstraction with type safety; defining a data constructor for each possible validation error. Public API has not changed and errorsList returns same thing as in previous versions.

A new function was introduced, validationErrorToString which serves as a blueprint for custom error messages. User has to define their own validationErrorToString message.

refs #1

nhenezi avatar Aug 10 '17 08:08 nhenezi