Re: [elm-discuss] Listening to messages from different modules on an update

2016-11-16 Thread Peter Damoc
You need to map the submodule Cmd to the top module Cmd init : ( Model, Cmd Msg ) init = ( { -- my model here } , Cmd.map AMsg getJson ) (as OvermindDL1 pointed aMsg is not a valid type constructor) On Wed, Nov 16, 2016 at 12:50 AM, Tim Bezhashvyly wrote: > Thank you. Tried to apply it

Re: [elm-discuss] Listening to messages from different modules on an update

2016-11-15 Thread Tim Bezhashvyly
Sure I'm using something different. :-) On Wednesday, November 16, 2016 at 12:07:25 AM UTC+1, OvermindDL1 wrote: > > aMSG is not a valid constructor name, perhaps instead AMSG or A_Msg or > MsgA or so, as long as it starts with an uppercase. :-) > > > On Tuesday, November 15, 2016 at 3:50:36 PM

Re: [elm-discuss] Listening to messages from different modules on an update

2016-11-15 Thread OvermindDL1
aMSG is not a valid constructor name, perhaps instead AMSG or A_Msg or MsgA or so, as long as it starts with an uppercase. :-) On Tuesday, November 15, 2016 at 3:50:36 PM UTC-7, Tim Bezhashvyly wrote: > > Thank you. Tried to apply it but my problem is that I'm trying to send > initialize a req

Re: [elm-discuss] Listening to messages from different modules on an update

2016-11-15 Thread Tim Bezhashvyly
Thank you. Tried to apply it but my problem is that I'm trying to send initialize a request on init: init : ( Model, Cmd Msg ) init = ( { -- my model here } , getJson ) And of course `getJson` is returning `A.Msg`, so even if in B I declare: type Msg = aMSG A.Msg | SomeLocalMessage I'

Re: [elm-discuss] Listening to messages from different modules on an update

2016-11-14 Thread Peter Damoc
There used to be a "nesting" set of examples in The Elm Architecture but lately this approach has been discouraged. What you describe here is a kind of decomposition into components. It is recommended that you have one model and you decompose the functionality of update & view using regular funct

[elm-discuss] Listening to messages from different modules on an update

2016-11-14 Thread Tim Bezhashvyly
I just started digging into Elm so quite possible that my question has a conceptual problem. Please let me know if so. I have a module A which is asynchronously reading data from JSON. Module A among other things exposes `getJson` function. As the read is processing data asynchronously it can n