[cvs-nhc98] patch applied (hat): Fix an obscure bug with transitive import/export of instances through

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Oct 10 07:23:26 EDT 2006


Wed Jan 22 08:58:58 PST 2003  malcolm
  * Fix an obscure bug with transitive import/export of instances through
  several modules.  The fault was this:
      module W:  defines class C, instance C T1, exports C
      module X:  imports W, uses class C, does not explicitly export C or T1
      module Y:  imports X, re-exports X
      module Z:  defines a function that implicitly uses instance C T1
  The compiler complained that no such instance exists, even though it does.
  The interface file for Y was failing to record the instance C T1.
  
  Now, the interface file for X /does/ record the instance C T1,
  even though neither the type nor the class are explicitly exported,
  and this is correct.  However, because the class C is mentioned only
  `implicitly' (i.e. non-exported) in X's interface, Y did not import
  C from X, and did not re-export it either, hence deciding that none
  of its instances were relevant.
  
  The fix is to export all the instances attached to an "InfoUsedClass"
  (i.e. one found in passing in an interface file but not imported)
  in addition to the instances attached to an "InfoClass" (i.e. classes
  that are really imported).

    M ./src/compiler98/Export.hs -11 +26
    M ./src/compiler98/Info.hs +5


More information about the Cvs-nhc98 mailing list