Hi Pablo, Have you read the Modularity chapter of the Guide? http://guide.elm-lang.org/architecture/modularity/counter_pair.html
On Tue, Jul 12, 2016 at 3:58 PM, Pablo Fernandez <[email protected]> wrote: > Hi guys, > > If I have several components that they have its update functions and > actions (Msg), How I can manage them from a single place?, I guess that I > need a single update in main file and from here call all updates functions. > > Per example, if I have this: > > type Msg = NoOp | Move Int | SuccessMove Model | FailMove Http.Error > > > update : Msg -> Model -> (Model, Cmd Msg)update msg model = case msg of > Move cardinal -> (model, getNewPositions cardinal) -- Getnewsposition > return info for the movement NoOp -> (model, Cmd.none) SuccessMove > newModel -> -- TODO FailMove error -> (model, Cmd.none) > > > -------------------------------------------------- > and in the main file I have this: > > type Msg = NoOp | GoTo Int > > > update : Msg -> Model -> (Model, Cmd.Msg)update msg model = case msg of > NoOp -> (model, Cmd.none) GoTo a -> let model' = > -- How can I call the update from file here? (the type 'a' is the cardinal) > in (model', Cmd.none) > > > > In summary, I need a way to manage other updates from a main update. > > > > Greetings! > > > -- > 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. > -- There is NO FATE, we are the creators. blog: http://damoc.ro/ -- 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.
