-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Input validation combinator library -- @package validate-input @version 0.2.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 = a -> ValidationT e m a -- | Run a validation on a type a runValidator :: ValidationRule e a -> a -> Either e a -- | Run a validation on a type a runValidatorT :: Monad m => ValidationRuleT e m a -> a -> m (Either e a) -- | 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 :: (Stringable a, 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 -- | All types that have a length, eg. String, '[a]', 'Vector a', -- etc. class HasLength a getLength :: HasLength a => a -> Int64 class Stringable a toString :: Stringable a => a -> String fromString :: Stringable a => String -> a toText :: Stringable a => a -> Text fromText :: Stringable a => Text -> a toLazyText :: Stringable a => a -> Text fromLazyText :: Stringable a => Text -> a toByteString :: Stringable a => a -> ByteString fromByteString :: Stringable a => ByteString -> a toLazyByteString :: Stringable a => a -> ByteString fromLazyByteString :: Stringable a => ByteString -> a toFilePath :: Stringable a => a -> FilePath fromFilePath :: Stringable a => FilePath -> a -- | 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 Monad m => Monad (ValidationT e m) instance Monad m => Functor (ValidationT e m) instance Monad m => Applicative (ValidationT e m) instance (Monad m, Monoid e) => Alternative (ValidationT e m) instance (Monad m, Monoid e) => MonadPlus (ValidationT e m) instance MonadTrans (ValidationT e) instance HasLength ByteString instance HasLength ByteString instance HasLength Text instance HasLength Text instance HasLength [a]