On Tuesday, November 22, 2016 at 10:32:22 AM UTC, Gusztáv Szikszai wrote: > > Yes, that is perfect for my use case, thanks. This should be added to the >> official packages? >> > > This kind of messaging is not encouraged (sending things around the > program), so It probably will not be added to the official packages. >
It would have 2 uses: * Alternative to 'out messages', which seem to require a lot of boiler plate. This is much simpler and more convenient to use. * For inter-process communication. I think the Process model is still in development. At least according to the notes Evan left in the docs it says it needs some time to evolve into the right shape so not to be too hasty in trying to push him into a particular direction for it (or words to that effect). That said, this would seem too useful to ignore. > > That is, I provide the name of the channel and it returns a send/listen >> pair that operate on type 'a'. Or perhaps it is just: >> >> send : String -> a -> Cmd msg >> listen : String -> (a -> msg) -> Sub msg >> >> Is there some reason this cannot be done? >> > > I tried to implement that with pure Elm but the way effect managers works > prevents that. > It can be done with some native functions, but it's dangerous because > prevents type checking (it directly feeds the given messages back into the > program). > That is what I was trying to get at with my constructor for the send/listen pair; trying to make sure that they work with the same type. Encoding as json is only a minor inconvenienve, it doesn't put me off using this. -- 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.