[Haskell] multiple occurence of the same type variable in instancehead

Simon Peyton-Jones simonpj at microsoft.com
Wed Oct 26 09:01:08 EDT 2005


Quite right.  I've fixed the documentation (in CVS).

Simon

| -----Original Message-----
| From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org]
On Behalf Of Wolfgang
| Jeltsch
| Sent: 17 October 2005 14:04
| To: Haskell ML
| Subject: [Haskell] multiple occurence of the same type variable in
instancehead
| 
| 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
| _______________________________________________
| Haskell mailing list
| Haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell


More information about the Haskell mailing list