Type checking, overview

Heaviliy influenced by Typing Haskell in Haskell. Differences: Some details remain to be implemented: