Editable represents a value that can be read-only or editable.
ReadOnly a holds the locked value and Editable a a holds both the old and the newly modified value.
Cancels a modified value. This puts the old value into the context of ReadOnly.
Editable.Editable "old" "new"
|> Editable.cancel --> ReadOnly "old"Makes a ReadOnly value Editable.
Editable.ReadOnly "old"
|> Editable.update "new" --> ReadOnly "old"
|> Editable.edit --> Editable "old" "old"
|> Editable.update "new" --> Editable "old" "new"Apply a function to an Editable.
Editable.ReadOnly "old"
|> Editable.map String.toUpper --> ReadOnly "old"
Editable.Editable "old" "old"
|> Editable.map String.toUpper --> Editable "old" "OLD"Save a modified value. This puts the modified value into the context of ReadOnly.
Editable.Editable "old" "new"
|> Editable.save --> ReadOnly "new"
Editable.ReadOnly "old"
|> Editable.edit --> Editable "old" "old"
|> Editable.update "new" --> Editable "old" "new"
|> Editable.save --> ReadOnly "new"Updates an Editable and doesn't change a ReadOnly.
Editable.ReadOnly "old"
|> Editable.update "new" --> ReadOnly "old"
Editable.Editable "old" "old"
|> Editable.update "new" --> Editable "old" "new"Returns the current value of an Editable.
Editable.ReadOnly "old"
|> Editable.value --> "old"
Editable.Editable "old" "new
|> Editable.value --> "new"
An
Editablevalue is eitherReadOnlyorEditable.