-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A nice way to define field validations in Haskell. -- -- See https://github.com/mavenraven/validations for description -- and tutorial. Code used in the tutorial can be found in -- src/Validations/Tutorial.lhs. @package validations @version 0.1.0.2 module Validations.Types.Checker type Checker error a b = a -> Either error b type MonadicChecker error monad a b = a -> monad (Either error b) module Validations.Internal.Lens getter :: (forall f. Functor f => (a -> f a) -> s -> f s) -> s -> a setter :: (forall f. Functor f => (a -> f a) -> s -> f s) -> s -> a -> s lens :: Functor f => (s -> a) -> (s -> a -> s) -> (a -> f a) -> s -> f s type Lens a s = Functor f => (a -> f a) -> s -> f s module Validations.Validator attach :: Monad m => Checker ev a b -> ek -> Validator ek ev m a b attachM :: Monad m => MonadicChecker ev m a b -> ek -> Validator ek ev m a b newtype Validator errorKey errorValue monad a b Validator :: (a -> monad (Either (errorKey, errorValue) b)) -> Validator errorKey errorValue monad a b runValidator :: Validator errorKey errorValue monad a b -> a -> monad (Either (errorKey, errorValue) b) composeValidator :: Monad m => Validator ek ev m a b -> Validator ek ev m b c -> Validator ek ev m a c instance Monad m => Category (Validator ek ev m) module Validations.Validation newtype Validation errors monad state newState Validation :: (state -> monad (newState, errors)) -> Validation errors monad state newState runValidation :: Validation errors monad state newState -> state -> monad (newState, errors) validation :: Monad m => Lens b s -> a -> Validator ek ev m a b -> Validation [(ek, ev)] m s s -- | Same as validation, but throws away validator result. This is -- useful for the side effects from a monadic validator. validation_ :: Monad m => a -> Validator ek ev m a b -> Validation [(ek, ev)] m s s composeValidation :: (Monad m, Monoid e) => Validation e m s t -> Validation e m t u -> Validation e m s u composeValidation' :: Monad m => (e -> f -> g) -> Validation e m s t -> Validation f m t u -> Validation g m s u instance (Monad m, Monoid e) => Category (Validation e m) module Validations.Adapters.Digestive validateView :: Monad m => (s -> Validation [(Text, e)] m t u) -> t -> (View e, Maybe s) -> m (View e, Maybe u) validateView' :: (Monad m, Monoid t) => (s -> Validation [(Text, e)] m t u) -> (View e, Maybe s) -> m (View e, Maybe u) testEnv :: Monad m => [(Text, Text)] -> FormEncType -> m (Env m) module Validations.Adapters module Validations.Internal module Validations.Types module Validations.Tutorial eitherToResult :: Either a b -> Result a b data User User :: Text -> Text -> Text -> User _firstName :: User -> Text _lastName :: User -> Text _emailAddress :: User -> Text notEmpty :: (Monoid a, Eq a) => a -> Either Text a startsWith :: Text -> Text -> Either Text Text confirms :: Eq a => a -> a -> Either Text a user :: Text -> Text -> Text -> Text -> Either Text User userForm :: Monad m => Form Text m User nonEmpty :: (Monoid a, Eq a) => Checker Text a a data Account Account :: Text -> Text -> Account _name :: Account -> Text _accountNumber :: Account -> Text name :: Lens Text Account accountNumber :: Lens Text Account nameField :: Text confirmNameField :: Text accountNumberField :: Text accountForm :: Monad m => Form Text m (Text, Text, Text) lengthIs :: Int -> Checker Text Text Text accountValidation :: Monad m => (Text, Text, Text) -> Validation [(Text, Text)] m Account Account posted :: Monad m => m (View Text, Maybe (Text, Text, Text)) validatedPosted :: Monad m => m (View Text, Maybe Account) instance Show User instance Show Account module Validations