Only generate poly contracts for functions (fix for PR 13815)

This pull request is for code review.

The attached commit makes contract generation refuse to generate contracts for types like `(All (a) Float)` (this was Vincent's idea). It appears to pass all the tests and should solve PR 13815.