[cvs-nhc98] patch applied (hat): Correct bug in expansion of type synonyms of hat-trans.

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Oct 10 07:24:46 EDT 2006


Thu Apr 24 08:57:15 PDT 2003  olaf
  * Correct bug in expansion of type synonyms of hat-trans.
  
  Malcolm Wallace reported the following bug:
  
      ----Id.hs----
      module Id (Id) where
      type Id = Int
  
      ----Bug.hs----
      module Bug where
      import Id
      type Foo = ((Bool,Char) -> Id)
  
  Try "hmake -hat Bug", and you will see the compiler error message
  
      Type constructor Id___1 used at 13:16 is not defined.
  
  The hat-trans'd files look like this:
  
      ----Hat/Id.hs----
      ...
      type Id = Int
      ----Hat/Bug.hs----
      ...
      type Foo = T.Fun (T.Tuple2 Bool Char) Id
      type Foo___1 = T.Tuple2 Bool Char
      type Foo___2 = Id___1
  
  and clearly the module Hat.Id does not define Id___1.
  
  The problem was that the type synonyms that might need expansion because they occur right of the function arrow are always expanded, even if their definition does not contain any function arrows. Restricting the type synonym expansion was very easy (however, required two changes of a nearly duplicated function; because of the duplication problem for interface files and the actual transformation).

    M ./src/hattrans/AuxFile.hs -1 +1
    M ./src/hattrans/TraceId.hs -1 +1


More information about the Cvs-nhc98 mailing list