A library for lists of things you want to track, kind of like Html.Keyed but for your data model.
Update the value of a list for a specific Key with a given function.
Remove an item from a list by Key. If the Key is not found, no changes are made.
Create a List out of items and their Keys. This is particularly useful in the view of a Model that contains a KeyedList.
type alias Model =
{ submodels : KeyedList SubModel
...
}
view : Model -> Html Msg
view model =
keyedMap viewKeyedSubmodel model.submodels
|> div []
viewKeyedSubmodel : Key -> SubModel -> Html Msg
viewKeyedSubmodel key submodel =
div [ onClick <| Click key ] [ SubModel.view submodel ]Keep only elements that satisfy the predicate, preserving Keys.
A list that gives each element a locally unique
Keyfor later modification or removal.Convert a list using
fromListor build one from scratch withemptyandpush.