Module

Formless.Internal.Transform

#fromScratch

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

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

#FromScratch

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

Represents building some output record from an empty record

#Row1Cons

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

Instances

#allTouched

allTouched :: forall form fs fxs. 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

countErrors :: forall form fs fxs. 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

setFormFieldsTouched :: forall fxs form fs. 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

formFieldsToInputFields :: forall fxs form fs is. 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

inputFieldsToFormFields :: forall ixs form is fs. 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

formFieldsToMaybeOutputFields :: forall fxs form fs os. 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

replaceFormFieldInputs :: forall fxs form fs is. 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

modifyAll :: forall fxs form fs ifs. 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

validateAll :: forall vs fxs form fs m. 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

unsafeModifyInputVariant :: forall form x y. Newtype (form Variant InputFunction) (Variant x) => Newtype (form Record FormField) (Record y) => (forall e o. 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

unsafeRunValidationVariant :: forall form x y z m. 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) -> (form Record FormField))

#SetFormFieldsTouched

class SetFormFieldsTouched (xs :: RowList Type) (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

class FormFieldsToInputFields (xs :: RowList Type) (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

class InputFieldsToFormFields (xs :: RowList Type) (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

class FormFieldToMaybeOutput (xs :: RowList Type) (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

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

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

Members

Instances

#AllTouched

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

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

Members

Instances

#ValidateAll

class ValidateAll (vs :: Row Type) (xs :: RowList Type) (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

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

Members

Instances

#ReplaceFormFieldInputs

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

Members

Instances

Modules