-
Notifications
You must be signed in to change notification settings - Fork 40
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
Problem Cmd.mapping from child module #52
Comments
Hello! lol, ZombificationStatus, I love it. Ok, so the first thing is that the And also, the library doesn't expose a map function (which, to be honest, is an oversight by me). If you're only using I believe you can do just by changing the type annotation where you're defining it. |
Thanks for the super-quick response! If I understand you correctly, you are asking me to change the type annotation in my model. Then the problem (for me!) is that the child defines its own animation styles, and stores them in model defined in the child: type alias Model = I can't change Msg to Main.Msg here, because this module is imported by Main, so writing Main.Msg causes a dependency cycle. I could, of course, move these styles to Main, but my app is an SPA (actually, a Cordova app), will have a few dozen pages, and I'd like to follow how Richard Feldman did things in his RealWorld example app https://github.com/rtfeldman/elm-spa-example. I'd rather not have all of the sub-pages models coalesced into a monster Main model. Or did I misunderstand you? |
Yeah, I'm a big fan of the spa example by Richard :) Hmmm, Can you switch the type annotations to something like type alias Model msg =
{ animationStyles : Animation.Messenger.State msg
, animationStyles2 : Animation.Messenger.State msg
} I'm not %100 if that will work... |
Tried it. I ended up having to make dozens of changes as that change flowed through my program, LOL, and after fixing all but one (which I'm not sure was fixable), noticed this:
... which is, essentially, where we started from! So it looks like it doesn't, in the end, solve the problem. :( Thanks for trying though! Any other ideas? If not, might you be able to support mapping, sometime in the not-too-distant future? |
I'm an Elm newbie so perhaps I'm doing something wrong, but I think there's a problem.
I am doing animations in Main and in my ZombificationStatus (don't ask!) child component. I was successfully animating in both until I needed to use Animation.Messenger.send in Main. I made the changes you specify in the documentation:
In both modules, I
import Animation
import Animation.Messenger
and my models have something like this:
slidingOutStyle : Animation.Messenger.State Msg
The problem I am having is mapping the messages from my child to parent. If I don't map, I (understandbly) get:
--
So I try to map it:
and I get this compiler error:
Am I doing something wrong, or is there a problem here?
(perhaps this? elm/error-message-catalog#215 )
Thanks!
The text was updated successfully, but these errors were encountered: