Module

Formless.Internal.Transform

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

#fromScratch Source

fromScratch :: forall r. FromScratch r -> Record r

Apply a builder that produces an output record from an empty record

#FromScratch Source

type FromScratch r = Builder (Record ()) (Record r)

Represents building some output record from an empty record

#Row1Cons Source

class (Cons s t r r', Lacks s r) <= Row1Cons s t r r' | s t r -> r', s r' -> t r

A constraint synonym for Row.Cons and Row.Lacks

Instances

#allTouched Source

allTouched :: forall fxs fs form. RowToList fs fxs => AllTouched fxs fs => Newtype (form Record FormField) (Record fs) => form Record FormField -> Boolean

A helper function that will count all errors in a record

#countErrors Source

countErrors :: forall fxs fs form. RowToList fs fxs => CountErrors fxs fs => Newtype (form Record FormField) (Record fs) => form Record FormField -> Int

A helper function that will count all errors in a record

#setFormFieldsTouched Source

setFormFieldsTouched :: forall fs form fxs. RowToList fs fxs => SetFormFieldsTouched fxs fs fs => Newtype (form Record FormField) (Record fs) => form Record FormField -> form Record FormField

A helper function that will automatically transform a record of FormField(s) into just the input value

#formFieldsToInputFields Source

formFieldsToInputFields :: forall is fs form fxs. RowToList fs fxs => FormFieldsToInputFields fxs fs is => Newtype (form Record InputField) (Record is) => Newtype (form Record FormField) (Record fs) => form Record FormField -> form Record InputField

A helper function that will automatically transform a record of FormField(s) into just the input value

#inputFieldsToFormFields Source

inputFieldsToFormFields :: forall fs is form ixs. RowToList is ixs => InputFieldsToFormFields ixs is fs => Newtype (form Record InputField) (Record is) => Newtype (form Record FormField) (Record fs) => form Record InputField -> form Record FormField

A helper function that will automatically transform a record of FormSpec(s) into a record of FormField(s).

#formFieldsToMaybeOutputFields Source

formFieldsToMaybeOutputFields :: forall os fs form fxs. RowToList fs fxs => Newtype (form Record FormField) (Record fs) => Newtype (form Record OutputField) (Record os) => FormFieldToMaybeOutput fxs fs os => form Record FormField -> Maybe (form Record OutputField)

An intermediate function that transforms a record of FormField into a record

#replaceFormFieldInputs Source

replaceFormFieldInputs :: forall is fs form fxs. RowToList fs fxs => ReplaceFormFieldInputs is fxs fs fs => Newtype (form Record InputField) (Record is) => Newtype (form Record FormField) (Record fs) => form Record InputField -> form Record FormField -> form Record FormField

#modifyAll Source

modifyAll :: forall ifs fs form fxs. RowToList fs fxs => ModifyAll ifs fxs fs fs => Newtype (form Record InputFunction) (Record ifs) => Newtype (form Record FormField) (Record fs) => form Record InputFunction -> form Record FormField -> form Record FormField

#validateAll Source

validateAll :: forall m fs form fxs vs. RowToList fs fxs => Monad m => ValidateAll vs fxs fs fs m => Newtype (form Record (Validation form m)) (Record vs) => Newtype (form Record FormField) (Record fs) => form Record (Validation form m) -> form Record FormField -> m (form Record FormField)

#unsafeModifyInputVariant Source

unsafeModifyInputVariant :: forall y x form. Newtype (form Variant InputFunction) (Variant x) => Newtype (form Record FormField) (Record y) => (forall o e. FormFieldResult e o -> FormFieldResult e o) -> form Variant InputFunction -> form Record FormField -> form Record FormField

Given a variant of InputFunction and a record with the same labels but FormField values, replace the input of the form field. In addition, modify the form field result to represent whether async validation is going to occur.

#unsafeRunValidationVariant Source

unsafeRunValidationVariant :: forall m z y x form. Monad m => Newtype (form Variant U) (Variant x) => Newtype (form Record FormField) (Record y) => Newtype (form Record (Validation form m)) (Record z) => form Variant U -> form Record (Validation form m) -> form Record FormField -> m (form Record FormField)

#SetFormFieldsTouched Source

class SetFormFieldsTouched (xs :: RowList) (row :: Row Type) (to :: Row Type) | xs -> to where

The class that provides the Builder implementation to set all form fields touched

Members

Instances

#FormFieldsToInputFields Source

class FormFieldsToInputFields (xs :: RowList) (row :: Row Type) (to :: Row Type) | xs -> to where

The class that provides the Builder implementation to efficiently transform the record of FormField to record of InputField.

Members

Instances

#InputFieldsToFormFields Source

class InputFieldsToFormFields (xs :: RowList) (row :: Row Type) (to :: Row Type) | xs -> to where

The class that provides the Builder implementation to efficiently transform the record of InputField to record of FormField.

Members

Instances

#FormFieldToMaybeOutput Source

class FormFieldToMaybeOutput (xs :: RowList) (row :: Row Type) (to :: Row Type) | xs -> to where

The class that provides the Builder implementation to efficiently transform the record of MaybeOutput to a record of OutputField, but only if all fs were successfully validated.

Members

Instances

#CountErrors Source

class CountErrors (rl :: RowList) (r :: Row Type)  where

A class to check if all fs in an FormField record have been touched or not

Members

Instances

#AllTouched Source

class AllTouched (rl :: RowList) (r :: Row Type)  where

A class to check if all fs in an FormField record have been touched or not

Members

Instances

#ValidateAll Source

class ValidateAll (vs :: Row Type) (xs :: RowList) (row :: Row Type) (to :: Row Type) m | xs -> to where

A class that applies the current state to the unwrapped version of every validator

Members

Instances

#ModifyAll Source

class ModifyAll (ifs :: Row Type) (xs :: RowList) (fs :: Row Type) (to :: Row Type) | xs -> to where

Members

Instances

#ReplaceFormFieldInputs Source

class ReplaceFormFieldInputs (is :: Row Type) (xs :: RowList) (fs :: Row Type) (to :: Row Type) | xs -> to where

Members

Instances