@@ -66,9 +66,9 @@ a server for `FactoringAPI` (without the `'`) reflects the
6666server must be a function that takes an `Int` (the `Capture`) and
6767returns two values glued with `:<|>`, one of type `Maybe Int -> Handler Int`
6868and the other of type `Handler Int`. Let's provide such a server
69−implementation.
69+implementation, with those "nested types".
7070
71−_Note_: you can load this module in ghci and ask for the concrete
71+**Tip**: you can load this module in ghci and ask for the concrete
7272type that `Server FactoringAPI` "resolves to" by typing
7373`:kind! Server FactoringAPI`.
7474
@@ -82,6 +82,16 @@ factoringServer x = getXY :<|> postX
8282 postX = return (x - 1)
8383```
8484
85+If you want to avoid the "nested types" and the need to manually
86+dispatch the arguments (like `x` above) to the different request
87+handlers, and would just like to be able to declare the API type
88+as above but pretending that the `Capture` is not factored out,
89+that every combinator is "distributed" (i.e that all endpoints
90+are specified like `FactoringAPI'` above), then you should
91+look at `flatten` from the
92+[servant-flatten](https://hackage.haskell.org/package/servant-flatten)
93+package.
94+
8595Next come the two sub-APIs defined in terms of this `SimpleAPI`
8696type, but with different parameters. That type is just a good old
8797Haskell type synonym that abstracts away a pretty common structure in