[Haskell] multiple occurence of the same type variable in instance head

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon Oct 17 09:04:17 EDT 2005


Hello,

the following is not Haskell 98:

	class C a

	instance C (a,a)

Well, GHC allows this with the -fglasgow-exts flag.  Surprisingly, I cannot 
find a section in the GHC User's Guide which states that -fglasgow-exts can 
be used to allow this kind of instance declarations.  Well, in the section on 
undecidable instances (7.4.4.3), one can read:

	Note that instance heads may contain repeated type variables. For example,
	this is OK: 

		instance Stateful (ST s) (MutVar s) where ...

But one has to note that in this expample, the different occurences of s 
aren't in the same type.  Furthermore, multiple occurences of the same type 
variable cannot result in undecidability (as far as I understand).  The 
above-mentioned statement talks about the things that are allowed *without* 
-fallow-undecidable-instances, and premises that multiple occurences of a 
type variable are okay.

So am I missing something?

Best wishes,
Wolfgang


More information about the Haskell mailing list