edkelly303/elm-any-type-forms/1.0.0

NOTE: the latest version is 8.1.0

Control

Creating a form

type alias Control state delta output =
AdvancedControl output state delta output

A Control is the basic unit from which forms are composed. This library provides various example controls and combinators that you can use to build a form for any arbitrarily complex Elm type.

type alias Form state delta output msg =
{ init : State state
, initWith : output -> State state
, update : Delta delta -> State state -> ( State state, Cmd msg )
, view : State state -> Html msg
, submit :
State state
-> ( State state, Result (List ( String, String )) output )
}

A Form is an interface containing functions that you can use in your program to initialise, view, update and submit your form.

String
-> (Delta delta -> msg)
-> msg
-> Control state delta output
-> Form state delta output msg

Convert a Control into a Form by providing:

  1. A name/title for the form
  2. A Msg variant for updating the form
  3. A Msg variant for submitting the form
  4. The Control itself
type alias Msg
    = FormUpdated (Delta Int)
    | FormSubmitted

myForm =
    toForm "My Form" FormUpdated FormSubmitted int

Basic controls

bool : String -> String -> Control Bool Bool Bool

A control that produces a Boolean value. Renders as an HTML checkbox???

int : Control String String Int

A control that produces an integer. Renders as an HTML text input.

float : Control String String Float

A control that produces a floating-point number. Renders as an HTML text input.

string : Control String String String

A control that produces a string. Renders as an HTML text input.

( String, enum )
-> ( String, enum )
-> List ( String, enum )
-> Control enum enum enum

A control that produces a custom type where none of the variants have any payload. Renders as an HTML radio input.

type Colour
    = Red
    | Green
    | Blue


colourControl : Control Colour Colour Colour
colourControl =
    enum
        ( "Red", Red )
        [ ( "Green", Green )
        , ( "Blue", Blue )
        ]

Basic combinators

{ wrap : output -> wrapped
, unwrap : wrapped -> output
}
-> Control state delta output
-> Control ( State state, End ) ( Delta delta, End ) wrapped

A combinator that produces a wrapper type around a given type.

type Id
    = Id Int


idControl =
    wrapper Id (\(Id i) -> i) int
String
-> Control state1 delta1 output1
-> String
-> Control state2 delta2 output2
-> Control
( State state1, ( State state2, End ) )
( Delta delta1, ( Delta delta2, End ) )
( output1, output2 )

A combinator that produces a tuple of two controls of given types.

myTupleControl =
    tuple "First" string "Second" int
Control state delta output
-> Control
( State (), ( State ( State state, End ), End ) )
( Delta (), ( Delta ( Delta delta, End ), End ) )
(Maybe output)

A combinator that produces a Maybe of a control of a given type.

myMaybeControl =
    maybe int
Control state delta output
-> Control (List (State state)) (ListDelta delta) (List output)

A combinator that produces a List of controls of a given type.

myListControl =
    list int
String
-> Control keyState keyDelta comparable
-> String
-> Control valueState valueDelta value
-> Control
(List (State ( State keyState, ( State valueState, End ) )))
, End
)
( Delta (ListDelta ( Delta keyDelta, ( Delta valueDelta, End ) ))
, End
)
(Dict comparable value)

A combinator that produces a Dict from controls of given key and value types. The key type must be comparable.

myDictControl =
    dict "Key" int "Value" string

Creating a new control

type alias ControlConfig state delta output =
{ initEmpty : state
, initWith : output -> state
, update : delta -> state -> state
, view : state -> Html delta
, parse : state -> Result (List String) output
}

Configuration for a custom control. You need to supply the following fields:

  • initEmpty: a default initial "empty" value for the state of the control. For a control whose state is of type String, this might be "", for a number it might be 0.
  • initWith: a function that initialises the control's state from a value of the control's output type. For a control that outputs an Int, but whose state is a String, this might be String.fromInt.
  • update: a function that updates the state of the control based on its existing state and a delta type that it receives. This is exactly analogous to an Elm program's update function, where state = Model and delta = Msg.
  • view: a function that outputs Html delta based on the state of the control. This is exactly analogous to an Elm program's view function.
  • parse: a function that attempts to parse the control's state into its output type, producing a result. If parsing fails, it can provide a list of errors.
create : ControlConfig state delta output -> Control state delta output

Create a simple control, with any arbitrary state and delta types, and producing any arbitrary output type.

Here's how we could create a control like the famous counter example from the Elm Guide

type CounterDelta
    = Increment
    | Decrement


counterControl : Control Int CounterDelta Int
counterControl =
    create
        { initEmpty = 0
        , initWith = identity
        , parse = Ok
        , update =
            \delta state ->
                case delta of
                    Increment ->
                        state + 1


                    Decrement ->
                        state - 1
        , view =
            \state ->
                Html.div []
                    [ Html.button
                        [ Html.Attributes.type_ "button"
                        , Html.Events.onClick Increment
                        ]
                        [ Html.text "+" ]
                    , Html.div [] [ Html.text <| String.fromInt state ]
                    , Html.button
                        [ Html.Attributes.type_ "button"
                        , Html.Events.onClick Decrement
                        ]
                        [ Html.text "-" ]
                    ]
        }

Validating controls

Simple validation

(output -> Bool)
-> String
-> Control state delta output
-> Control state delta output

Display an error on a Control if its output fails to meet the predicate.

int
    |> failIf
        (\int_ -> int_ < 1)
        "Integer must be greater than zero!"

Multi-field validation

You may want display errors on one or more controls based on the validation of another control higher up the tree.

Take the example of a password creation form. You want to validate that the "Enter password" and "Confirm password" fields both contain the same string, and show helpful error messages on both fields if they don't. You can achieve this as follows:

passwordControl =
    record
        (\password confirmation ->
            { password = password
            , confirmation = confirmation
            }
        )
        |> field "Enter password"
            (string
                |> catchFlag
                    "flag-passwords-do-not-match"
                    "Must match 'Confirm password' field"
            )
        |> field "Confirm password"
            (string
                |> catchFlag
                    "flag-passwords-do-not-match"
                    "Must match 'Enter password' field"
            )
        |> end
        |> throwFlagIf
            (\{ password, confirmation } -> password /= confirmation)
            "flag-passwords-do-not-match"
(output -> Bool)
-> String
-> Control state delta output
-> Control state delta output

Throw a "flag" from a Control if its output fails to meet the predicate.

This is meant to be used in combination with catchFlag, which catches the "flag" and displays an error.

String
-> String
-> Control state delta output
-> Control state delta output

Catch a "flag" thrown by another Control and display an error on this control.

This is meant to be used in combination with throwFlagIf, which throws the "flag".

List validation

(output -> List Int)
-> String
-> Control (List state) (ListDelta delta) output
-> Control (List state) (ListDelta delta) output

Conditionally display an error on one or more items in a list control, based on the output of the list control.

The following example will display errors on the first two items in a list of strings, if and only if those first two items are "hello" and "world":

myString =
    string
        |> catchFlag
            "flag-hello-world"
            "The first two items in the list must not be \"hello\" and \"world\".")


list myString
    |> throwFlagsAt
        (\list_ ->
            case list of
                "hello" :: "world" :: _ -> [ 0, 1 ]


                _ -> []
        )
        "flag-hello-world"

Configuring controls

input
-> AdvancedControl input state delta output
-> AdvancedControl input state delta output

Initialise a Control using a value of the type that the Control outputs.

tuple "Int" int "String" string
    |> initWith ( 1, "hello" )
debounce : Float -> Control state delta output -> Control state delta output

Debounce a Control for a number of milliseconds before it will display any parsing or validation errors. This can be used to allow the user to finish typing into a text input before we show them feedback.

string
    |> debounce 500

Building record combinators

constructor
{ index : Int
, labels : List String
, toOutput : constructor
, fields : c -> d -> d
, states : e -> f -> f
, updater : g -> g
, viewer : h -> h
, parser : i -> i
, idleSetter : j -> j
, initialiser : k -> k
, before : l -> l
, befores : m -> m
, after : End
, afters : End
, makeSetters : n -> n
, flagEmitter : o -> o
, errorCollector : p -> p
, debouncingReceiverCollector : q -> q
}
cus

