toolshed-0.14.0.0: Utilities used by other packages.

Safe HaskellSafe-Inferred

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.

Synopsis

Type-classes

class SelfValidator v whereSource

The interface to which data which can self-validate should conform.

Methods

getErrorsSource

Arguments

:: v 
-> [String]

Return either null, or the reasons why the data is invalid.

isValidSource

Arguments

:: v 
-> Bool

The data which implements this interface should return True if internally consistent.

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.