Provides a way to package the fields, accessors, and business logic pertaining to a form behind a consistent interface.
Combines a way to get a value from a property on state and a way to modify that property's value.
type alias State =
{ count : Int
, name : String
}
countAccessor : Accessor State Int
countAccessor =
{ get = .count
, modify = \f state -> { state | count = f state.count }
}
nameAccessor : Accessor State String
nameAccessor =
{ get = .name
, modify = \f state -> { state | name = f state.name }
}Get the value of a property on the given form.
Set the value of a property on the given form.
Modify the value of a property on the given form.
Update the value of a property on the given form.
True if the form has errors. isInvalid form is equivalent to not (isValid form).
state: Typically a record containing fields and possibly other forms.accessors: Typically a record containing getters/setters and anything else that needs access to the state of the form.error: The errors produced by an invalid form.output: The data produced by a valid form.