A combinator that produces a record type, or any 'product' type that needs to be constructed from multiple controls. (For example, the tuple combinator in this library is built using the record combinator).

type alias MyRecord =
    { name : String
    , age : Int
    }


myRecordControl =
    record
        (\name age ->
            { name = name
            , age = age
            }
        )
        |> field "Name" string
        |> field "Age" int
        |> end
String
-> c
-> AdvancedControl input state delta output
{ index : number
, labels : List String
, toOutput : b
, fields :
Path
-> ( { field : ControlFns input state delta output
, fromInput : c
, access : Access
}
, d
)
-> e
, states : Path -> ( State state, f ) -> g
, updater :
h
-> { newStates : restStates -> recordState0
, newCmds : List (Cmd recordDelta)
}
-> restFns
-> restDeltaSetters
-> restDeltas
-> restStates
-> { newStates : recordState1
, newCmds : List (Cmd recordDelta)
}
, viewer :
i
-> List (Html (Delta j))
-> List Flag
-> k
-> l
-> m
-> List (Html (Delta j))
, parser :
n
-> Result (List ( String, String )) output1
-> o
-> p
-> Result (List ( String, String )) output2
, idleSetter : q -> r -> s -> s
, initialiser : t -> recordInput -> u -> v
, before : ( Delta w, x ) -> y
, befores : ( ( Delta w, x ) -> y, z ) -> a1
, after : b1
, afters : c1
, makeSetters : d1 -> befores -> afters -> next
, flagEmitter : e1 -> List Flag -> f1 -> g1 -> List Flag
, errorCollector :
h1
-> List Flag
-> List ( String, String )
-> i1
-> j1
-> List ( String, String )
, debouncingReceiverCollector : k1 -> List Flag -> l1 -> m1 -> List Flag
}
n1
{ index : number
, labels : List String
, toOutput : b
, fields : Path -> d -> e
, states : Path -> f -> g
, updater :
h
-> { newStates : ( State o1, restStates ) -> recordState0
, newCmds : List (Cmd recordDelta)
}
-> ( RecordFns p1 o1 q1 r1 recordOutput, restFns )
-> ( Delta q1 -> recordDelta, restDeltaSetters )
-> ( Delta q1, restDeltas )
-> ( State o1, restStates )
-> { newStates : recordState1
, newCmds : List (Cmd recordDelta)
}
, viewer :
i
-> List (Html (Delta j))
-> List Flag
-> ( RecordFns s1 t1 u1 v1 w1, k )
-> ( Delta u1 -> j, l )
-> ( State t1, m )
-> List (Html (Delta j))
, parser :
n
-> Result (List ( String, String )) (output0 -> output1)
-> ( RecordFns x1 y1 z1 output0 a2, o )
-> ( State y1, p )
-> Result (List ( String, String )) output2
, idleSetter :
q
-> ( RecordFns b2 c2 d2 e2 f2, r )
-> ( State c2, s )
-> ( State c2, s )
, initialiser :
t
-> recordInput
-> ( RecordFns g2 h2 i2 g2 recordInput, u )
-> ( State h2, v )
, before : x -> y
, befores : z -> a1
, after : ( Delta j2, b1 )
, afters : ( b1, c1 )
, makeSetters :
d1
-> ( ( value, after ) -> k2, befores )
-> ( after, afters )
-> ( value -> k2, next )
, flagEmitter :
e1
-> List Flag
-> ( RecordFns l2 m2 n2 o2 p2, f1 )
-> ( State m2, g1 )
-> List Flag
, errorCollector :
h1
-> List Flag
-> List ( String, String )
-> ( RecordFns q2 r2 s2 t2 u2, i1 )
-> ( State r2, j1 )
-> List ( String, String )
, debouncingReceiverCollector :
k1
-> List Flag
-> ( RecordFns v2 w2 x2 y2 z2, l1 )
-> ( State w2, m1 )
-> List Flag
}
n1

Add a field to a record combinator.

type alias Hello =
    { hello : String }


helloControl =
    record Hello
        |> field "Hello" string
        |> end
String
-> c
-> AdvancedControl input state delta output
{ index : number
, labels : List String
, toOutput : b
, fields :
Path
-> ( { field : ControlFns input state delta output
, fromInput : c
, access : Access
}
, d
)
-> e
, states : Path -> ( State state, f ) -> g
, updater :
h
-> { newStates : restStates -> recordState0
, newCmds : List (Cmd recordDelta)
}
-> restFns
-> restDeltaSetters
-> restDeltas
-> restStates
-> { newStates : recordState1
, newCmds : List (Cmd recordDelta)
}
, viewer :
i
-> List (Html (Delta j))
-> List Flag
-> k
-> l
-> m
-> List (Html (Delta j))
, parser :
n
-> Result (List ( String, String )) output1
-> o
-> p
-> Result (List ( String, String )) output2
, idleSetter : q -> r -> s -> s
, initialiser : t -> recordInput -> u -> v
, before : ( Delta w, x ) -> y
, befores : ( ( Delta w, x ) -> y, z ) -> a1
, after : b1
, afters : c1
, makeSetters : d1 -> befores -> afters -> next
, flagEmitter : e1 -> List Flag -> f1 -> g1 -> List Flag
, errorCollector :
h1
-> List Flag
-> List ( String, String )
-> i1
-> j1
-> List ( String, String )
, debouncingReceiverCollector : k1 -> List Flag -> l1 -> m1 -> List Flag
}
n1
{ index : number
, labels : List String
, toOutput : b
, fields : Path -> d -> e
, states : Path -> f -> g
, updater :
h
-> { newStates : ( State o1, restStates ) -> recordState0
, newCmds : List (Cmd recordDelta)
}
-> ( RecordFns p1 o1 q1 r1 recordOutput, restFns )
-> ( Delta q1 -> recordDelta, restDeltaSetters )
-> ( Delta q1, restDeltas )
-> ( State o1, restStates )
-> { newStates : recordState1
, newCmds : List (Cmd recordDelta)
}
, viewer :
i
-> List (Html (Delta j))
-> List Flag
-> ( RecordFns s1 t1 u1 v1 w1, k )
-> ( Delta u1 -> j, l )
-> ( State t1, m )
-> List (Html (Delta j))
, parser :
n
-> Result (List ( String, String )) (output0 -> output1)
-> ( RecordFns x1 y1 z1 output0 a2, o )
-> ( State y1, p )
-> Result (List ( String, String )) output2
, idleSetter :
q
-> ( RecordFns b2 c2 d2 e2 f2, r )
-> ( State c2, s )
-> ( State c2, s )
, initialiser :
t
-> recordInput
-> ( RecordFns g2 h2 i2 g2 recordInput, u )
-> ( State h2, v )
, before : x -> y
, befores : z -> a1
, after : ( Delta j2, b1 )
, afters : ( b1, c1 )
, makeSetters :
d1
-> ( ( value, after ) -> k2, befores )
-> ( after, afters )
-> ( value -> k2, next )
, flagEmitter :
e1
-> List Flag
-> ( RecordFns l2 m2 n2 o2 p2, f1 )
-> ( State m2, g1 )
-> List Flag
, errorCollector :
h1
-> List Flag
-> List ( String, String )
-> ( RecordFns q2 r2 s2 t2 u2, i1 )
-> ( State r2, j1 )
-> List ( String, String )
, debouncingReceiverCollector :
k1
-> List Flag
-> ( RecordFns v2 w2 x2 y2 z2, l1 )
-> ( State w2, m1 )
-> List Flag
}
n1

Add a hidden field to a record combinator.

type alias Hello =
    { hello : String }


helloControl =
    record Hello
        |> hiddenField "Hello" string
        |> end
