[project @ 2002-04-03 09:45:14 by simonpj]
authorsimonpj <unknown>
Wed, 3 Apr 2002 09:45:16 +0000 (09:45 +0000)
committersimonpj <unknown>
Wed, 3 Apr 2002 09:45:16 +0000 (09:45 +0000)
commitf2f40c0fd667bf83aab71cce188bd3ccc2096e7f
tree8fb72275ee530b93ea481069ff03b8cffa6a5146
parent94c5c5a2f6e296125940af1946d888e53b8c82f0
[project @ 2002-04-03 09:45:14 by simonpj]
-----------------------------
Put existential tyvars second
[fixes ParsecPerm lint error]
-----------------------------

In an existential data constr:

data Eq a => T a = forall b. Ord b => MkT a [b]

the type of MkT is

MkT :: forall a b . Ord b => a -> [b] -> MkT a

Note that the existential tyvars (b in this case) come *after*
the "ordinary" tyvars.

I had switched this around earlier in the week, but I'm putting
it back (and fixing a bug) because I found it really works better second.

Reason: in a case expression we may find:
case (e :: T t) of { MkT b (d:Ord b) (x:t) (xs:[b]) -> ... }
It's convenient to apply the rep-type of MkT to 't', to get
forall b. Ord b => ...
and use that to check the pattern.  Mind you, this is really only
use in CoreLint.
ghc/compiler/basicTypes/DataCon.lhs
ghc/compiler/basicTypes/MkId.lhs
ghc/compiler/coreSyn/CoreLint.lhs
ghc/compiler/typecheck/Inst.lhs