Given a List of String , I want to create a List of HTML div in order to inject it in view : I wondered that the function signature should be as following :
display : List String -> List Html div
and the function body :
display model = case model of
[] -> []
(x::xs) -> div [][ text x] :: display xs
when embeding the above function in the view as per the below (as i know the div function take a List of Html as second argument div : List Attribute -> List Html -> Html
)
view : Model -> Html Msg
view model = div []
[
input [ placeholder "write your post here" , onInput Change][]
, button [onClick Save ][text "save"]
,div [][ display model.lst ]
I am getting the below error when compiling :
The 2nd argument to function `div` is causing a mismatch.
24| div [][ display model.lst ]
^^^^^^^^^^^^^^^^^^^^^
Function `div` is expecting the 2nd argument to be:
List (VirtualDom.Node a)
But it is:
List (List (Html a))
how could I sort this out , THANKS