String
-> c
-> AdvancedControl input state delta output
{ index : number
, labels : List String
, toOutput : b
, fields :
Path
-> ( { field : ControlFns input state delta output
, fromInput : c
, access : Access
}
, d
)
-> e
, states : Path -> ( State state, f ) -> g
, updater :
h
-> { newStates : restStates -> recordState0
, newCmds : List (Cmd recordDelta)
}
-> restFns
-> restDeltaSetters
-> restDeltas
-> restStates
-> { newStates : recordState1
, newCmds : List (Cmd recordDelta)
}
, viewer :
i
-> List (Html (Delta j))
-> List Flag
-> k
-> l
-> m
-> List (Html (Delta j))
, parser :
n
-> Result (List ( String, String )) output1
-> o
-> p
-> Result (List ( String, String )) output2
, idleSetter : q -> r -> s -> s
, initialiser : t -> recordInput -> u -> v
, before : ( Delta w, x ) -> y
, befores : ( ( Delta w, x ) -> y, z ) -> a1
, after : b1
, afters : c1
, makeSetters : d1 -> befores -> afters -> next
, flagEmitter : e1 -> List Flag -> f1 -> g1 -> List Flag
, errorCollector :
h1
-> List Flag
-> List ( String, String )
-> i1
-> j1
-> List ( String, String )
, debouncingReceiverCollector : k1 -> List Flag -> l1 -> m1 -> List Flag
}
n1
{ index : number
, labels : List String
, toOutput : b
, fields : Path -> d -> e
, states : Path -> f -> g
, updater :
h
-> { newStates : ( State o1, restStates ) -> recordState0
, newCmds : List (Cmd recordDelta)
}
-> ( RecordFns p1 o1 q1 r1 recordOutput, restFns )
-> ( Delta q1 -> recordDelta, restDeltaSetters )
-> ( Delta q1, restDeltas )
-> ( State o1, restStates )
-> { newStates : recordState1
, newCmds : List (Cmd recordDelta)
}
, viewer :
i
-> List (Html (Delta j))
-> List Flag
-> ( RecordFns s1 t1 u1 v1 w1, k )
-> ( Delta u1 -> j, l )
-> ( State t1, m )
-> List (Html (Delta j))
, parser :
n
-> Result (List ( String, String )) (output0 -> output1)
-> ( RecordFns x1 y1 z1 output0 a2, o )
-> ( State y1, p )
-> Result (List ( String, String )) output2
, idleSetter :
q
-> ( RecordFns b2 c2 d2 e2 f2, r )
-> ( State c2, s )
-> ( State c2, s )
, initialiser :
t
-> recordInput
-> ( RecordFns g2 h2 i2 g2 recordInput, u )
-> ( State h2, v )
, before : x -> y
, befores : z -> a1
, after : ( Delta j2, b1 )
, afters : ( b1, c1 )
, makeSetters :
d1
-> ( ( value, after ) -> k2, befores )
-> ( after, afters )
-> ( value -> k2, next )
, flagEmitter :
e1
-> List Flag
-> ( RecordFns l2 m2 n2 o2 p2, f1 )
-> ( State m2, g1 )
-> List Flag
, errorCollector :
h1
-> List Flag
-> List ( String, String )
-> ( RecordFns q2 r2 s2 t2 u2, i1 )
-> ( State r2, j1 )
-> List ( String, String )
, debouncingReceiverCollector :
k1
-> List Flag
-> ( RecordFns v2 w2 x2 y2 z2, l1 )
-> ( State w2, m1 )
-> List Flag
}
n1

Add a read-only field to a record combinator.

type alias Hello =
    { hello : String }


helloControl =
    record Hello
        |> readOnlyfield "Hello" string
        |> end
end :
{ d
| afters : afters1
, befores : End -> befores1
, fields :
Path
-> End
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
, flagEmitter :
(List Flag -> End -> End -> List Flag)
-> List Flag
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( State state, restStates )
-> List Flag
, errorCollector :
( List Flag
-> List ( String, String )
-> End
-> End
-> List ( String, String )
)
-> List Flag
-> List ( String, String )
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( State state, restStates )
-> List ( String, String )
, idleSetter :
(End -> End -> End)
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( State state, restStates )
-> ( State state, restStates )
, initialiser :
(input -> End -> End)
-> input
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( State state, restStates )
, labels : List String
, makeSetters :
(End -> End -> End)
-> befores1
-> afters1
-> ( Delta delta -> recordDelta, restDeltaSetters )
, parser :
( Result (List ( String, String )) output
-> End
-> End
-> Result (List ( String, String )) output
)
-> Result (List ( String, String )) output1_1
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( State state, restStates )
-> Result (List ( String, String )) output
, debouncingReceiverCollector :
(List Flag -> End -> End -> List Flag)
-> List Flag
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( State state, restStates )
-> List Flag
, states : Path -> End -> ( State state, restStates )
, toOutput : output1_1
, updater :
( { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates : End -> ( State state, restStates )
}
-> End
-> End
-> End
-> End
-> { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates : End -> ( State state, restStates )
}
)
-> { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates :
( State state, restStates ) -> ( State state, restStates )
}
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state, restStates )
-> { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates : End -> ( State state, restStates )
}
, viewer :
( List (Html (Delta ( Delta delta, restDeltas )))
-> List Flag
-> End
-> End
-> End
-> List (Html (Delta ( Delta delta, restDeltas )))
)
-> List (Html (Delta ( Delta delta, restDeltas )))
-> List Flag
-> ( RecordFns input2 state delta output2 recordOutput, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( State state, restStates )
-> List (Html (Delta ( Delta delta, restDeltas )))
}
{ e
| applyInputs :
(state1 -> End -> state1)
-> (stateSetter -> state0)
-> ( stateSetter, restStateSetters )
-> input
-> State ( State state, restStates )
, deltaAfters : afters
, deltaBefores : End -> befores
, destructor : stateSetter -> state0
, flagEmitter :
(List Flag -> Int -> End -> End -> List Flag)
-> List Flag
-> Int
-> ( ControlFns input1 state delta output1, restFns )
-> ( State state, restStates )
-> List Flag
, errorCollector :
( List Flag
-> List ( String, String )
-> End
-> End
-> List ( String, String )
)
-> List Flag
-> List ( String, String )
-> ( ControlFns input1 state delta output1, restFns )
-> ( State state, restStates )
-> List ( String, String )
, fns :
Path -> End -> ( ControlFns input1 state delta output1, restFns )
, idleSetter :
(Int -> End -> End -> End)
-> Int
-> ( ControlFns input1 state delta output1, restFns )
-> ( State state, restStates )
-> ( State state, restStates )
, labels : List String
, makeDeltaSetters :
(End -> End -> End)
-> befores
-> afters
-> ( Delta delta -> ( Delta delta, restDeltas ), restSetters )
, makeStateSetters :
(a1 -> b1 -> End -> End -> End -> End -> End)
-> c
-> ( State state, restStates )
-> ( ControlFns input1 state delta output1, restFns )
-> f
-> g
-> h
-> ( stateSetter, restStateSetters )
, parser :
(a -> b -> End -> End -> a)
-> Result (List ( String, String )) value
-> Int
-> ( ControlFns input1 state delta output1, restFns )
-> ( State state, restStates )
-> Result (List ( String, String )) output
, debouncingReceiverCollector :
(List Flag -> End -> End -> List Flag)
-> List Flag
-> ( ControlFns input1 state delta output1, restFns )
-> ( State state, restStates )
-> List Flag
, stateAfters : h
, stateBefores : End -> g
, stateInserter : c
, states : Path -> End -> ( State state, restStates )
, toArgStates : End -> f
, updater :
( { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates : End -> ( State state, restStates )
}
-> End
-> End
-> End
-> End
-> { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates : End -> ( State state, restStates )
}
)
-> { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates :
( State state, restStates ) -> ( State state, restStates )
}
-> ( ControlFns input1 state delta output1, restFns )
-> ( Delta delta -> ( Delta delta, restDeltas ), restSetters )
-> ( Delta delta, restDeltas )
-> ( State state, restStates )
-> { newCmds : List (Cmd ( Delta delta, restDeltas ))
, newStates : End -> ( State state, restStates )
}
, viewer :
( Maybe (Html ( Delta delta, restDeltas ))
-> List Flag
-> Int
-> End
-> End
-> End
-> Maybe (Html ( Delta delta, restDeltas ))
)
-> Maybe (Html ( Delta delta, restDeltas ))
-> List Flag
-> Int
-> ( ControlFns input1 state delta output1, restFns )
-> ( Delta delta -> ( Delta delta, restDeltas ), restSetters )
-> ( State state, restStates )
-> Maybe (Html ( Delta delta, restDeltas ))
}
input
( State state, restStates )
( Delta delta, restDeltas )
output

