In particular, you can obtain the following:
The appendix containing the type derivation for the extended example can be found here.