--
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 elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
One possibility of separating those two types so they can be split into two modules is:
type Msg = NoOp | Response (List (Slide Msg))
type alias Slide msg = {
title: String,
node: Html msg
}
This being said, I find it somewhat uncomfortable that there is no way to specify that “this HTML is static and does not emit any Messages, so please do not bother me with these mandatory dummy potential msg types”.
Who said that there is no such way? In my reply I said that one way to do what you want is so-and-so. I did not say that that was the only way. For example, you could also do something like:
type Msg = NoOp | Response (List Slide)
type alias Slide = {
title: String,
node: Html Never
}
Don’t know whether it’s an antipattern. Probably needs discussion. In a separate thread. You could start one with a specific use case where you would want such a Sub.filter being available.
Who said that there is no such way? In my reply I said that one way to do what you want is so-and-so. I did not say that that was the only way. For example, you could also do something like:
type Msg = NoOp | Response (List Slide) type alias Slide = { title: String, node: Html Never }
About 1), http://package.elm-lang.org/packages/elm-lang/core/4.0.0/Basics#Never
About 2), Never is not Msg, so if a type Html.Msg is needed somewhere, you have to use Html.map with a function of type Never -> Msg. The function always NoOp springs to mind. Or, in an attempt to get rid of NoOp, the function from this proposal: https://github.com/elm-lang/core/pull/593
Sorry, I guess I confused you by writing Html.Msg. That was a typo, should have been Html Msg. That is, the Msg there is your Msg type. As to why it is needed, I’d bet you do create a dependency on it somewhere in your code.