[project @ 2001-08-23 09:54:45 by simonpj]
authorsimonpj <unknown>
Thu, 23 Aug 2001 09:54:46 +0000 (09:54 +0000)
committersimonpj <unknown>
Thu, 23 Aug 2001 09:54:46 +0000 (09:54 +0000)
commit98bf57340b8945ea786dc18f2d1ecbe1baed0a4d
tree610f689be020a3f4a52e695ea5cc4d3c6f72be69
parent321743a1c99f9815ce7ea4855474ca6408188de1
[project @ 2001-08-23 09:54:45 by simonpj]
--------------------------------------------------
Be a bit more liberal when slurping instance decls
--------------------------------------------------

Functional dependencies have (as usual) made things more complicated

Suppose an interface file contains
interface A where
  class C a b | a->b where op :: a->b
  instance C Foo Baz where ...

Now we are compiling
module B where
  import A
  t = op (v::Foo)

Should we slurp the instance decl, even though Baz is nowhere mentioned
in module B?  YES!  Because of the fundep, the (C Foo ?) part is enough to
select this instance decl, and the Baz part follows.

Rather than take fundeps into account "properly", we just slurp
if C is visible and *any one* of the Names in the types
This is a slightly brutal approximation, but most instance decls
are regular H98 ones and it's perfect for them.

Changes:

  HscTypes:
generalise the types of GatedDecl a bit

  RnHiFiles.loadInstDecl, RnHiFiles.loadRule, RnIfaces.selectGated:
the meat of the solution

  RdrName, OccName etc:
some consequential wibbles
ghc/compiler/basicTypes/OccName.lhs
ghc/compiler/basicTypes/RdrName.lhs
ghc/compiler/main/HscTypes.lhs
ghc/compiler/parser/RdrHsSyn.lhs
ghc/compiler/rename/RnExpr.lhs
ghc/compiler/rename/RnHiFiles.lhs
ghc/compiler/rename/RnIfaces.lhs
ghc/compiler/rename/RnSource.lhs