Finalise the construction of a record or customType combinator.

type alias Hello =
    { hello : String }


helloControl =
    record Hello
        |> field "Hello" string
        |> end
( List (Html (Delta delta))
-> ViewConfig state
-> Html (Delta delta)
)
-> Control state delta output
-> Control state delta output

Change the layout of the fields of a record control.

type alias MyRecord =
    { name : String
    , age : Int
    }


myRecordControl =
    record
        (\name age ->
            { name = name
            , age = age
            }
        )
        |> field "Name" string
        |> field "Age" int
        |> end
        |> layout (\fieldViews config -> Html.div [] fieldViews)

Building custom type combinators

b
r
{ applyInputs : a15 -> a15
, deltaAfter : End
, deltaAfters : End
, deltaBefore : a14 -> a14
, deltaBefores : a13 -> a13
, destructor : b
, flagEmitter : a12 -> a12
, errorCollector : a11 -> a11
, fns : c -> d -> d
, idleSetter : a10 -> a10
, index : number
, labels : List e
, makeDeltaSetters : a9 -> a9
, makeStateSetters : a8 -> a8
, parser : a7 -> a7
, debouncingReceiverCollector : a6 -> a6
, stateAfter : End
, stateAfters : End
, stateBefore : a5 -> a5
, stateBefores : a4 -> a4
, stateInserter : a3 -> a3
, states : f -> g -> g
, toArgStates : a2 -> a2
, updater : a1 -> a1
, viewer : a -> a
}

A combinator that produces a custom type.

type MyCustomType
    = NoArgs
    | OneArg String
    | TwoArgs Int Float


myCustomTypeControl =
    customType
        (\noArgs oneArg twoArgs tag ->
            case tag of
                NoArgs ->
                    noArgs


                OneArg arg1 ->
                    oneArg arg1


                TwoArgs arg1 arg2 ->
                    TwoArgs arg1 arg2
        )
        |> tag0 "NoArgs" NoArgs
        |> tag1 "OneArg" OneArg string
        |> tag2 "TwoArgs" TwoArgs int float
        |> end
String
-> output8
rec
{ applyInputs : a18 -> state0 -> restStateSetters1 -> state1_1
, debouncingReceiverCollector :
a17 -> List Flag -> restFns7 -> restStates6 -> List Flag
, deltaAfter : b
, deltaAfters : d
, deltaBefore : ( Delta delta10, a16 ) -> c7
, deltaBefores : ( ( Delta delta10, a16 ) -> c7, a15 ) -> c6
, destructor : e
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> restFns6
-> restStates5
-> List ( String, String )
, flagEmitter :
a13 -> List Flag -> Int -> restFns5 -> restStates4 -> List Flag
, fns :
Path
-> ( { baseUpdate :
Float -> Delta () -> State () -> ( State (), Cmd (Delta ()) )
, childViews : ViewConfig () -> List (Html (Delta ()))
, collectDebouncingReceivers : State () -> List Flag
, collectErrors : State () -> List Flag -> List ( String, String )
, delta : Delta ()
, emitFlags : State () -> List Flag
, index : Int
, init : State ()
, initWith : output8 -> State ()
, parse : State () -> Result (List ( String, String )) output8
, path : Path
, receiverCount : List Flag
, setAllIdle : State () -> State ()
, update : Delta () -> State () -> ( State (), Cmd (Delta ()) )
, view : ViewConfig () -> Html (Delta ())
}
, a12
)
-> c5
, idleSetter : a11 -> Int -> restFns4 -> restStates3 -> restStates3
, index : Int
, labels : List String
, makeDeltaSetters : a10 -> befores1 -> afters1 -> next
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> restFns3
-> restToArgStates
-> befores
-> afters
-> restStateSetters
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> restFns2
-> restStates2
-> Result (List ( String, String )) output2
, stateAfter : f
, stateAfters : g
, stateBefore : ( Maybe a19, a6 ) -> c3
, stateBefores : ( ( Maybe a19, a6 ) -> c3, a5 ) -> c2
, stateInserter :
a4
-> Int
-> Int
-> (restArgStates -> tagStates)
-> restMaybeArgStates
-> restArgStates
-> State tagStates
, states : Path -> ( State (), a3 ) -> c1
, toArgStates : ( (output8 -> h) -> h, a2 ) -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : restStates1 -> recordState0
}
-> restFns1
-> restDeltaSetters
-> restDeltas
-> restStates1
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> restFns
-> restSetters
-> restStates
-> Maybe (Html delta1)
}
rec
{ applyInputs :
a18
-> (stateSetter1 -> state0)
-> ( stateSetter1, restStateSetters1 )
-> state1_1
, debouncingReceiverCollector :
a17
-> List Flag
-> ( ControlFns input6 state7 delta9 output7, restFns7 )
-> ( State state7, restStates6 )
-> List Flag
, deltaAfter : ( Delta delta8, b )
, deltaAfters : ( b, d )
, deltaBefore : a16 -> c7
, deltaBefores : a15 -> c6
, destructor : e
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> ( ControlFns input5 state6 delta7 output6, restFns6 )
-> ( State state6, restStates5 )
-> List ( String, String )
, flagEmitter :
a13
-> List Flag
-> Int
-> ( ControlFns input4 state5 delta6 output5, restFns5 )
-> ( State state5, restStates4 )
-> List Flag
, fns : Path -> a12 -> c5
, idleSetter :
a11
-> Int
-> ( ControlFns input3 state4 delta5 output4, restFns4 )
-> ( State state4, restStates3 )
-> ( State state4, restStates3 )
, index : Int
, labels : List String
, makeDeltaSetters :
a10
-> ( ( value, after1 ) -> delta4, befores1 )
-> ( after1, afters1 )
-> ( value -> delta4, next )
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> ( ControlFns fieldInput fieldState delta3 output3, restFns3 )
-> ( (fieldInput -> State tagStates1) -> stateSetter
, restToArgStates
)
-> ( ( Maybe (State fieldState), after )
-> ( Maybe (State argState1), restMaybeArgStates1 )
, befores
)
-> ( after, afters )
-> ( stateSetter, restStateSetters )
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> ( ControlFns input2 state2 delta2 output2, restFns2 )
-> ( State state2, restStates2 )
-> Result (List ( String, String )) output2
, stateAfter : ( Maybe a7, f )
, stateAfters : ( f, g )
, stateBefore : a6 -> c3
, stateBefores : a5 -> c2
, stateInserter :
a4
-> Int
-> Int
-> (( State argState, restArgStates ) -> tagStates)
-> ( Maybe (State argState), restMaybeArgStates )
-> ( State argState, restArgStates )
-> State tagStates
, states : Path -> a3 -> c1
, toArgStates : a2 -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : ( State state1, restStates1 ) -> recordState0
}
-> ( ControlFns input1 state1 delta output1, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state1, restStates1 )
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> ( ControlFns input state delta0 output, restFns )
-> ( Delta delta0 -> delta1, restSetters )
-> ( State state, restStates )
-> Maybe (Html delta1)
}

Add a tag with no arguments to a custom type.

type Unit
    = Unit


unitControl =
    customType
        (\unit tag ->
            case tag of
                Unit ->
                    unit
        )
        |> tag0 "Unit"
        |> end
