
#13192: Ambiguity Caused By PolyKind and Not Helpful Error Messages -------------------------------------+------------------------------------- Reporter: Shayan-Najd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following code results in a confusing/wrong error message, blaming a type variable (`a`) being a fixed Skolem variable: {{{#!hs {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE PolyKinds #-} data I a type family F x type instance F (I a) = a identity :: F (I a) -> F (I a) identity x = x }}} with the error message {{{ • Couldn't match type ‘F (I a0)’ with ‘F (I a)’ Expected type: F (I a) -> F (I a) Actual type: F (I a0) -> F (I a0) NB: ‘F’ is a type function, and may not be injective The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘identity’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the type signature: identity :: F (I a) -> F (I a) | 9 | identity :: F (I a) -> F (I a) | ^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13192 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler