27 ms·
Take a look at the Stack class (an example of a free monad) and how it's used to compose clients: https://github.com/twitter/finagle/blob/master/finagle-core/s
by bmdhacks 12y ago
Take a look at the Stack class (an example of a free monad) and how it's used to compose clients:
https://github.com/twitter/finagle/blob/master/finagle-core/src/main/scala/com/twitter/finagle/Stack.scala https://github.com/twitter/finagle/blob/master/finagle-core/...
https://github.com/twitter/finagle/blob/master/finagle-core/src/main/scala/com/twitter/finagle/client/StackClient.scala https://github.com/twitter/finagle/blob/master/finagle-core/...
http://twitter.github.io/finagle/guide/Clients.html http://twitter.github.io/finagle/guide/Clients.html
A client is a layer of various components like load balancers and stats recorders, but they're also all configurable. Only using the expressiveness of scala could such a data structure be created to compose all of these pieces, yet still keep them modifiable and type-safe.