I'm been going through the elm architecture tutorials, and building my own stuff. However, I'm having some trouble wrapping my head around forwardTo, as much as I try. Usually, it's probably because of some misconception I have. What's a good way to think about forwardTo conceptually so that it makes sense?
Conceptually, I'm guessing I'm to think of forwardTo as taking the current passed in address and creating another address that can be used by the subcomponent. To do so, I pass in a second argument that's usually a type alias of the current component's Actions to result in a subcomponent's Actions.
An example is:
type Action
= Insert
| Remove
| Modify ID Counter.Action
viewCounter : Signal.Address Action -> (ID, Counter.Model) -> Html
viewCounter address (id, model) =
Counter.view (Signal.forwardTo address (Modify id)) model
It looks like in order to get Counter.view called correctly with the right address, I'm using (Modify id) to change it to an address with Counter.Action in the address, so that when it's passed into Counter, the actions are of the correct type?
Is that right, or is there another way to think about it?
Wil