I have a model that is a record in which some fields are lists of lists of strings. I’d like to display each item of the nested list in the view. This seems like a simple thing that I’m just not getting right.
this is pointing to a slight misunderstanding. If you have [ ["foo", "bar"]] you cannot treat the internal list as a list of two arguments because it is not modeled like that. I order to model it like that you need to use tuples.
List.map Html.text (List.map (\(_, x) -> x) [ ("foo", "bar") ]) would work and be equivalent to List.map Html.text (List.map Tuple.first [ ("foo", "bar") ])
if you still want to model it like that, you will need something like:
List.map
(\l ->
case l of
_ :: x :: [] ->
text x
_ ->
text ""
)
myModel.field2