|Version 1 (modified by ross@…, 10 years ago) (diff)|
In Haskell 98, instance heads must have the form instance (C1 v1, ..., Cn vn) => C (T u1 ... uk), where T is a type constructor defined by a data or newtype declaration (see TypeSynonymInstances) and the ui are distinct type variables.
Allowing arbitrary types in instance heads makes constraint checking undecidable. One rule that ensures termination is to require instance heads of the form instance (C1 vs1, ..., Cn vsn) => C t1 ... tk, where at least one of the ti is not a type variable (assuming MultiParamTypeClasses). This is the rule used by GHC with -fglasgow-exts. Note that repeated type variables are permitted.
- Instance declarations in the Haskell 98 Report
- Type classes: exploring the design space by Simon Peyton Jones, Mark Jones and Erik Meijer, Haskell Workshop 1997.
- Explanation in the GHC's User's Guide.