[cvs-nhc98] cvs commit: hat/src/hattrans HatTrans.hs

olaf@glass.cse.ogi.edu olaf@glass.cse.ogi.edu
Wed, 23 Apr 2003 11:21:31 -0700


olaf        2003/04/23 11:21:31 PDT

  Modified files:
    src/hattrans         HatTrans.hs 
  Log:
  Correct bug in handling of imports.
  
  Hat-trans has to add an "import qualified PreludeBasic" to any transformed module (except the Prelude modules), because some of these identifiers are used in transformed code, in particular in derived instances.
  
  This import is now only added as a last step before pretty-printing. Before it was done before the reading of interface files. As a result the PreludeBasic.hx file was always processed neadlessly and because the renaming phase does not complain if an identifier of a qualified import is referred to unqualified, we also imported unwanted identifiers. In a recent bug report Stephen Pitts complained that the transformed Edison library does not compile. Basically it contains
  
  import Prelude hiding (reverse)
  
  class Sequence s where
  
    reverse :: s a -> s a
  
  and unfortunately the superfluous import of PreludeBasic caused hat-trans to consider reverse as the reverse from PreludeBasic. So reverse was annotated as being of arity 0, leading to later problems.
  
  This bug fix fixes the Edison example. It does not quite solve the whole problem, because Haskell does not require the hiding of reverse. But I believe it solves all realistic examples.
  
  Revision  Changes    Path
  1.14      +23 -12    hat/src/hattrans/HatTrans.hs