I should have had a better look at what elmq allowed indeed. That said until elmq (or something equivalent) is published on package.elm-lang.org, we get a non-publishable package.
I will make some tests with now that the plain version is working properly. Thanks! Christophe Le 22/05/2017 à 16:59, 'Rupert Smith' via Elm Discuss a écrit : > On Monday, May 22, 2017 at 8:46:14 AM UTC+1, Christophe de Vienne wrote: > > * not being an effect module has clear pros : > - we can rely on other effect modules (in my case: WebSocket and > Random) > > * Being an effect module would allow a much simpler and natural API. > But then we could not use WebSocket or Random > > > If you had used elmq to solve the issue of passing the messages around > within the Elm application you would not have run into this limitation. > That is to say that the dependency structure of your Nats module and the > effects module it uses would have looked like this: > > Nats > -> WebSocket > -> Random > -> elmq > > Where -> means depends on. But Nats itself would not be an effects module. > > > Finally, I would like to discuss a notion of middleware (which I think > is what I did with elm-nats): > > We could simplify the API as much as with an effect module if we could > manipulate the Cmd and Sub. > > I suspect that being able to filter a Cmd to extract all Cmd of a given > type in it would permit to implement some kind of middleware component. > Such a component would be explicitely inserted by the user between its > program and its TEA entry points. > > It could define some custom Cmd and Sub, and would transform them to > other effect modules commands and subs just before returning them to > the > program. > > Has anything like this been attempted already? > > > This is basically what elmq is. When you send a message the result is a Cmd: > > send : String -> Value -> Cmd msg > > And when you listen for messages the result is a Sub: > > listen : String -> (Value -> msg) -> Sub msg > > The only 'filtering' currently available is to be able to name a channel > (the String parameter in 'send' and 'listen'). More sophisticated > filtering, mapping, folding / whatever could be added to it. > > > -- > 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] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout. -- Christophe de Vienne -- 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.
