Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2001-08-23 09:54:45 by simonpj] · 98bf5734
    Simon Peyton Jones authored
    --------------------------------------------------
    	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
    98bf5734