I'm looking at the websockets example here:  
http://elm-lang.org/examples/websockets

According to the source 
(https://github.com/elm-lang/websocket/blob/1.0.1/src/WebSocket.elm), it 
looks like the type of Websocket.send is (String->String->Cmd msg), and in 
the update ftn of the websocket example, what's being returned is 
(Websocket.send <string1> <string2>).

That works out to have a type of "Cmd msg", where I assume msg is a lower 
case type variable.  What is the type of msg in (Cmd msg) which send 
returns?  Because its returned by the "update" function, it should be Cmd 
Msg (capital M message, which is an actual type in the example file), but I 
don't see how one of those is returned from Websocket.send.  Websocket.send 
doesn't know about the types in the websocket example, how could it return 
one of them?

This is an issue for me because I want to pass a partial application of 
WebSocket.send to a subcomponent, which will save the ftn into a state 
structure.  So passing (Websocket.send "someaddress"), into an init 
function, which would put it into a struct like so:

type alias Model =
  { sendf : (String -> Cmd msg)
  , otherstuff: String
  }

Then in my update function in the subcomponent the plan would be to call 
"sendf".  Problem is the compiler wants me to specify the type of "msg", 
and I have no idea what that might be.  


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