I am trying to change a simple application from the elm-lang tutorial to update the model first and then run another update.
update msg model = case msg of MorePlease -> (model, getRandomGif model.topic) NewGif (Ok newUrl) -> ( { model | gifUrl = newUrl }, Cmd.none) NewGif (Err _) -> (model, Cmd.none)
This does not work in the compiler, because the NewTopic branch:
The 3rd branch has this type: ( { gifUrl : String, topic : String }, Cmd Msg ) But the 4th is: ( { gifUrl : String, topic : String }, Msg )
So, my Msg should be type Cmd Msg. How can I turn "Msg" into Cmd Msg?
note: I understand that there is an easy way to make this change, but I'm trying to understand Elm more fundamentally
elm
steel
source share