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 <[email protected]
> wrote:

> 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'm still getting an error that init was expecting `Main.Msg` but got
> `A.Msg`.
>
> Hope I make sense.
>
>

-- 
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.

Reply via email to