String
-> (output9 -> output8)
-> AdvancedControl output9 state8 delta10 output9
r
{ applyInputs : a18 -> state0 -> restStateSetters1 -> state1_1
, debouncingReceiverCollector :
a17 -> List Flag -> restFns7 -> restStates6 -> List Flag
, deltaAfter : d
, deltaAfters : e
, deltaBefore : ( Delta delta11, a16 ) -> c7
, deltaBefores : ( ( Delta delta11, a16 ) -> c7, a15 ) -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> restFns6
-> restStates5
-> List ( String, String )
, flagEmitter :
a13 -> List Flag -> Int -> restFns5 -> restStates4 -> List Flag
, fns :
Path
-> ( { baseUpdate :
Float
-> Delta ( Delta delta10, End )
-> State ( State state8, End )
-> ( State ( State state8, End )
, Cmd (Delta ( Delta delta10, End ))
)
, childViews :
ViewConfig ( State state8, End )
-> List (Html (Delta ( Delta delta10, End )))
, collectDebouncingReceivers :
State ( State state8, End ) -> List Flag
, collectErrors :
State ( State state8, End ) -> List Flag -> List ( String, String )
, delta : Delta ( Delta delta10, End )
, emitFlags : State ( State state8, End ) -> List Flag
, index : Int
, init : State ( State state8, End )
, initWith : ( output9, b ) -> State ( State state8, End )
, parse :
State ( State state8, End )
-> Result (List ( String, String )) output8
, path : Path
, receiverCount : List Flag
, setAllIdle :
State ( State state8, End ) -> State ( State state8, End )
, update :
Delta ( Delta delta10, End )
-> State ( State state8, End )
-> ( State ( State state8, End )
, Cmd (Delta ( Delta delta10, End ))
)
, view :
ViewConfig ( State state8, End )
-> Html (Delta ( Delta delta10, End ))
}
, a12
)
-> c5
, idleSetter : a11 -> Int -> restFns4 -> restStates3 -> restStates3
, index : Int
, labels : List String
, makeDeltaSetters : a10 -> befores1 -> afters1 -> next
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> restFns3
-> restToArgStates
-> befores
-> afters
-> restStateSetters
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> restFns2
-> restStates2
-> Result (List ( String, String )) output2
, stateAfter : g
, stateAfters : h
, stateBefore : ( Maybe a19, a6 ) -> c3
, stateBefores : ( ( Maybe a19, a6 ) -> c3, a5 ) -> c2
, stateInserter :
a4
-> Int
-> Int
-> (restArgStates -> tagStates)
-> restMaybeArgStates
-> restArgStates
-> State tagStates
, states : Path -> ( State ( State state8, End ), a3 ) -> c1
, toArgStates : ( (( i, End ) -> j) -> i -> j, a2 ) -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : restStates1 -> recordState0
}
-> restFns1
-> restDeltaSetters
-> restDeltas
-> restStates1
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> restFns
-> restSetters
-> restStates
-> Maybe (Html delta1)
}
r
{ applyInputs :
a18
-> (stateSetter1 -> state0)
-> ( stateSetter1, restStateSetters1 )
-> state1_1
, debouncingReceiverCollector :
a17
-> List Flag
-> ( ControlFns input6 state7 delta9 output7, restFns7 )
-> ( State state7, restStates6 )
-> List Flag
, deltaAfter : ( Delta delta8, d )
, deltaAfters : ( d, e )
, deltaBefore : a16 -> c7
, deltaBefores : a15 -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> ( ControlFns input5 state6 delta7 output6, restFns6 )
-> ( State state6, restStates5 )
-> List ( String, String )
, flagEmitter :
a13
-> List Flag
-> Int
-> ( ControlFns input4 state5 delta6 output5, restFns5 )
-> ( State state5, restStates4 )
-> List Flag
, fns : Path -> a12 -> c5
, idleSetter :
a11
-> Int
-> ( ControlFns input3 state4 delta5 output4, restFns4 )
-> ( State state4, restStates3 )
-> ( State state4, restStates3 )
, index : Int
, labels : List String
, makeDeltaSetters :
a10
-> ( ( value, after1 ) -> delta4, befores1 )
-> ( after1, afters1 )
-> ( value -> delta4, next )
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> ( ControlFns fieldInput fieldState delta3 output3, restFns3 )
-> ( (fieldInput -> State tagStates1) -> stateSetter
, restToArgStates
)
-> ( ( Maybe (State fieldState), after )
-> ( Maybe (State argState1), restMaybeArgStates1 )
, befores
)
-> ( after, afters )
-> ( stateSetter, restStateSetters )
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> ( ControlFns input2 state2 delta2 output2, restFns2 )
-> ( State state2, restStates2 )
-> Result (List ( String, String )) output2
, stateAfter : ( Maybe a7, g )
, stateAfters : ( g, h )
, stateBefore : a6 -> c3
, stateBefores : a5 -> c2
, stateInserter :
a4
-> Int
-> Int
-> (( State argState, restArgStates ) -> tagStates)
-> ( Maybe (State argState), restMaybeArgStates )
-> ( State argState, restArgStates )
-> State tagStates
, states : Path -> a3 -> c1
, toArgStates : a2 -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : ( State state1, restStates1 ) -> recordState0
}
-> ( ControlFns input1 state1 delta output1, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state1, restStates1 )
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> ( ControlFns input state delta0 output, restFns )
-> ( Delta delta0 -> delta1, restSetters )
-> ( State state, restStates )
-> Maybe (Html delta1)
}

Add a tag with one argument to a custom type.

type alias MyResult =
    Result String Int


myResultControl =
    customType
        (\ok err tag ->
            case tag of
                Ok value ->
                    ok value


                Err error ->
                    err error
        )
        |> tag1 "Ok" Ok int
        |> tag1 "Err" Err string
        |> end
