toolshed-0.11.1.0: src/ToolShed/SelfValidate.hs
{-
Copyright (C) 2010 Dr. Alistair Ward
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-}
{- |
[@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
SelfValidator(..)
) where
-- | The interface to which data which can self-validate should conform.
class SelfValidator a where
isValid :: a -> Bool -- ^ The data which implements this interface should return 'True' if internally consistent.
instance SelfValidator a => SelfValidator [a] where
isValid = all isValid --NB: a null list is presumed to be OK.