Open benjchristensen opened 9 years ago
Here is a paper by Marius at Twitter (who created Finagle) that should influence our design: http://monkey.org/~marius/funsrv.pdf
Here is another example from Retrofit: http://square.github.io/retrofit/javadoc/retrofit/RequestInterceptor.html
To achieve aspects of the use cases (https://github.com/reactive-ipc/reactive-ipc-jvm/issues/14) @NiteshKant and I propose that we treat servers and clients as functions that can be composed. For the rest of this I'll talk about servers, but it applies to clients as well.
It effectively behaves like "mapping" a server to a new server. This is somewhat monadic, except we don't think there is ever a time a
Server<Server<I, O>>
makes sense, so it won't haveflatMap
/bind
so isn't actually a monad. It works quite similarly though so one should be able to define a server:and then transform it into a new server definition with additional behavior such as logging:
and then transform data:
In a few days @NiteshKant and I will submit a PR proposing this approach to making RIPC loosely-coupled yet capable of achieving the many use cases #14 via layering and composition.