What you can do if you really want, and in some parts of your code only have, nodes that come without event handlers, is this:
type alias StaticHtml = Html Never tableCell : a -> StaticHtmltableCell data = td [] [text (toString data)] If eventually you need to embed this into views that do have buttons etc., you can use the function static from http://package.elm-lang.org/packages/elm-community/html-extra/latest/Html-Extra, which will let you turn StaticHtml into arbitrary Html msg. 2016-05-27 18:19 GMT+02:00 Ray Toal <[email protected]>: > Yes, thanks, right there on the top of the my screen is the old > evancz/elm-html. I should have paid more attention. Okay, found > elm-lang/elm-html. I knew it moved...going to have to stop using Google as > my entry into the documentation, as it will take the search giant a while > to make the top search result for "elm html package" to STOP pointing to > http://package.elm-lang.org/packages/evancz/elm-html/4.0.2/ and instead > go to http://package.elm-lang.org/packages/elm-lang/html/1.0.0/Html. > > My bad, thanks again. > > On Friday, May 27, 2016 at 8:50:36 AM UTC-7, Janis Voigtländer wrote: >> >> You are looking at outdated documentation. That's all. The current >> documentation of td has the type variable. >> >> Am 27.05.2016 um 17:42 schrieb Ray Toal <[email protected]>: >> >> Hi >> >> I wanted to write >> >> tableCell : a -> Html >> tableCell data = >> td [] [text (toString data)] >> >> >> but I got an error so I had to write >> >> tableCell : a -> Html b >> tableCell data = >> td [] [text (toString data)] >> >> >> This makes sense because in the REPL we see >> >> > td >> >> <function> : List (Html.Attribute a) -> List (Html.Html a) -> Html.Html a >> >> >> Now ignoring the fact that the type variable seems silly, even though I >> am sure somewhere there is a good reason for it (yes, Html aliases >> VirtualDom.Node), I was really baffled to find out in the Html module >> itself that td was defined **without** the extra type variable! Straight >> from the source: >> >> {-| Represents a data cell in a table. -} >> td : List Attribute -> List Html -> Html >> td = >> node "td" >> >> >> In fact the documentation for the Html module is full of those kinds of >> type signatures. So two questions: >> >> 1. How the heck did they get away with that? >> >> 2. Is there any way we can do this in our own code? I mean, I wanted to >> just say the type of the tableCell function is `a -> Html`. The thing is >> "just a node." What is the extra type variable for anyway? Like I say, I am >> sure it is useful or necessary but it looks kinda weird. Why can't we just >> have something that is "just a node"? If Html is not that thing, what is? >> >> Thanks! >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Elm Discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> >> -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
