Module

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

Instances

#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 => (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 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 => (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 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