toolshed-0.17.0.2: Ill-defined library.

Safe HaskellSafe
LanguageHaskell2010

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 :: v -> [String] Source #

isValid :: v -> Bool Source #

Instances

SelfValidator v => SelfValidator [v] Source # 

Methods

getErrors :: [v] -> [String] Source #

isValid :: [v] -> Bool Source #

SelfValidator v => SelfValidator (Maybe v) Source # 
SelfValidator v => SelfValidator (Set v) Source # 

Methods

getErrors :: Set v -> [String] Source #

isValid :: Set v -> Bool Source #

(SelfValidator a, SelfValidator b) => SelfValidator (a, b) Source # 

Methods

getErrors :: (a, b) -> [String] Source #

isValid :: (a, b) -> Bool Source #

(Ix index, SelfValidator element) => SelfValidator (Array index element) Source # 

Methods

getErrors :: Array index element -> [String] Source #

isValid :: Array index element -> Bool Source #

SelfValidator v => SelfValidator (Map k v) Source # 

Methods

getErrors :: Map k v -> [String] Source #

isValid :: Map k v -> Bool Source #

(SelfValidator a, SelfValidator b, SelfValidator c) => SelfValidator (a, b, c) Source # 

Methods

getErrors :: (a, b, c) -> [String] Source #

isValid :: (a, b, c) -> Bool Source #

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.