Module

Formless.Internal.Transform

Package
purescript-halogen-formless
Repository
thomashoneyman/purescript-halogen-formless

#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

Instances

#allTouched Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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

Members

Instances

#ReplaceFormFieldInputs Source

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

Members

Instances