Refactor/rename g* to p* for type parameters.
Fix whitespace.
Fix covariance and contravariance.