String
-> (output10 -> output9 -> output8)
-> ( String, AdvancedControl output10 state9 delta11 output10 )
-> ( String, AdvancedControl output9 state8 delta10 output9 )
r
{ applyInputs : a18 -> state0 -> restStateSetters1 -> state1_1
, debouncingReceiverCollector :
a17 -> List Flag -> restFns7 -> restStates6 -> List Flag
, deltaAfter : d
, deltaAfters : e
, deltaBefore : ( Delta delta12, a16 ) -> c7
, deltaBefores : ( ( Delta delta12, a16 ) -> c7, a15 ) -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> restFns6
-> restStates5
-> List ( String, String )
, flagEmitter :
a13 -> List Flag -> Int -> restFns5 -> restStates4 -> List Flag
, fns :
Path
-> ( { baseUpdate :
Float
-> Delta ( Delta delta11, ( Delta delta10, End ) )
-> State ( State state9, ( State state8, End ) )
-> ( State ( State state9, ( State state8, End ) )
, Cmd (Delta ( Delta delta11, ( Delta delta10, End ) ))
)
, childViews :
ViewConfig ( State state9, ( State state8, End ) )
-> List (Html (Delta ( Delta delta11, ( Delta delta10, End ) )))
, collectDebouncingReceivers :
State ( State state9, ( State state8, End ) ) -> List Flag
, collectErrors :
State ( State state9, ( State state8, End ) )
-> List Flag
-> List ( String, String )
, delta : Delta ( Delta delta11, ( Delta delta10, End ) )
, emitFlags :
State ( State state9, ( State state8, End ) ) -> List Flag
, index : Int
, init : State ( State state9, ( State state8, End ) )
, initWith :
( output10, ( output9, b ) )
-> State ( State state9, ( State state8, End ) )
, parse :
State ( State state9, ( State state8, End ) )
-> Result (List ( String, String )) output8
, path : Path
, receiverCount : List Flag
, setAllIdle :
State ( State state9, ( State state8, End ) )
-> State ( State state9, ( State state8, End ) )
, update :
Delta ( Delta delta11, ( Delta delta10, End ) )
-> State ( State state9, ( State state8, End ) )
-> ( State ( State state9, ( State state8, End ) )
, Cmd (Delta ( Delta delta11, ( Delta delta10, End ) ))
)
, view :
ViewConfig ( State state9, ( State state8, End ) )
-> Html (Delta ( Delta delta11, ( Delta delta10, End ) ))
}
, a12
)
-> c5
, idleSetter : a11 -> Int -> restFns4 -> restStates3 -> restStates3
, index : Int
, labels : List String
, makeDeltaSetters : a10 -> befores1 -> afters1 -> next
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> restFns3
-> restToArgStates
-> befores
-> afters
-> restStateSetters
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> restFns2
-> restStates2
-> Result (List ( String, String )) output2
, stateAfter : g
, stateAfters : h
, stateBefore : ( Maybe a19, a6 ) -> c3
, stateBefores : ( ( Maybe a19, a6 ) -> c3, a5 ) -> c2
, stateInserter :
a4
-> Int
-> Int
-> (restArgStates -> tagStates)
-> restMaybeArgStates
-> restArgStates
-> State tagStates
, states :
Path -> ( State ( State state9, ( State state8, End ) ), a3 ) -> c1
, toArgStates : ( (( i, ( j, End ) ) -> k) -> i -> j -> k, a2 ) -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : restStates1 -> recordState0
}
-> restFns1
-> restDeltaSetters
-> restDeltas
-> restStates1
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> restFns
-> restSetters
-> restStates
-> Maybe (Html delta1)
}
r
{ applyInputs :
a18
-> (stateSetter1 -> state0)
-> ( stateSetter1, restStateSetters1 )
-> state1_1
, debouncingReceiverCollector :
a17
-> List Flag
-> ( ControlFns input6 state7 delta9 output7, restFns7 )
-> ( State state7, restStates6 )
-> List Flag
, deltaAfter : ( Delta delta8, d )
, deltaAfters : ( d, e )
, deltaBefore : a16 -> c7
, deltaBefores : a15 -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> ( ControlFns input5 state6 delta7 output6, restFns6 )
-> ( State state6, restStates5 )
-> List ( String, String )
, flagEmitter :
a13
-> List Flag
-> Int
-> ( ControlFns input4 state5 delta6 output5, restFns5 )
-> ( State state5, restStates4 )
-> List Flag
, fns : Path -> a12 -> c5
, idleSetter :
a11
-> Int
-> ( ControlFns input3 state4 delta5 output4, restFns4 )
-> ( State state4, restStates3 )
-> ( State state4, restStates3 )
, index : Int
, labels : List String
, makeDeltaSetters :
a10
-> ( ( value, after1 ) -> delta4, befores1 )
-> ( after1, afters1 )
-> ( value -> delta4, next )
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> ( ControlFns fieldInput fieldState delta3 output3, restFns3 )
-> ( (fieldInput -> State tagStates1) -> stateSetter
, restToArgStates
)
-> ( ( Maybe (State fieldState), after )
-> ( Maybe (State argState1), restMaybeArgStates1 )
, befores
)
-> ( after, afters )
-> ( stateSetter, restStateSetters )
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> ( ControlFns input2 state2 delta2 output2, restFns2 )
-> ( State state2, restStates2 )
-> Result (List ( String, String )) output2
, stateAfter : ( Maybe a7, g )
, stateAfters : ( g, h )
, stateBefore : a6 -> c3
, stateBefores : a5 -> c2
, stateInserter :
a4
-> Int
-> Int
-> (( State argState, restArgStates ) -> tagStates)
-> ( Maybe (State argState), restMaybeArgStates )
-> ( State argState, restArgStates )
-> State tagStates
, states : Path -> a3 -> c1
, toArgStates : a2 -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : ( State state1, restStates1 ) -> recordState0
}
-> ( ControlFns input1 state1 delta output1, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state1, restStates1 )
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> ( ControlFns input state delta0 output, restFns )
-> ( Delta delta0 -> delta1, restSetters )
-> ( State state, restStates )
-> Maybe (Html delta1)
}

Add a tag with two arguments to a custom type.

type Point
    = Point Float Float


pointControl =
    customType
        (\point tag ->
            Point x y ->
                point x y
        )
        |> tag2 Point ("X", float) ("Y", float)
String
-> (v1_2 -> v1_1 -> v1 -> output8)
-> ( String, AdvancedControl v1_2 t1_2 u1_2 v1_2 )
-> ( String, AdvancedControl v1_1 t1_1 u1_1 v1_1 )
-> ( String, AdvancedControl v1 t1 u1 v1 )
r
{ m
| applyInputs : a18 -> state0 -> restStateSetters1 -> state1_1
, debouncingReceiverCollector :
a17 -> List Flag -> restFns7 -> restStates6 -> List Flag
, deltaAfter : d
, deltaAfters : e
, deltaBefore : ( Delta delta10, a16 ) -> c7
, deltaBefores : ( ( Delta delta10, a16 ) -> c7, a15 ) -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> restFns6
-> restStates5
-> List ( String, String )
, flagEmitter :
a13 -> List Flag -> Int -> restFns5 -> restStates4 -> List Flag
, fns :
Path
-> ( { baseUpdate :
Float
-> Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
-> State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> ( State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
, Cmd (Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) ))
)
, childViews :
ViewConfig ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> List
(Html
(Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) ))
)
, collectDebouncingReceivers :
State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> List Flag
, collectErrors :
State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> List Flag
-> List ( String, String )
, delta : Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
, emitFlags :
State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> List Flag
, index : Int
, init : State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
, initWith :
( v1_2, ( v1_1, ( v1, b ) ) )
-> State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
, parse :
State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> Result (List ( String, String )) output8
, path : Path
, receiverCount : List Flag
, setAllIdle :
State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
, update :
Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
-> State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> ( State ( State t1_2, ( State t1_1, ( State t1, End ) ) )
, Cmd (Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) ))
)
, view :
ViewConfig ( State t1_2, ( State t1_1, ( State t1, End ) ) )
-> Html (Delta ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) ))
}
, a12
)
-> c5
, idleSetter : a11 -> Int -> restFns4 -> restStates3 -> restStates3
, index : Int
, labels : List String
, makeDeltaSetters : a10 -> befores1 -> afters1 -> next
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> restFns3
-> restToArgStates
-> befores
-> afters
-> restStateSetters
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> restFns2
-> restStates2
-> Result (List ( String, String )) output2
, stateAfter : g
, stateAfters : h
, stateBefore : ( Maybe a19, a6 ) -> c3
, stateBefores : ( ( Maybe a19, a6 ) -> c3, a5 ) -> c2
, stateInserter :
a4
-> Int
-> Int
-> (restArgStates -> tagStates)
-> restMaybeArgStates
-> restArgStates
-> State tagStates
, states :
Path
-> ( State ( State t1_2, ( State t1_1, ( State t1, End ) ) ), a3 )
-> c1
, toArgStates :
( (( i, ( j, ( k, End ) ) ) -> l) -> i -> j -> k -> l, a2 ) -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : restStates1 -> recordState0
}
-> restFns1
-> restDeltaSetters
-> restDeltas
-> restStates1
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> restFns
-> restSetters
-> restStates
-> Maybe (Html delta1)
}
r
{ applyInputs :
a18
-> (stateSetter1 -> state0)
-> ( stateSetter1, restStateSetters1 )
-> state1_1
, debouncingReceiverCollector :
a17
-> List Flag
-> ( ControlFns input6 state7 delta9 output7, restFns7 )
-> ( State state7, restStates6 )
-> List Flag
, deltaAfter : ( Delta delta8, d )
, deltaAfters : ( d, e )
, deltaBefore : a16 -> c7
, deltaBefores : a15 -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> ( ControlFns input5 state6 delta7 output6, restFns6 )
-> ( State state6, restStates5 )
-> List ( String, String )
, flagEmitter :
a13
-> List Flag
-> Int
-> ( ControlFns input4 state5 delta6 output5, restFns5 )
-> ( State state5, restStates4 )
-> List Flag
, fns : Path -> a12 -> c5
, idleSetter :
a11
-> Int
-> ( ControlFns input3 state4 delta5 output4, restFns4 )
-> ( State state4, restStates3 )
-> ( State state4, restStates3 )
, index : Int
, labels : List String
, makeDeltaSetters :
a10
-> ( ( value, after1 ) -> delta4, befores1 )
-> ( after1, afters1 )
-> ( value -> delta4, next )
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> ( ControlFns fieldInput fieldState delta3 output3, restFns3 )
-> ( (fieldInput -> State tagStates1) -> stateSetter
, restToArgStates
)
-> ( ( Maybe (State fieldState), after )
-> ( Maybe (State argState1), restMaybeArgStates1 )
, befores
)
-> ( after, afters )
-> ( stateSetter, restStateSetters )
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> ( ControlFns input2 state2 delta2 output2, restFns2 )
-> ( State state2, restStates2 )
-> Result (List ( String, String )) output2
, stateAfter : ( Maybe a7, g )
, stateAfters : ( g, h )
, stateBefore : a6 -> c3
, stateBefores : a5 -> c2
, stateInserter :
a4
-> Int
-> Int
-> (( State argState, restArgStates ) -> tagStates)
-> ( Maybe (State argState), restMaybeArgStates )
-> ( State argState, restArgStates )
-> State tagStates
, states : Path -> a3 -> c1
, toArgStates : a2 -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : ( State state1, restStates1 ) -> recordState0
}
-> ( ControlFns input1 state1 delta output1, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state1, restStates1 )
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> ( ControlFns input state delta0 output, restFns )
-> ( Delta delta0 -> delta1, restSetters )
-> ( State state, restStates )
-> Maybe (Html delta1)
}

