-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Input validation combinator library
--
-- A small Haskell combinator library that provides a simple way of
-- validating user provided data structures.
@package validate-input
@version 0.4.0.0
module Data.Validator
-- | The validation monad
type ValidationM e = ValidationT e Identity
-- | The validation monad transformer
data ValidationT e m a
-- | A validation rule. Combine using (>=>) or
-- (<=<)
type ValidationRule e a = ValidationRuleT e Identity a
-- | A validation rule. Combine using (>=>) or
-- (<=<)
type ValidationRuleT e m a = TransValidationRuleT e m a a
-- | A transforming validation rule. Combine using
-- (>=>) or (<=<)
type TransValidationRule e a b = TransValidationRuleT e Identity a b
-- | A transforming validation rule. Combine using
-- (>=>) or (<=<)
type TransValidationRuleT e m a b = a -> ValidationT e m b
-- | Run a validation on a type a
runValidator :: TransValidationRule e a b -> a -> Either e b
-- | Run a validation on a type a
runValidatorT :: Monad m => TransValidationRuleT e m a b -> a -> m (Either e b)
-- | Left-to-right Kleisli composition of monads.
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
-- | Right-to-left Kleisli composition of monads.
-- (>=>), with the arguments flipped
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
-- | Check that the value is at least N elements long
minLength :: (Monad m, HasLength a) => Int64 -> e -> ValidationRuleT e m a
-- | Check that the value is at maxium N elements long
maxLength :: (Monad m, HasLength a) => Int64 -> e -> ValidationRuleT e m a
-- | Check that the value's length is between N and M
lengthBetween :: (Monad m, HasLength a) => Int64 -> Int64 -> e -> ValidationRuleT e m a
-- | Specialized minLength with N = 1
notEmpty :: (Monad m, HasLength a) => e -> ValidationRuleT e m a
-- | Check that a value is larger than N
largerThan :: (Monad m, Ord a) => a -> e -> ValidationRuleT e m a
-- | Check that a value is smaller than N
smallerThan :: (Monad m, Ord a) => a -> e -> ValidationRuleT e m a
-- | Check that a value is between M and N
valueBetween :: (Monad m, Ord a) => a -> a -> e -> ValidationRuleT e m a
-- | Checks that a value matches a regular expression
matchesRegex :: (ConvertibleStrings SBS a, ConvertibleStrings a SBS, Monad m) => Regex -> e -> ValidationRuleT e m a
-- | Check that a value conforms a predicate
conformsPred :: Monad m => (a -> Bool) -> e -> ValidationRuleT e m a
-- | Check that a value conforms a predicate
conformsPredM :: Monad m => (a -> m Bool) -> e -> ValidationRuleT e m a
-- | Check that an optional value is actually set to 'Just a'
requiredValue :: Monad m => e -> TransValidationRuleT e m (Maybe a) a
-- | Check that a list is not empty
nonEmptyList :: Monad m => e -> TransValidationRuleT e m [a] (NonEmpty a)
-- | Do some check returning Nothing if the value is invalid and
-- 'Just a' otherwise.
conformsPredTrans :: Monad m => (a -> Maybe b) -> e -> TransValidationRuleT e m a b
-- | Do some check returning Nothing if the value is invalid and
-- 'Just a' otherwise.
conformsPredTransM :: Monad m => (a -> m (Maybe b)) -> e -> TransValidationRuleT e m a b
-- | All types that have a length, eg. String, '[a]', 'Vector a',
-- etc.
class HasLength a
getLength :: HasLength a => a -> Int64
class ConvertibleStrings a b
convertString :: ConvertibleStrings a b => a -> b
-- | 64-bit signed integer type
data Int64 :: *
-- | A QuasiQuoter for regular expressions that does a compile time check.
re :: QuasiQuoter
-- | Returns a QuasiQuoter like re, but with given PCRE options.
mkRegexQQ :: [PCREOption] -> QuasiQuoter
-- | An abstract pointer to a compiled PCRE Regex structure The structure
-- allocated by the PCRE library will be deallocated automatically by the
-- Haskell storage manager.
data Regex :: *
instance Control.Monad.Trans.Class.MonadTrans (Data.Validator.ValidationT e)
instance (GHC.Base.Monad m, GHC.Base.Monoid e) => GHC.Base.MonadPlus (Data.Validator.ValidationT e m)
instance (GHC.Base.Monad m, GHC.Base.Monoid e) => GHC.Base.Alternative (Data.Validator.ValidationT e m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Data.Validator.ValidationT e m)
instance GHC.Base.Monad m => GHC.Base.Functor (Data.Validator.ValidationT e m)
instance GHC.Base.Monad m => GHC.Base.Monad (Data.Validator.ValidationT e m)
instance Data.Validator.HasLength [a]
instance Data.Validator.HasLength Data.Text.Internal.Text
instance Data.Validator.HasLength Data.Text.Internal.Lazy.Text
instance Data.Validator.HasLength Data.ByteString.Internal.ByteString
instance Data.Validator.HasLength Data.ByteString.Lazy.Internal.ByteString