Module

Formless.Validation

Package
purescript-formless-aj
Repository
ajnsit/purescript-formless-independent

#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

Instances

#runValidation Source

runValidation :: forall o i e m form. 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

#noValidation Source

noValidation :: forall xs vs m fields form. 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.

#hoistFn Source

hoistFn :: forall o i e m form. 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 o i e m form. Monad m => (i -> o) -> Validation form m e i o

Turn a function from (i -> o) into a proper Validation

#hoistFnE Source

hoistFnE :: forall o i e m form. Monad m => (form Record FormField -> i -> Either e o) -> Validation form m e i o

Turn a function from (form Record FormField -> i -> Either e o) into a proper Validation

#hoistFnE_ Source

hoistFnE_ :: forall o i e m form. 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 o i e m form. Monad m => (form Record FormField -> i -> m (Either e o)) -> Validation form m e i o

Turn a function from (form Record FormField -> i -> m (Either e o)) into a proper Validation

#hoistFnME_ Source

hoistFnME_ :: forall o i e m form. 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

#EmptyValidators Source

data EmptyValidators

The data type used for the noValidation function's heterogenous instance

Constructors

Instances

#Validations Source

type Validations form m = form Record (Validation form m)

A type synonym that represents a set of form validations that run in a particular monad.