IsTerm constraint in MonadTerm
Set up more infrastructure for 'Opened' names

This includes a refactor of the TC monad -- we now parametrise over an
environment type too.

Right now constructor-headed function inversion doesn't work.