Copyright (C) 2010 Dr. Alistair Ward          (at your option)
any later version.          but WITHOUT ANY WARRANTY; without
even the implied warranty of         GNU General Public License
for more details.          You should have received a copy of
the GNU General Public License {- |  [@AUTHOR@]     Dr. Alistair
Ward   [@DESCRIPTION@]        A class to define the simple
interface, to which data which can self-validation, should
conform.  module ToolShed.SelfValidate( -- * Type-classes -- **
Functions ) where  import qualified        Data.Array.IArray
import qualified        Data.Map import qualified
Data.Set  -- | The interface to which data which can self-
validate should conform. class SelfValidator v   where
getErrors       :: v -> [String]        -- ^ Return either null,
or the reasons why the data is invalid.          isValid
:: v -> Bool            -- ^ The data which implements this
interface should return 'True' if internally consistent.
isValid = null . getErrors      --Default implementation.
instance (SelfValidator v) => SelfValidator (Maybe v)   where
getErrors (Just v)      = getErrors