toolshed-0.15.0.1: Utilities used by other packages.

Safe HaskellSafe-Inferred
LanguageHaskell98

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 where Source

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

Minimal complete definition

getErrors

Methods

getErrors Source

Arguments

:: v 
-> [String]

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

isValid Source

Arguments

:: v 
-> Bool

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

Functions

getFirstError :: SelfValidator v => v -> String Source

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

Extracts the failed tests from those specified.