| Safe Haskell | Safe-Infered |
|---|
ToolShed.SelfValidate
Contents
Description
AUTHOR- Dr. Alistair Ward
DESCRIPTION- A class to define the simple interface, to which data which can self-validation, should conform.
- class SelfValidator v where
- getFirstError :: SelfValidator v => v -> String
- extractErrors :: [(Bool, String)] -> [String]
Type-classes
class SelfValidator v whereSource
The interface to which data which can self-validate should conform.
Methods
Arguments
| :: v | |
| -> [String] | Return either null, or the reasons why the data is invalid. |
Instances
| SelfValidator v => SelfValidator [v] | |
| SelfValidator v => SelfValidator (Maybe v) | |
| SelfValidator v => SelfValidator (Set v) | |
| (SelfValidator a, SelfValidator b) => SelfValidator (a, b) | |
| (Ix index, SelfValidator element) => SelfValidator (Array index element) | |
| SelfValidator v => SelfValidator (Map k v) |
Functions
getFirstError :: SelfValidator v => v -> StringSource
Returns the first error only (so only call on failure of isValid), since subsequent tests may be based on invalid data.
extractErrors :: [(Bool, String)] -> [String]Source
Filters failed tests amongst those specified.