Formless.Validation
- Package
- purescript-halogen-formless
- Repository
- thomashoneyman/purescript-halogen-formless
#Validation Source
newtype Validation form m error input output
A wrapper to represent the validation function on a form field, which can itself take the form state as its first argument. Inspired in some parts by the Validation type from purescript-polyform by @paluh.
Constructors
Validation (form Record FormField -> input -> m (Either error output))
Instances
Newtype (Validation form m e i o) _
(Functor m) => Functor (Validation form m e i)
(Monad m) => Apply (Validation form m e i)
(Monad m) => Applicative (Validation form m e i)
(Monad m) => Alt (Validation form m e i)
(Semigroup (m (Either e o))) => Semigroup (Validation form m e i o)
(Applicative m, Monoid (m (Either e o)), Semigroup (m (Either e o))) => Monoid (Validation form m e i o)
(Monad m) => Semigroupoid (Validation form m e)
(Monad m) => Category (Validation form m e)
(Monad m) => Mapping EmptyValidators a (Validation form m e i i)
#runValidation Source
runValidation :: forall form m e i o. Monad m => Validation form m e i o -> form Record FormField -> i -> m (Either e o)
A more verbose but clearer function for running a validation function on its inputs
#hoistFn Source
hoistFn :: forall form m e i o. Monad m => (form Record FormField -> i -> o) -> Validation form m e i o
Turn a function from (form Record FormField -> i -> o) into a proper Validation
#hoistFn_ Source
hoistFn_ :: forall form m e i o. Monad m => (i -> o) -> Validation form m e i o
Turn a function from (i -> o) into a proper Validation
#hoistFnE_ Source
hoistFnE_ :: forall form m e i o. Monad m => (i -> Either e o) -> Validation form m e i o
Turn a function from (i -> Either e o) into a proper Validation
#hoistFnME_ Source
hoistFnME_ :: forall form m e i o. Monad m => (i -> m (Either e o)) -> Validation form m e i o
Turn a function from (i -> m (Either e o)) into a proper Validation
#noValidators Source
noValidators :: forall form fields m vs xs. Monad m => RowToList fields xs => Newtype (form Record (Validation form m)) (Record vs) => Newtype (form Record InputField) (Record fields) => MapRecordWithIndex xs (ConstMapping EmptyValidators) fields vs => form Record InputField -> form Record (Validation form m)
A function to create a record of validators that simply pass through all inputs
for when no validation is needed. Provide this as your validators
function.
#noValidation Source
noValidation :: forall form m e i. Monad m => Validation form m e i i
A validation function which simply passes through its input value as its output value. Use on individual fields which do not need any validation.
#EmptyValidators Source
data EmptyValidators
The data type used for the noValidation function's heterogenous instance
Constructors
Instances
(Monad m) => Mapping EmptyValidators a (Validation form m e i i)
The heterogeneous instance the noValidation function
- Modules
- Formless
- Formless.
Action - Formless.
Class. Initial - Formless.
Component - Formless.
Data. FormFieldResult - Formless.
Internal. Component - Formless.
Internal. Debounce - Formless.
Internal. Transform - Formless.
Query - Formless.
Retrieve - Formless.
Transform. Record - Formless.
Transform. Row - Formless.
Types. Component - Formless.
Types. Form - Formless.
Validation
The heterogeneous instance the noValidation function