rtfeldman/elm-css

toUnstyled function that can take Lists or a Document

Opened this issue · 1 comments

Currently, with the Document type you need to use List.map toUnstyled to convert to unstyled Html. This would result in a style tag being created for each element in that list, when it may be better to merge them into one. Would it be worth creating a toUnstyled function for either a list of Html or a Document?

Ohh is that what you have to do?

I've just been wrapping my view function in a list with the toUnstyled function being called on it. Imagine my surprise when seeing the error:

-- TYPE MISMATCH -------------------------------------------------- elm/Main.elm

Something is off with the 1st branch of this `case` expression:

214|>            { title = "title"
215|>            , body = [ view ]
216|>            }

The 1st branch is a record of type:

    { body : List (Html Msg), title : String }

But the type annotation on `view` says it should be:

    Browser.Document Msg

Which is the same thing... and then fixing that, it complains about toUnstyled producing VirtualDom.Node instead of Html... also the same thing!