-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Validate
--
-- Validate data provided by users.
@package validate
@version 0.0
module Data.GenericString
class (IsString t) => Str t
readToMaybeStr :: (Str t, Read b) => t -> Maybe b
showToStr :: (Str t, Show b) => b -> t
appendStr :: (Str t) => t -> t -> t
foldrStr :: (Str t) => (Char -> b -> b) -> b -> t -> b
strToString :: (Str t) => t -> String
instance Str ByteString
instance Str ByteString
instance Str String
-- | Validate values, such as common user inputs; emails, age, address,
-- credit card, web address, etc.
module Data.Validate
-- | A test taking input and producing a new input.
type Test e a b = Maybe a -> Input e (Maybe b)
-- | Validate some input with testing function.
validate :: (Str e) => Test e a b -> a -> Maybe [e]
-- | A generic testing function with a predicate, with type preservation.
test :: (Str e) => e -> (a -> Bool) -> Test e a a
-- | Attach a "label" around a testing function which errors. This might be
-- useless.
label :: (Str e) => e -> Test e a b -> Test e a b
-- | Is equal to something.
equal :: (Show a, Eq a, Str e) => a -> Test e a a
-- | Check that a String contains an integer.
isInt :: (Str e) => Test e e e
-- | Check that a a value is less than a specified value.
less :: (Str e, Ord a, Show a) => a -> Test e a a
-- | Like less but the value must be more than the specified value.
more :: (Str e, Ord a, Show a) => a -> Test e a a
-- | Test that a given age is correct (130 years of age max.).
-- http:www.seniorjournal.comNEWSSeniorStats/5-12-03-NoOne123.htm
age :: (Str e, Str s) => Test e s Int
-- | Test that a given email is correct. Based on
-- http:www.hm2k.compostswhat-is-a-valid-email-address
email :: (Str e, Str s) => Test e s s
-- | Make a test which tests a string according to a regular expression
-- pattern.
pattern :: (Str e, Str s) => e -> s -> Test e s s
-- | Check that a string contains an integer, and try to convert to an Int.
int :: (Str e, Str s) => Test e s Int
-- | Check that a string contains an integer, and try to convert to a
-- Float.
float :: (Str e, Str s) => Test e s Float
instance (Str e) => Monad (Input e)