ServerPartTsIn the first example, we had only one ServerPartT. All
Requests were handled by the same part and returned the
same Response.
In general, our applications will have many
ServerPartTs. We combine them into a single top-level
ServerPartT by using MonadPlus. Typically
via the msum function:
In the following example we combine three ServerPartTs
together.
[Source code for the app is here.]
The behaviour of MonadPlus is to try each ServerPartT in succession, until one succeeds.
In the example above, the first part is mzero, so it will always fail. The second part will always succeed. That means the third part will never be reachable.
Alas, that means this application will appear to behave exactly like the first application. What we need are some ways to have parts match or fail depending on the contents of the http Request.