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
#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
#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
#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
setFormFieldsTouchedBuilder :: Proxy xs -> Record row -> FromScratch to
Instances
SetFormFieldsTouched Nil row ()
(IsSymbol name, Cons name (FormField e i o) t0 row, SetFormFieldsTouched tail row from, Row1Cons name (FormField e i o) from to) => SetFormFieldsTouched (Cons name (FormField e i o) tail) row to
#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
formFieldsToInputFieldsBuilder :: Proxy xs -> Record row -> FromScratch to
Instances
FormFieldsToInputFields Nil row ()
(IsSymbol name, Cons name (FormField e i o) trash row, FormFieldsToInputFields tail row from, Row1Cons name (InputField e i o) from to) => FormFieldsToInputFields (Cons name (FormField e i o) tail) row to
#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
inputFieldsToFormFieldsBuilder :: Proxy xs -> Record row -> FromScratch to
Instances
InputFieldsToFormFields Nil row ()
(IsSymbol name, Cons name (InputField e i o) trash row, InputFieldsToFormFields tail row from, Row1Cons name (FormField e i o) from to) => InputFieldsToFormFields (Cons name (InputField e i o) tail) row to
#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
formFieldsToMaybeOutputBuilder :: Proxy xs -> Record row -> Maybe (FromScratch to)
Instances
FormFieldToMaybeOutput Nil row ()
(IsSymbol name, Cons name (FormField e i o) trash row, FormFieldToMaybeOutput tail row from, Row1Cons name (OutputField e i o) from to) => FormFieldToMaybeOutput (Cons name (FormField e i o) tail) row to
#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
countErrorsImpl :: Proxy rl -> Record r -> Int
Instances
CountErrors Nil r
(IsSymbol name, Cons name (FormField e i o) t0 r, CountErrors tail r) => CountErrors (Cons name (FormField e i o) tail) r
#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
allTouchedImpl :: Proxy rl -> Record r -> Boolean
Instances
AllTouched Nil r
(IsSymbol name, Cons name (FormField e i o) t0 r, AllTouched tail r) => AllTouched (Cons name (FormField e i o) tail) r
#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
validateAllBuilder :: Record vs -> Proxy xs -> Record row -> m (FromScratch to)
Instances
(Monad m) => ValidateAll vs Nil row () m
(IsSymbol name, Monad m, Cons name (FormField e i o) t0 row, Newtype (form Record FormField) (Record row), Cons name (Validation form m e i o) t1 vs, Row1Cons name (FormField e i o) from to, ValidateAll vs tail row from m) => ValidateAll vs (Cons name (FormField e i o) tail) row to m
#ModifyAll Source
class ModifyAll (ifs :: Row Type) (xs :: RowList Type) (fs :: Row Type) (to :: Row Type) | xs -> to where
Members
modifyAllBuilder :: Record ifs -> Proxy xs -> Record fs -> FromScratch to
Instances
ModifyAll ifs Nil fs ()
(IsSymbol name, Newtype (InputFunction e i o) (i -> i), Newtype (FormField e i o) (Record (FormFieldRow e i o)), Cons name (InputFunction e i o) trash0 ifs, Cons name (FormField e i o) trash1 row, Row1Cons name (FormField e i o) from to, ModifyAll ifs tail row from) => ModifyAll ifs (Cons name (FormField e i o) tail) row to
#ReplaceFormFieldInputs Source
class ReplaceFormFieldInputs (is :: Row Type) (xs :: RowList Type) (fs :: Row Type) (to :: Row Type) | xs -> to where
Members
replaceFormFieldInputsBuilder :: Record is -> Proxy xs -> Record fs -> FromScratch to
Instances
ReplaceFormFieldInputs is Nil fs ()
(IsSymbol name, Newtype (InputField e i o) i, Newtype (FormField e i o) (Record (FormFieldRow e i o)), Cons name (InputField e i o) trash0 is, Cons name (FormField e i o) trash1 row, Row1Cons name (FormField e i o) from to, ReplaceFormFieldInputs is tail row from) => ReplaceFormFieldInputs is (Cons name (FormField e i o) tail) row to
- Modules
- Formless
- Formless.
Action - Formless.
Class. Initial - Formless.
Component - Formless.
Data. FormFieldResult - Formless.
Internal. Component - Formless.
Internal. Debounce - Formless.
Internal. Transform - Formless.
Query - Formless.
Retrieve - Formless.
Transform. Record - Formless.
Transform. Row - Formless.
Types. Component - Formless.
Types. Form - Formless.
Validation