packageelm

Issue with elm/html style attribute package in new 0.19 project


I noticed that while working through some build errors in a new Elm 0.19 project that I started seeing errors such as the following when running elm-make.

50| [ iframe [ src "https://fakeurl.com", height "0", width "0", style [ ( "display", "none" ), ( "visibility", "hidden" ) ], sandbox "" ]

This style call produces:

String -> Attribute msg

But all the previous elements in the list are:

Attribute msg

Hint: Everything in the list needs to be the same type of value. This way you never run into unexpected values partway through. To mix different types in a single list, create a "union type" as described in: http://guide.elm-lang.org/types/union_types.html

The direct error after this states:

This argument is a list of type:

List ( String, String )

But style needs the 1st argument to be:

String

From what I can tell the use of the style attribute on the line where elm-make is complaining seems to be the expected usage for recent more recent versions of elm/html.

Ex.

style [ ( "display", "none" ), ( "visibility", "hidden" ) ]

Looking a bit deeper it looks like I have elm/html 1.0.0 package installed wheras the latest for Elm 0.19 is 2.0.0. Even more strange is that the version of elm/html for .19 called 1.0.0 seems to be more like a copy of the elm/html package for 0.18 that was called ~version 5.0.0~ and these all have the newer signature that takes a list. Looking at the actual package that is installed under C:\Users\me\AppData\Roaming\elm\0.19.0\package\elm\html\1.0.0\src\Html I do indeed see that the signature is style : String -> String -> Attribute msg which from what I understand should only be for the elm/html package 1.0.0 version for Elm 0.18. Based on this I can only conclude that I have 0.18 packages in my elm/0.19.0 package repository folder.

Is my logic above sound or is there another explanation? How did it get this way, perhaps I did something wrong? Is this a known issue with one of the tools? How do I resolve this issue for my project so I can move forward?


Solution

  • It seems like you got confused by transfer of core packages to elm/ namespace in Elm 0.19. Packages in elm-lang/ namespace are for Elm 0.18. Latest version of elm/html is 1.0.0 whereas for elm-lang/html it is 2.0.0. With that said it is correct you are having elm/html 1.0.0 and correct signature for style is String -> String -> Attribute msg.

    This particular change is mentioned in release notes for 0.19. Sadly, there are other changes which are not on that document so ping people on Slack if you run into other troubles.