Add a tag with three arguments to a custom type.

type Point3D
    = Point3D Float Float Float


point3DControl =
    customType
        (\point3D tag ->
            Point3D x y z ->
                point3D x y z
        )
        |> tag3 Point3D ("X", float) ("Y", float) ("Z", float)
String
-> (v1_3 -> v1_2 -> v1_1 -> v1 -> output8)
-> ( String, AdvancedControl v1_3 t1_3 u1_3 v1_3 )
-> ( String, AdvancedControl v1_2 t1_2 u1_2 v1_2 )
-> ( String, AdvancedControl v1_1 t1_1 u1_1 v1_1 )
-> ( String, AdvancedControl v1 t1 u1 v1 )
r
{ n
| applyInputs : a18 -> state0 -> restStateSetters1 -> state1_1
, debouncingReceiverCollector :
a17 -> List Flag -> restFns7 -> restStates6 -> List Flag
, deltaAfter : d
, deltaAfters : e
, deltaBefore : ( Delta delta10, a16 ) -> c7
, deltaBefores : ( ( Delta delta10, a16 ) -> c7, a15 ) -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> restFns6
-> restStates5
-> List ( String, String )
, flagEmitter :
a13 -> List Flag -> Int -> restFns5 -> restStates4 -> List Flag
, fns :
Path
-> ( { baseUpdate :
Float
-> Delta
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
-> State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> ( State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
, Cmd
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
, childViews :
ViewConfig
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> List
(Html
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
, collectDebouncingReceivers :
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> List Flag
, collectErrors :
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> List Flag
-> List ( String, String )
, delta :
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
, emitFlags :
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> List Flag
, index : Int
, init :
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
, initWith :
( v1_3, ( v1_2, ( v1_1, ( v1, b ) ) ) )
-> State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
, parse :
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> Result (List ( String, String )) output8
, path : Path
, receiverCount : List Flag
, setAllIdle :
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
, update :
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
-> State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> ( State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
, Cmd
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
, view :
ViewConfig
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
-> Html
( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
}
, a12
)
-> c5
, idleSetter : a11 -> Int -> restFns4 -> restStates3 -> restStates3
, index : Int
, labels : List String
, makeDeltaSetters : a10 -> befores1 -> afters1 -> next
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> restFns3
-> restToArgStates
-> befores
-> afters
-> restStateSetters
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> restFns2
-> restStates2
-> Result (List ( String, String )) output2
, stateAfter : g
, stateAfters : h
, stateBefore : ( Maybe a19, a6 ) -> c3
, stateBefores : ( ( Maybe a19, a6 ) -> c3, a5 ) -> c2
, stateInserter :
a4
-> Int
-> Int
-> (restArgStates -> tagStates)
-> restMaybeArgStates
-> restArgStates
-> State tagStates
, states :
Path
-> ( State
( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
, a3
)
-> c1
, toArgStates :
( (( i, ( j, ( k, ( l, End ) ) ) ) -> m) -> i -> j -> k -> l -> m, a2 ) -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : restStates1 -> recordState0
}
-> restFns1
-> restDeltaSetters
-> restDeltas
-> restStates1
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> restFns
-> restSetters
-> restStates
-> Maybe (Html delta1)
}
r
{ applyInputs :
a18
-> (stateSetter1 -> state0)
-> ( stateSetter1, restStateSetters1 )
-> state1_1
, debouncingReceiverCollector :
a17
-> List Flag
-> ( ControlFns input6 state7 delta9 output7, restFns7 )
-> ( State state7, restStates6 )
-> List Flag
, deltaAfter : ( Delta delta8, d )
, deltaAfters : ( d, e )
, deltaBefore : a16 -> c7
, deltaBefores : a15 -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> ( ControlFns input5 state6 delta7 output6, restFns6 )
-> ( State state6, restStates5 )
-> List ( String, String )
, flagEmitter :
a13
-> List Flag
-> Int
-> ( ControlFns input4 state5 delta6 output5, restFns5 )
-> ( State state5, restStates4 )
-> List Flag
, fns : Path -> a12 -> c5
, idleSetter :
a11
-> Int
-> ( ControlFns input3 state4 delta5 output4, restFns4 )
-> ( State state4, restStates3 )
-> ( State state4, restStates3 )
, index : Int
, labels : List String
, makeDeltaSetters :
a10
-> ( ( value, after1 ) -> delta4, befores1 )
-> ( after1, afters1 )
-> ( value -> delta4, next )
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> ( ControlFns fieldInput fieldState delta3 output3, restFns3 )
-> ( (fieldInput -> State tagStates1) -> stateSetter
, restToArgStates
)
-> ( ( Maybe (State fieldState), after )
-> ( Maybe (State argState1), restMaybeArgStates1 )
, befores
)
-> ( after, afters )
-> ( stateSetter, restStateSetters )
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> ( ControlFns input2 state2 delta2 output2, restFns2 )
-> ( State state2, restStates2 )
-> Result (List ( String, String )) output2
, stateAfter : ( Maybe a7, g )
, stateAfters : ( g, h )
, stateBefore : a6 -> c3
, stateBefores : a5 -> c2
, stateInserter :
a4
-> Int
-> Int
-> (( State argState, restArgStates ) -> tagStates)
-> ( Maybe (State argState), restMaybeArgStates )
-> ( State argState, restArgStates )
-> State tagStates
, states : Path -> a3 -> c1
, toArgStates : a2 -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : ( State state1, restStates1 ) -> recordState0
}
-> ( ControlFns input1 state1 delta output1, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state1, restStates1 )
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> ( ControlFns input state delta0 output, restFns )
-> ( Delta delta0 -> delta1, restSetters )
-> ( State state, restStates )
-> Maybe (Html delta1)
}

Add a tag with four arguments to a custom type.

String
-> (v1_4 -> v1_3 -> v1_2 -> v1_1 -> v1 -> output8)
-> ( String, AdvancedControl v1_4 t1_4 u1_4 v1_4 )
-> ( String, AdvancedControl v1_3 t1_3 u1_3 v1_3 )
-> ( String, AdvancedControl v1_2 t1_2 u1_2 v1_2 )
-> ( String, AdvancedControl v1_1 t1_1 u1_1 v1_1 )
-> ( String, AdvancedControl v1 t1 u1 v1 )
r
{ o
| applyInputs : a18 -> state0 -> restStateSetters1 -> state1_1
, debouncingReceiverCollector :
a17 -> List Flag -> restFns7 -> restStates6 -> List Flag
, deltaAfter : d
, deltaAfters : e
, deltaBefore : ( Delta delta10, a16 ) -> c7
, deltaBefores : ( ( Delta delta10, a16 ) -> c7, a15 ) -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> restFns6
-> restStates5
-> List ( String, String )
, flagEmitter :
a13 -> List Flag -> Int -> restFns5 -> restStates4 -> List Flag
, fns :
Path
-> ( { baseUpdate :
Float
-> Delta
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
-> State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> ( State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
, Cmd
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
)
, childViews :
ViewConfig
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> List
(Html
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
)
, collectDebouncingReceivers :
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> List Flag
, collectErrors :
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> List Flag
-> List ( String, String )
, delta :
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
, emitFlags :
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> List Flag
, index : Int
, init :
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
, initWith :
( v1_4, ( v1_3, ( v1_2, ( v1_1, ( v1, b ) ) ) ) )
-> State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
, parse :
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> Result (List ( String, String )) output8
, path : Path
, receiverCount : List Flag
, setAllIdle :
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
, update :
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
-> State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> ( State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
, Cmd
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
)
, view :
ViewConfig
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
-> Html
( Delta u1_4
, ( Delta u1_3
, ( Delta u1_2, ( Delta u1_1, ( Delta u1, End ) ) )
)
)
)
}
, a12
)
-> c5
, idleSetter : a11 -> Int -> restFns4 -> restStates3 -> restStates3
, index : Int
, labels : List String
, makeDeltaSetters : a10 -> befores1 -> afters1 -> next
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> restFns3
-> restToArgStates
-> befores
-> afters
-> restStateSetters
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> restFns2
-> restStates2
-> Result (List ( String, String )) output2
, stateAfter : g
, stateAfters : h
, stateBefore : ( Maybe a19, a6 ) -> c3
, stateBefores : ( ( Maybe a19, a6 ) -> c3, a5 ) -> c2
, stateInserter :
a4
-> Int
-> Int
-> (restArgStates -> tagStates)
-> restMaybeArgStates
-> restArgStates
-> State tagStates
, states :
Path
-> ( State
( State t1_4
, ( State t1_3
, ( State t1_2, ( State t1_1, ( State t1, End ) ) )
)
)
, a3
)
-> c1
, toArgStates :
( (( i, ( j, ( k, ( l, ( m, End ) ) ) ) ) -> n) -> i -> j -> k -> l -> m -> n
, a2
)
-> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : restStates1 -> recordState0
}
-> restFns1
-> restDeltaSetters
-> restDeltas
-> restStates1
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> restFns
-> restSetters
-> restStates
-> Maybe (Html delta1)
}
r
{ applyInputs :
a18
-> (stateSetter1 -> state0)
-> ( stateSetter1, restStateSetters1 )
-> state1_1
, debouncingReceiverCollector :
a17
-> List Flag
-> ( ControlFns input6 state7 delta9 output7, restFns7 )
-> ( State state7, restStates6 )
-> List Flag
, deltaAfter : ( Delta delta8, d )
, deltaAfters : ( d, e )
, deltaBefore : a16 -> c7
, deltaBefores : a15 -> c6
, destructor : f
, errorCollector :
a14
-> List Flag
-> List ( String, String )
-> ( ControlFns input5 state6 delta7 output6, restFns6 )
-> ( State state6, restStates5 )
-> List ( String, String )
, flagEmitter :
a13
-> List Flag
-> Int
-> ( ControlFns input4 state5 delta6 output5, restFns5 )
-> ( State state5, restStates4 )
-> List Flag
, fns : Path -> a12 -> c5
, idleSetter :
a11
-> Int
-> ( ControlFns input3 state4 delta5 output4, restFns4 )
-> ( State state4, restStates3 )
-> ( State state4, restStates3 )
, index : Int
, labels : List String
, makeDeltaSetters :
a10
-> ( ( value, after1 ) -> delta4, befores1 )
-> ( after1, afters1 )
-> ( value -> delta4, next )
, makeStateSetters :
a9
-> ( (Int -> Int -> (End -> state3) -> End -> End -> State state3)
-> Int
-> Int
-> (c4 -> c4)
-> ( Maybe (State argState1), restMaybeArgStates1 )
-> ( State argState1, restInits )
-> State tagStates1
)
-> ( State argState1, restInits )
-> ( ControlFns fieldInput fieldState delta3 output3, restFns3 )
-> ( (fieldInput -> State tagStates1) -> stateSetter
, restToArgStates
)
-> ( ( Maybe (State fieldState), after )
-> ( Maybe (State argState1), restMaybeArgStates1 )
, befores
)
-> ( after, afters )
-> ( stateSetter, restStateSetters )
, parser :
a8
-> Result (List ( String, String )) output2
-> Int
-> ( ControlFns input2 state2 delta2 output2, restFns2 )
-> ( State state2, restStates2 )
-> Result (List ( String, String )) output2
, stateAfter : ( Maybe a7, g )
, stateAfters : ( g, h )
, stateBefore : a6 -> c3
, stateBefores : a5 -> c2
, stateInserter :
a4
-> Int
-> Int
-> (( State argState, restArgStates ) -> tagStates)
-> ( Maybe (State argState), restMaybeArgStates )
-> ( State argState, restArgStates )
-> State tagStates
, states : Path -> a3 -> c1
, toArgStates : a2 -> c
, updater :
a1
-> { newCmds : List (Cmd recordDelta)
, newStates : ( State state1, restStates1 ) -> recordState0
}
-> ( ControlFns input1 state1 delta output1, restFns1 )
-> ( Delta delta -> recordDelta, restDeltaSetters )
-> ( Delta delta, restDeltas )
-> ( State state1, restStates1 )
-> { newCmds : List (Cmd recordDelta)
, newStates : recordState1
}
, viewer :
a
-> Maybe (Html delta1)
-> List Flag
-> Int
-> ( ControlFns input state delta0 output, restFns )
-> ( Delta delta0 -> delta1, restSetters )
-> ( State state, restStates )
-> Maybe (Html delta1)
}

Add a tag with five arguments to a custom type.

Form internals

These are types that you will see in your form's State and Delta type signatures.

type State state

State is the form's equivalent of an Elm program's Modeltype. It is used to manage the form's internal state.

type Delta delta

A Delta is the form's equivalent of an Elm program's Msg type. It is used internally within a form to update its state.

type ListDelta delta

Special Delta type used only by list controls

type End

Under the hood, this library encodes complex Elm types (such as records and custom types) as nested tuples, which are used in both the State and Delta types for each Control. The End type is used to mark the end of a nested tuple.

For example, the State for this Elm type:

type alias User =
    { name : String, age : Int }

Could be encoded as:

( String, ( Int, End ) )

Internal stuff that you can ignore

A user of this package shouldn't need to know about any of these types - they are only exposed to make it possible to write type signatures.

type Access

An internal type used to represent whether a record field is editable, read-only, or hidden

type AdvancedControl input state delta output

A slightly more flexible version of Control

type Builder r c

An internal type used to differentiate between builders for record and custom type combinators

type alias ControlFns input state delta output =
{ delta : Delta delta
, index : Int
, init : State state
, initWith : input -> State state
, baseUpdate :
Float
-> Delta delta
-> State state
-> ( State state, Cmd (Delta delta) )
, update :
Delta delta -> State state -> ( State state, Cmd (Delta delta) )
, view : ViewConfig state -> Html (Delta delta)
, childViews : ViewConfig state -> List (Html (Delta delta))
, parse : State state -> Result (List ( String, String )) output
, path : Path
, emitFlags : State state -> List Flag
, collectDebouncingReceivers : State state -> List Flag
, collectErrors : State state -> List Flag -> List ( String, String )
, receiverCount : List Flag
, setAllIdle : State state -> State state
}

Some internal stuff needed to build up record and custom type controls

type Flag

Some internal stuff needed to handle validations

type alias RecordFns input state delta output recordOutput =
{ access : Access
, field : ControlFns input state delta output
, fromInput : recordOutput -> output
}

Some internal stuff needed to build up a record control

type Status

an internal type needed to represent the validation state of a control

type alias ViewConfig state =
{ state : state
, status : Status
, flags : List Flag
, selected : Int
}

Some internal stuff needed to view controls