Basic implementations for calculateType.

This is still not complete.
Better error message for types that won't work with operations.