I'm trying to create an APP in Elm at the first time. And I need to interact with a server application using Http.post.
I have Msg type like this:
type Msg =
…
| Send (String, String)
| Recv (String, String)
and update function is like this:
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
…
Send (name, data) ->
(newModel, Http.post
{ url = url
, body = Http.multipartBody [Http.stringPart "data" data]
, expect = Http.expectString (Recv name)
})
Recv (name, data) -> … -- process data
But when I run this, it produces a type mismatch error in Http.post. So how can I pass name and newData to Msg "Recv" at the same time?