Refactored type function constraints. Removed redundant type class constraint checking on type class instances. Properly handle ambiguous type variables.