-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A question about lifting messages #126
Comments
Hi @dpinn, the reason for that is that a mdc component has to dispatch both internal as well as user messages. The idiom (In the following I will not parameterize At the point when we are writing the type signature for While I would not generally recommend this pattern in favor of Hope that helps. If anything remains unclear, let me know! PS. In some instances, we are dispatching user messages from |
I'm still a little puzzled. In your Demo application, you have module Demo.Menus, in which the view method is like this:
...and in
If the
... and call it like this?...
... or does |
Hi @dpinn, you are right to be confused. If I were to write the demo today, I would not have used the However, for So if we are considering
Then in
|
Thanks very much. I get the picture now. I think I'll stick with the idiom you used in the Demo, at least for now, since there's a lot of it in my code already. Sometime I might refactor it to the other way. |
Turns out that I cannot get rid of the lift pattern in the demo views after all, because the top level application provides wrapping functions like I require the lift pattern in views after all, because to the demo page view of resulting type |
The Material.elm documentation says this in relation to the parameterisation of Model m and Msg m:
What does it mean by top-level? If I have a nested structure, with models inside models, does the inner-most level have to be parameterised with the Msg type from the outer-most level? |
The nearest Msg. So if you have a model and msg per page and have a That's the simplest method. I hope this clarifies! |
I think we need to clarify this comment in
That's true for an app with only one level of Msg. But for apps with a model and msg per page, this is confusing. Because in that case the top-level message is the msg at the level of the page model. So this needs to be written a bit more clear. |
And we need to rewrite the demo to make sure its pattern is not necessarily the best one. |
Just for my own edification: why have you used the idea of lifting messages (e.g.
lift << Mdc
) instead of usingHtml.map
andCmd.map
in the Elm file that contains the component?In
Material.elm
you wrote:Can you give me some insight into those technical reasons? I've followed your practice, and I'd just like to understand the pattern better.
The text was updated successfully, but these errors were encountered: